From efaff8ca1b19c2c241470b7edbba140b62614171 Mon Sep 17 00:00:00 2001 From: Garret Patti <42485635+garretpatti@users.noreply.github.com> Date: Sun, 12 Apr 2026 21:12:58 -0400 Subject: [PATCH] add applied tags as context to description prompt When generating an item description, any already-applied tags are appended to the system prompt as a source of truth, so the model can produce a more accurate description aligned with existing tags. Co-Authored-By: Claude Sonnet 4.6 --- src/lib/ai-tagger.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/ai-tagger.ts b/src/lib/ai-tagger.ts index b83211c..fc04423 100644 --- a/src/lib/ai-tagger.ts +++ b/src/lib/ai-tagger.ts @@ -533,7 +533,11 @@ export async function generateItemDescription(itemKey: string): Promise base64Images = [fs.readFileSync(thumbnailPath, 'base64')] } - const systemPrompt = `You are a media cataloging assistant. Describe the given image briefly and objectively in 1-3 sentences.${config.promptDescribe ? ' ' + config.promptDescribe : ''}` + const { tags: currentTags } = getResolvedTagsForItem(itemKey) + const tagContext = currentTags.length > 0 + ? ` This content has the following tags applied describing it: ${currentTags.map((t) => t.name).join(', ')}. Use these as additional context and treat them as a source of truth, overriding any conflicting assumptions made from the image.` + : '' + const systemPrompt = `You are a media cataloging assistant. Describe the given image briefly and objectively in 1-3 sentences.${config.promptDescribe ? ' ' + config.promptDescribe : ''}${tagContext}` const description = await callVisionApiText(config.endpoint, describeModel, base64Images, systemPrompt)