Skip to content

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

Open
rppavan wants to merge 6 commits 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 6 commits 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 added 6 commits July 12, 2026 22:11
Express/Vertex image generation rejected the responseFormat.image.aspectRatio
field added in 4bfb98e (400 INVALID_ARGUMENT); it expects imageConfig.aspectRatio
instead. Split the shared payload builder so each Gemini surface gets the field
shape it actually supports.

Also, Gemini omits `parts` entirely when it hard-blocks image generation (e.g.
finishReason=IMAGE_PROHIBITED_CONTENT), which made parsing fail with a generic
"missing field `parts`" instead of surfacing the finishMessage.

Tested: cargo test --lib image_generator::provider_adapter::google_gemini (4/4
pass), cargo build --lib clean.

By apparao.parwatikar
Adds a `tags` field (JSON array in a nullable TEXT column) to Personas
and Lorebooks end-to-end, mirroring the existing Character.tags, so a
later Library sort/filter feature can enable them via one seam.

- DB migration v80 + fresh-install schema (personas.tags, lorebooks.tags)
- Rust storage: persona read/write across all 4 JSON sites; lorebook
  struct + from_row + upsert; group-chat lorebook row-mappers carry tags
- TS: PersonaSchema/LorebookSchema + savePersona/saveLorebook builders
- Shared TagsInput component + parseCommaSeparated util (characters
  refactored onto them)
- Persona create & edit forms; lorebook metadata menu (retitled "Edit
  lorebook"); fix: preserve tags on library quick-rename
- i18n keys

Deferred (documented): tags do not propagate through export/import,
backup/restore, or entity-transfer/sync paths (non-breaking).

By apparao.parwatikar
Adds a Recent/A–Z sort toggle (URL-persisted) and a faceted tag-filter
chip row to the Library page.

- Pure, Vitest-tested pipeline module (libraryPipeline.ts): tagKey
  normalization, scope, AND-filter, faceting (counts from filtered,
  display casing from scoped), Recent/Alphabetical sort, visibility
  rule, and tab-switch prune
- LibraryPage wiring: useMemo chain, sort toggle, tag chip row with
  counts, filtered-empty state. Tag filter applies only where the chip
  row is visible; TAGGABLE_TYPES seam keeps it characters-only, one line
  from enabling personas/lorebooks
- Vitest runner added (24 pure-function unit tests); i18n keys

By apparao.parwatikar
@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.

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