Skip to content

feat: on-device LLM tag suggestions in the metadata editor (P13c)#142

Merged
blokzdev merged 1 commit into
mainfrom
claude/p13c-auto-tagging
Jun 2, 2026
Merged

feat: on-device LLM tag suggestions in the metadata editor (P13c)#142
blokzdev merged 1 commit into
mainfrom
claude/p13c-auto-tagging

Conversation

@blokzdev
Copy link
Copy Markdown
Owner

@blokzdev blokzdev commented Jun 2, 2026

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 addTagToItem path. 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

  • Pure helpers (tag_suggestions.dart): buildTagPrompt (head-truncated) + a forgiving parseTagSuggestions (splits commas/newlines/semicolons, strips #/quotes/bullets, lowercases, dedupes, excludes already-applied, caps).
  • Controller (item_ai_tags_provider.dart): autoDispose itemAiTags(itemId), mirroring the P13b-2 translation controller — sources title + description/transcript/ocrText, generates via generationEngineProvider, parses excluding current tags; remove(tag) after apply.
  • UI (_AiTagSuggestions in metadata_edit_screen.dart): a "Suggest tags with AI" button → chips via ActionChip + addTagToItem; reuses aiSummaryAction for the on-ramp to AI settings when generation isn't enabled.
  • Repo one-shots: tagNamesForItem, mediaItemById (avoid the StreamProvider.future flakiness seen in P13b-2).

Tests

dart format clean · flutter analyze No issues · flutter test 816 passedbuildTagPrompt/parseTagSuggestions units, the controller with a fake GenerationEngine (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

  • Owed APK spot-check (VERIFICATION → P13c): generate + apply tags on a real item offline; low-end device shows no AI row; on-ramp opens AI settings when generation is off. The native generate→chips flow can't be CI-tested (the item-detail/editor async-generate boundary, same as P13a).
  • Auto-tag-on-download is a deliberate follow-up (P13c-2), not in this PR. Logged in BACKLOG with a caveat: tags are user-curated (they drive facets), so unlike the passive summary/OCR enrichments, the auto variant should likely suggest + a "review tags" Inbox nudge rather than silently auto-apply — to be decided when planning it.
  • Tag casing noted in BACKLOG: addTagToItem trims 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

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
@blokzdev blokzdev merged commit 3b3adc8 into main Jun 2, 2026
1 check passed
@blokzdev blokzdev deleted the claude/p13c-auto-tagging branch June 2, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants