feat: on-device LLM tag suggestions in the metadata editor (P13c)#142
Merged
Conversation
Smart auto-tagging — an on-device LLM suggests topical tags for an item, surfaced as a separate, gated "AI suggestions" row in the metadata editor (below the graph co-occurrence chips). On-demand only; tags are never auto-applied — the user taps a chip to add it (reusing the P10c-c-2 addTagToItem path). Generation-tier-gated; hidden where no model fits. - Pure helpers (tag_suggestions.dart): buildTagPrompt (head-truncated) + parseTagSuggestions (split commas/newlines, strip #/quotes/bullets, lowercase, dedupe, exclude already-applied, cap). - Controller (item_ai_tags_provider.dart): autoDispose itemAiTags(itemId), mirroring the P13b-2 translation controller — sources title + description/ transcript/ocrText, generates, parses excluding current tags; remove(tag) after apply. - UI (_AiTagSuggestions): "Suggest tags with AI" → chips via ActionChip + addTagToItem; reuses aiSummaryAction for the on-ramp to AI settings. - Repo one-shots: tagNamesForItem, mediaItemById. - Tests: prompt/parse units, controller (fake engine: excludes applied, lowercases, error path), editor gating (low hides / high shows). - Docs: P13-PLAN P13c status, VERIFICATION P13c, BACKLOG (P13c-2 auto-tag follow-up + tag casing/normalization). No deps, no schema. https://claude.ai/code/session_013JoYmLCosYt5tQ8qwdbL1T
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
P13c — smart auto-tagging. An on-device LLM suggests topical tags for an item, surfaced as a separate, gated "AI suggestions" row in the metadata editor (below the existing graph co-occurrence chips). On-demand only and never auto-applied — the user taps a chip to add it, reusing the P10c-c-2
addTagToItempath. Generation-tier-gated; the row is hidden where no model fits the device (the graph suggestions still work).Free-text generation + parse (no structured seam; the FunctionGemma/Qwen3 fork stays deferred to v2, per the P13 map). No deps, no schema.
Changes
tag_suggestions.dart):buildTagPrompt(head-truncated) + a forgivingparseTagSuggestions(splits commas/newlines/semicolons, strips#/quotes/bullets, lowercases, dedupes, excludes already-applied, caps).item_ai_tags_provider.dart): autoDisposeitemAiTags(itemId), mirroring the P13b-2 translation controller — sources title + description/transcript/ocrText, generates viagenerationEngineProvider, parses excluding current tags;remove(tag)after apply._AiTagSuggestionsinmetadata_edit_screen.dart): a "Suggest tags with AI" button → chips viaActionChip+addTagToItem; reusesaiSummaryActionfor the on-ramp to AI settings when generation isn't enabled.tagNamesForItem,mediaItemById(avoid theStreamProvider.futureflakiness seen in P13b-2).Tests
dart formatclean ·flutter analyzeNo issues ·flutter test816 passed —buildTagPrompt/parseTagSuggestionsunits, the controller with a fakeGenerationEngine(excludes already-applied tags, lowercases, error path), and editor gating (low tier hides the AI row / high tier shows it; graph suggestions unaffected).Honest notes
addTagToItemtrims but doesn't lowercase, so AI tags are lowercased while manual/graph tags keep their case.Next: P13d — local GraphRAG "Ask your library" (the flagship).
https://claude.ai/code/session_013JoYmLCosYt5tQ8qwdbL1T
Generated by Claude Code