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())
|
.map((tag: string) => tag.trim())
|
||||||
.filter((tag: string) => tag.length > 0);
|
.filter((tag: string) => tag.length > 0);
|
||||||
|
|
||||||
addDebugInfo(`Generated ${tags.length} tags: ${tags.join(', ')}`);
|
// Filter out tags that already exist in the content
|
||||||
return tags;
|
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
|
// Last resort: return empty array
|
||||||
addDebugInfo('Could not extract tags from Ollama response');
|
addDebugInfo('Could not extract tags from Ollama response');
|
||||||
|
Reference in New Issue
Block a user