[PR #8354] [MERGED] feat(lorebooks): check keywords across other lorebooks #8314

Closed
opened 2026-10-27 06:07:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8354
Author: @SpicyMarinara
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/8351-cross-lorebook-keyword-test


📝 Commits (4)

  • 910ccbe chore: start cross-lorebook keyword test work for #8351
  • 1de1946 feat(lorebooks): compare keyword matches across other lorebooks
  • 45e3b23 fix(lorebooks): retain combined entry data between renders
  • 63cabe4 Merge remote-tracking branch 'origin/staging' into feat/8351-cross-lorebook-keyword-test

📊 Changes

4 files changed (+465 additions, -41 deletions)

View changed files

➕ e2e/lorebook-cross-keyword-test.e2e.ts (+287 -0)
📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+147 -25)
📝 packages/client/src/hooks/use-lorebooks.ts (+19 -16)
📝 packages/client/src/localization/locales/en.json (+12 -0)

📄 Description

Linked issue

Closes #8351

Why this change

Authors must currently test lorebooks individually to find repeated activation keywords. Keyword Test should show matching entries from other lorebooks and identify where each entry came from.

What changed

  • Add an optional Include other lorebooks control to Keyword Test, off by default, and list matching entries with their lorebook names and primary/secondary keys.
  • Use the same keyword rules as the current-book preview, including enabled entries, constant entries, regex, case, whole-word and selective matching; compare other visible lorebooks even when those books are switched off.
  • Load foreign entries only while requested, wait for complete results, and show loading, error and retry states so incomplete checks cannot look like no matches.
  • Keep combined entry data stable for preview and coverage calculations, and make the scrollable result list keyboard accessible.

Validation

  • Full pnpm check passed at 45e3b2382 and the combined staging head 63cabe44b, including localization, formatting, lint/types and production build. One existing Professor Mari hook warning remains.
  • Prompt, prompt-attachment and context-fit regressions passed (3 files), including a fresh run after integrating the current staging summary-prompt update.
  • Responsive feature checks passed: 13 passed, 2 intentional mobile skips (the >100-book catalog control runs once on desktop). Existing lorebook tools passed 3/3 across desktop Chromium, mobile Chromium and mobile WebKit. These ran at 45e3b2382; all four feature files are byte-identical after the clean staging integration at 63cabe44b.
  • Fresh combined-head checks at 63cabe44b: 7/7 browser smoke and 3/3 compiled startup passed, with no failures or flaky results.
  • Local CodeRabbit full review examined the original three feature files and raised four trivial comments representing two repeated topics: entry-array stability and concise copy. Both were addressed; the repair review covered the hook and copy. One optional stable-callback suggestion remains: unchanged entry arrays already reuse structural sharing, all five callers consume fields, and cheap array/function creation was existing behavior. Independent source review confirmed those boundaries; no unresolved substantive local finding remains.
  • Manually verify repeated keywords across your own lorebooks and custom matching rules.
  • Manually verify the controls on the reporter’s Android / Termux / Brave setup.
  • Manually verify long source names, keyboard scrolling and retry after a dropped connection.

Proof and limits

The implementation reuses existing loading hooks and matcher helpers; it changes no server, storage, provider or prompt behavior. Cross-lorebook results are an authoring preview and do not change which entries chats use. The full current-book scanner remains separate. Browser checks use synthetic data and device emulation; physical-device verification remains manual.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8354 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/8351-cross-lorebook-keyword-test` --- ### 📝 Commits (4) - [`910ccbe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/910ccbef6583bc6a4978d9c2d4d846b5c70c2d89) chore: start cross-lorebook keyword test work for #8351 - [`1de1946`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1de1946541dc51ab48f01030b28886c1bf374372) feat(lorebooks): compare keyword matches across other lorebooks - [`45e3b23`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45e3b238289e44d6558ad8b918ccbf921218cab9) fix(lorebooks): retain combined entry data between renders - [`63cabe4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/63cabe44b1cefa937a72f47c432ee2f60b537821) Merge remote-tracking branch 'origin/staging' into feat/8351-cross-lorebook-keyword-test ### 📊 Changes **4 files changed** (+465 additions, -41 deletions) <details> <summary>View changed files</summary> ➕ `e2e/lorebook-cross-keyword-test.e2e.ts` (+287 -0) 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+147 -25) 📝 `packages/client/src/hooks/use-lorebooks.ts` (+19 -16) 📝 `packages/client/src/localization/locales/en.json` (+12 -0) </details> ### 📄 Description ## Linked issue Closes #8351 ## Why this change Authors must currently test lorebooks individually to find repeated activation keywords. Keyword Test should show matching entries from other lorebooks and identify where each entry came from. ## What changed - Add an optional **Include other lorebooks** control to Keyword Test, off by default, and list matching entries with their lorebook names and primary/secondary keys. - Use the same keyword rules as the current-book preview, including enabled entries, constant entries, regex, case, whole-word and selective matching; compare other visible lorebooks even when those books are switched off. - Load foreign entries only while requested, wait for complete results, and show loading, error and retry states so incomplete checks cannot look like no matches. - Keep combined entry data stable for preview and coverage calculations, and make the scrollable result list keyboard accessible. ## Validation - Full `pnpm check` passed at `45e3b2382` and the combined staging head `63cabe44b`, including localization, formatting, lint/types and production build. One existing Professor Mari hook warning remains. - Prompt, prompt-attachment and context-fit regressions passed (3 files), including a fresh run after integrating the current staging summary-prompt update. - Responsive feature checks passed: **13 passed, 2 intentional mobile skips** (the >100-book catalog control runs once on desktop). Existing lorebook tools passed **3/3** across desktop Chromium, mobile Chromium and mobile WebKit. These ran at `45e3b2382`; all four feature files are byte-identical after the clean staging integration at `63cabe44b`. - Fresh combined-head checks at `63cabe44b`: **7/7 browser smoke** and **3/3 compiled startup** passed, with no failures or flaky results. - Local CodeRabbit full review examined the original three feature files and raised four trivial comments representing two repeated topics: entry-array stability and concise copy. Both were addressed; the repair review covered the hook and copy. One optional stable-callback suggestion remains: unchanged entry arrays already reuse structural sharing, all five callers consume fields, and cheap array/function creation was existing behavior. Independent source review confirmed those boundaries; no unresolved substantive local finding remains. - [ ] Manually verify repeated keywords across your own lorebooks and custom matching rules. - [ ] Manually verify the controls on the reporter’s Android / Termux / Brave setup. - [ ] Manually verify long source names, keyboard scrolling and retry after a dropped connection. ## Proof and limits The implementation reuses existing loading hooks and matcher helpers; it changes no server, storage, provider or prompt behavior. Cross-lorebook results are an authoring preview and do not change which entries chats use. The full current-book scanner remains separate. Browser checks use synthetic data and device emulation; physical-device verification remains manual. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 06:07:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8314
No description provided.