refactor(Index.tsx): improve tag generation logic and Ollama status handling
This commit is contained in:
@@ -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');
|
||||
|
Reference in New Issue
Block a user