Add AI-powered image tagging via local LLM

Adds automatic image tagging that runs as a post-scan phase, sending
thumbnails to an OpenAI-compatible vision API and applying matching
tags from the user-defined tag vocabulary.

- New ai-tagger module with batch processing, failure tolerance, and
  tag validation against existing vocabulary
- Admin settings page (Manage > AI Tagging) for endpoint, model, and
  enable toggle with connection testing
- DB migration for ai_tagged_at tracking column and AI config seeds
- Re-tag All support to queue items for reprocessing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Garret Patti
2026-04-12 15:18:03 -04:00
parent 9bff0f848a
commit 0238dbda7a
9 changed files with 708 additions and 0 deletions

View File

@@ -36,3 +36,24 @@ export function updateScanConfig(schedule: string, enabled: boolean): void {
export function setScanLastRan(ts: number): void {
setSetting('scan_last_ran', String(ts))
}
// ─── AI Settings ─────────────────────────────────────────────────────────────
interface AiConfig {
endpoint: string
model: string
enabled: boolean
}
export function getAiConfig(): AiConfig {
const endpoint = getSetting('ai_endpoint') ?? ''
const model = getSetting('ai_model') ?? ''
const enabled = getSetting('ai_enabled') === 'true'
return { endpoint, model, enabled }
}
export function updateAiConfig(endpoint: string, model: string, enabled: boolean): void {
setSetting('ai_endpoint', endpoint)
setSetting('ai_model', model)
setSetting('ai_enabled', enabled ? 'true' : 'false')
}