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

@@ -10,6 +10,7 @@ import { scanGamesLibrary } from './games'
import { getThumbnailPath } from './thumbnails'
import { computeFingerprint } from './fingerprint'
import { reKeyMediaItem } from './tags'
import { runAiTagging } from './ai-tagger'
let scanRunning = false
@@ -70,6 +71,10 @@ export async function runLibraryScan(library: Library): Promise<void> {
await scanMixed(library, libraryRoot)
break
}
await runAiTagging(library, libraryRoot).catch((err) =>
console.error(`[ai-tagger] Error tagging library "${library.name}":`, err)
)
}
// ---------------------------------------------------------------------------