[PR #812] [MERGED] Add lorebook entry vectorization exclusions #4785

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/812
Author: @cha1latte
Created: 5/13/2026
Status: ✅ Merged
Merged: 5/14/2026
Merged by: @cha1latte

Base: main ← Head: feat/issue-741-vectorization-exclusions


📝 Commits (1)

  • 92b82ce Add lorebook vectorization exclusions

📊 Changes

15 files changed (+86 additions, -16 deletions)

View changed files

📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+10 -7)
📝 packages/client/src/components/lorebooks/LorebookEntryRow.tsx (+26 -5)
📝 packages/server/src/db/migrate.ts (+6 -0)
📝 packages/server/src/db/schema/lorebooks.ts (+3 -0)
📝 packages/server/src/routes/generate.routes.ts (+3 -1)
📝 packages/server/src/routes/lorebooks.routes.ts (+6 -2)
📝 packages/server/src/services/import/marinara.importer.ts (+1 -0)
📝 packages/server/src/services/lorebook/keyword-scanner.ts (+1 -0)
📝 packages/server/src/services/storage/lorebooks.storage.ts (+6 -1)
📝 packages/server/test/db-migrations.test.ts (+1 -0)
📝 packages/server/test/knowledge-router.test.ts (+1 -0)
📝 packages/server/test/lorebook-processing.test.ts (+17 -0)
📝 packages/server/test/lorebooks-routes.test.ts (+1 -0)
📝 packages/shared/src/schemas/lorebook.schema.ts (+2 -0)
📝 packages/shared/src/types/lorebook.ts (+2 -0)

📄 Description

Linked issue

Closes #741

Why this change

Lorebooks could only vectorize every entry together, which made key-only entries discoverable through semantic search even when users wanted them to activate only through explicit keys.

What changed

  • Added a per-entry excludeFromVectorization flag across shared types, schemas, storage, import, and migration paths.
  • Updated bulk lorebook vectorization and semantic lorebook scanning to skip excluded entries while leaving key-based activation intact.
  • Added lorebook editor UI for marking an entry as No Vector, plus overview/row status updates that count excluded entries separately.
  • Added migration and lorebook processing coverage for the new field and semantic exclusion behavior.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • pnpm --filter @marinara-engine/shared build passed.
  • pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/lorebook-processing.test.ts test/db-migrations.test.ts passed: 33 tests.
  • pnpm check passed.
  • pnpm db:push was attempted for the schema change, but this checkout has no db:push script (Command "db:push" not found).
  • Ran the app locally with the server on PORT=7861, created a lorebook entry with excludeFromVectorization: true, opened it in the real lorebook editor, and verified the entry row shows the vector-excluded state, the expanded drawer shows No Vector, and the overview reports 0/0 entries vectorized with 1 excluded.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Verified in the local app with Playwright MCP. Screenshots were captured locally for the implementation run but are not attached to this PR.


🔄 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/812 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/13/2026 **Status:** ✅ Merged **Merged:** 5/14/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `feat/issue-741-vectorization-exclusions` --- ### 📝 Commits (1) - [`92b82ce`](https://github.com/Pasta-Devs/Marinara-Engine/commit/92b82ce934c3f2c1ec746be29c0baf7ff12c9689) Add lorebook vectorization exclusions ### 📊 Changes **15 files changed** (+86 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+10 -7) 📝 `packages/client/src/components/lorebooks/LorebookEntryRow.tsx` (+26 -5) 📝 `packages/server/src/db/migrate.ts` (+6 -0) 📝 `packages/server/src/db/schema/lorebooks.ts` (+3 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+3 -1) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+6 -2) 📝 `packages/server/src/services/import/marinara.importer.ts` (+1 -0) 📝 `packages/server/src/services/lorebook/keyword-scanner.ts` (+1 -0) 📝 `packages/server/src/services/storage/lorebooks.storage.ts` (+6 -1) 📝 `packages/server/test/db-migrations.test.ts` (+1 -0) 📝 `packages/server/test/knowledge-router.test.ts` (+1 -0) 📝 `packages/server/test/lorebook-processing.test.ts` (+17 -0) 📝 `packages/server/test/lorebooks-routes.test.ts` (+1 -0) 📝 `packages/shared/src/schemas/lorebook.schema.ts` (+2 -0) 📝 `packages/shared/src/types/lorebook.ts` (+2 -0) </details> ### 📄 Description ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #741 ## Why this change <!-- What user problem, bug, or goal does this solve? --> Lorebooks could only vectorize every entry together, which made key-only entries discoverable through semantic search even when users wanted them to activate only through explicit keys. ## What changed <!-- List the key changes in this PR --> - Added a per-entry `excludeFromVectorization` flag across shared types, schemas, storage, import, and migration paths. - Updated bulk lorebook vectorization and semantic lorebook scanning to skip excluded entries while leaving key-based activation intact. - Added lorebook editor UI for marking an entry as `No Vector`, plus overview/row status updates that count excluded entries separately. - Added migration and lorebook processing coverage for the new field and semantic exclusion behavior. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - `pnpm --filter @marinara-engine/shared build` passed. - `pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/lorebook-processing.test.ts test/db-migrations.test.ts` passed: 33 tests. - `pnpm check` passed. - `pnpm db:push` was attempted for the schema change, but this checkout has no `db:push` script (`Command "db:push" not found`). - Ran the app locally with the server on `PORT=7861`, created a lorebook entry with `excludeFromVectorization: true`, opened it in the real lorebook editor, and verified the entry row shows the vector-excluded state, the expanded drawer shows `No Vector`, and the overview reports `0/0 entries vectorized` with `1 excluded.` ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Verified in the local app with Playwright MCP. Screenshots were captured locally for the implementation run but are not attached to this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:10: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#4785
No description provided.