refactor(Index.tsx): improve tag generation logic and Ollama status handling

This commit is contained in:
2025-08-29 13:21:59 +02:00
parent 48f3545454
commit d4dfe11cef

View File

@@ -368,8 +368,17 @@ $current`);
.map((tag: string) => tag.trim())
.filter((tag: string) => tag.length > 0);
addDebugInfo(`Generated ${tags.length} tags: ${tags.join(', ')}`);
return tags;
// Filter out tags that already exist in the content
const filteredTags = tags.filter((tag: string) => {
const tagExists = content.toLowerCase().includes(tag.toLowerCase());
if (tagExists) {
addDebugInfo(`Removing tag "${tag}" - already exists in content`);
}
return !tagExists;
});
addDebugInfo(`Generated ${tags.length} tags, filtered to ${filteredTags.length}: ${filteredTags.join(', ')}`);
return filteredTags;
// Last resort: return empty array
addDebugInfo('Could not extract tags from Ollama response');