Skip to content

Adding tags field to personas and lorebooks & filter with tags, sort with date and aphabetically - #77

Open
rppavan wants to merge 1 commit into
LettuceAI:mainfrom
rppavan:main
Open

Adding tags field to personas and lorebooks & filter with tags, sort with date and aphabetically#77
rppavan wants to merge 1 commit into
LettuceAI:mainfrom
rppavan:main

Conversation

@rppavan

@rppavan rppavan commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Personas and lorebooks can now carry tags, matching the existing Character.tags. Tags are stored as a JSON array in a nullable TEXT column and edited in the persona create/edit forms and the lorebook metadata sheet. Adds organization controls to the Library: a sort toggle (Recent / A–Z, URL-persisted) and a faceted tag-filter chip row. To make tag filtering meaningful across the whole Library, this also gives personas and lorebooks a tags field (characters already had one).

Tags for personas & lorebooks (groundwork)

  • SQLite migration v80 adds a nullable tags column to personas and lorebooks (guarded + idempotent; aborts on a real ALTER failure so it retries instead of half-applying)
  • Rust read/write paths, PersonaSchema/LorebookSchema, and the savePersona/saveLorebook builders
  • Shared + parseCommaSeparated (characters refactored onto them); lorebook metadata sheet retitled "Edit lorebook"

Library sorting + tag filtering

  • Pure, unit-tested pipeline module (libraryPipeline.ts): normalization, scope, AND-filter, faceted derivation (counts from the filtered set, labels from the full set, dead-end chips hidden), Recent/Alphabetical sort
  • Wired into LibraryPage as a useMemo chain; chip row + sort toggle render only on the four entity tabs (not Images Audio)
  • Sort persists to the URL; tag selection is session-only and prunes on tab switch

@rppavan rppavan changed the title Add a tags field to personas and lorebooks & filter with tags, sort with date and aphabetically Adding tags field to personas and lorebooks & filter with tags, sort with date and aphabetically Jul 19, 2026
@MegalithOfficial

Copy link
Copy Markdown
Contributor

Hey, thanks for working on this. the feature looks good overall, but there are a few things we need to fix before merging:

  • persona and lorebook tags aren’t included in sync, backups, or export/import. sync currently uses INSERT OR REPLACE, so it can actually wipe existing tags.
  • switching library tabs can leave the tag filter with zero results while hiding the clear button, so the user gets stuck on the empty state.
  • the new UI strings were only added to English. please add proper translations to the other supported locales too. Feel free to use AI-generated translations on this one.

@rppavan

rppavan commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@MegalithOfficial

Sync. Wire structs never carried tags at all. Worse: materialize_domain_heads feeds a rebuilt snapshot back through the same INSERT OR REPLACE, so a peer editing an unrelated setting nulled out every persona tag on the other device. Now carried through the SELECTs, both wire structs, both apply paths. CHANGE_SCHEMA_VERSION bumped so old heads rebuild from the live DB.

Backups/export. Round-trips now: backup, UEC/USC, ST export, character-package importer. Tests both domains, plus one that builds a tagless snapshot the old way so the wipe is demonstrated, not assumed.

Tag filter dead end. Facet counts came from the filtered set, so a zero-match selection emptied the chip list, and the clear button was gated on that same count. Selected tags now stick around as zero-count chips, clear follows the selection alone, rules moved into libraryPipeline.ts where they're tested.

i18n. All 19 locales, reusing each one's existing wording for "Tags" and lorebooks. Test pins the keys. Also caught library.sort.label, never rendered anywhere; it's the sort button's accessible name now.

@MegalithOfficial

Copy link
Copy Markdown
Contributor

Sync is being rewritten completely. Though I havent reviewed any of your code atm.

Add tag support to personas and lorebooks, including editing UIs, library
sorting and faceted tag filtering, and round-tripping across sync, backup,
export and transfer. Migration v88 -> v89 adds the tags columns; sync v2
carries the new column automatically via full-row changesets.
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