mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #488] [MERGED] Fix Lorebook Keeper duplicate paragraph persistence #4640
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4640
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/488
Author: @cha1latte
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/7/2026
Merged by: @cha1latte
Base:
main← Head:fix/issue-459-lorebook-keeper-dedupe📝 Commits (3)
ad4a1a8Fix Lorebook Keeper duplicate paragraph persistenceeffd23aAddress Lorebook Keeper dedupe review feedbackb1f3108Preserve replacement content with keeper facts📊 Changes
1 file changed (+25 additions, -4 deletions)
View changed files
📝
packages/server/src/routes/generate/lorebook-keeper-utils.ts(+25 -4)📄 Description
What?
Fixes Lorebook Keeper update persistence so repeated duplicate paragraphs are collapsed before content is saved.
This hardens the existing Lorebook Keeper merge path against model outputs that repeat the same replacement paragraph multiple times.
Fixes #459
Why?
Issue #459 reports Lorebook Keeper accumulating 3-6 copies of the same paragraph for a character instead of replacing or adding only new information.
Even with the newer
newFactsprompt path, the server should defensively dedupe repeated replacement content because LLM output can ignore formatting instructions.How?
Added paragraph-level deduplication inside
mergeLorebookKeeperUpdateContent.The helper normalizes paragraph text for comparison, keeps the first copy, and still preserves novel replacement paragraphs and novel
newFacts.Testing?
pnpm --dir packages/server exec tsx ../../scratch/issue-459-lorebook-keeper-repro.tsnewFactscollapse.pnpm checkpassed.Screenshots / Visual Proof
Visual proof shows the before repro failing with 3 duplicate paragraph occurrences, and the after repro passing with the duplicate collapsed to 1 copy.
Anything Else?
Opened as draft for maintainer review. No manual hardware, provider, or UI verification is required for the core claim.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.