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 <noreply@anthropic.com>
This commit is contained in:
Garret Patti
2026-04-12 21:12:58 -04:00
parent 89ac22e9d1
commit efaff8ca1b

View File

@@ -533,7 +533,11 @@ export async function generateItemDescription(itemKey: string): Promise<string>
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)