mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2847] [MERGED] fix(chat): tracker edit targeting, prefill debounce, prompt-editor close, per-chat lorebook disable, convo card info #5767
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#5767
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/2847
Author: @Romuromylus
Created: 6/24/2026
Status: ✅ Merged
Merged: 6/24/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/tracker-edit-target-and-settings-lag📝 Commits (5)
76b3320fix(tracker): target tracker character edits by unique id; debounce Assistant Prefill input52ead48fix(tracker): drop edits whose character id vanished; guard prefill draft re-seed while focusedef41ab0fix(chat): keep the expanded prompt editor open when clicked inside a chat drawerecab269feat(lorebook): let users disable auto-activated lorebooks per chatdf1ed3ffix(conversation): include character/persona card info when a prompt preset is selected📊 Changes
15 files changed (+273 additions, -77 deletions)
View changed files
📝
packages/client/src/components/chat/ChatSettingsDrawer.tsx(+30 -6)➕
packages/client/src/components/ui/DraftTextarea.tsx(+63 -0)📝
packages/client/src/components/ui/ExpandedTextarea.tsx(+6 -0)📝
packages/client/src/components/ui/GenerationParametersEditor.tsx(+4 -3)📝
packages/client/src/features/chat-settings/sections/LorebooksSection.tsx(+43 -18)📝
packages/client/src/features/tracker-panel/hooks/use-tracker-mutations.ts(+15 -18)📝
packages/client/src/features/tracker-panel/lib/character-tracker-data.ts(+41 -0)📝
packages/server/src/routes/chats.routes.ts(+11 -2)📝
packages/server/src/routes/generate.routes.ts(+16 -16)📝
packages/server/src/routes/generate/dry-run-route.ts(+2 -2)📝
packages/server/src/routes/generate/generate-route-utils.ts(+10 -1)📝
packages/server/src/routes/lorebooks.routes.ts(+2 -2)📝
packages/server/src/routes/prompts.routes.ts(+2 -2)📝
packages/server/src/services/lorebook/game-lorebook-scope.ts(+23 -7)📝
packages/shared/src/types/chat.ts(+5 -0)📄 Description
Linked issues
Closes #2845
Closes #2846
Closes #2848
Closes #2849
Closes #2850
Why this change
A batch of roleplay- and conversation-mode issues reported by users, bundled into one PR at maintainer request.
What changed
#2845 — tracker edit target resolution
findIndexbycharacterId. Present-character ids come from the LLM character-tracker agent and are not guaranteed unique (the prompt allows "ID or name"), so when several present characters shared an id,findIndexalways returned the first match and the action landed on character #1.resolveCharacterTargetIndex(features/tracker-panel/lib/character-tracker-data.ts): trust the id only when it uniquely identifies one character, otherwise fall back to the rendered index — the same rulefindUniqueNamedIndexalready applies to the other tracker list mutations. Wired intoupdateCharacter,removeCharacter, and the avatar-upload flow inuse-tracker-mutations.ts.#2846 — Assistant Prefill input responsiveness
chatParametersand committed every keystroke straight to the per-chat metadata mutation, so the field only advanced after the round-trip re-rendered the settings tree.DraftTextarea(components/ui/DraftTextarea.tsx), a local-buffered textarea that commits on blur (and flushes on unmount so closing the drawer mid-edit keeps the text), mirroring the existingDraftNumberInputpattern. Wired it into the Assistant Prefill field.#2848 — expanded prompt editor closes on click
ExpandedTextareaoverlay renders through a portal todocument.body, above the chat settings drawer. The drawer's capture-phasepointerdownoutside-close handler treated clicks inside the portal as "outside", so the first click (including the Collapse button) closed the drawer and unmounted the editor before its edit could commit.data-chat-floating-panelso the drawer's handler treats clicks inside it as inside. Closing now happens only via Collapse/Escape, which route through the editor'sonCloseand persist the change. Also covers the Game extra-prompt and Scene-instructions expanded editors, which share the component.#2849 — disable a character-bound lorebook per chat
filterRelevantLorebooks()andlistActiveEntries()both honor anexcludedLorebookIdsfilter, but the generation / scan / dry-run / prompt-preview paths only ever passed the game-keeper exclusions, and there was no UI or metadata field for a per-chat exclusion.ChatMetadata.excludedLorebookIds; renamedresolveGameLorebookScopeExclusions→resolveLorebookScopeExclusionsand folded per-chatexcludedLorebookIdsinto the result for every mode, so all callers drop excluded books before injection; validated the field on the metadata PATCH route.#2850 — conversation card info with a preset selected
chatMode !== "game" && !presetId) — correct for roleplay (the assembler covers it) but leaving conversation+preset with nothing.shouldInjectIdentityFallbacknow always runs for conversation mode regardless of preset. The injector already skips any character/persona whose profile is already in the prompt, so custom conversation prompts that embed{{description}}et al. are not duplicated, and conversation-without-a-preset behavior is unchanged.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
All five changes verified on a build deployed to my private EasyPanel instance.
characterId, edited the second character's Mood in the docked tracker — the edit persisted to the second character (UI + game-state API); the others were untouched. Previously it landed on the first.excludedLorebookIds, and returned again after re-enabling; the metadata PATCH rejects a non-arrayexcludedLorebookIdswith 400.Caveat for #2850: the in-app "peek prompt" and dry-run previews use a separate best-effort assembler that does not mirror the real generation path, so they can still show only names. The fix is verified against the cached/exact prompt of a real generation; aligning the preview assemblers would be a separate change.
Notes:
resolveCharacterTargetIndexandresolveLorebookScopeExclusionsare pure functions a future test harness could cover directly.Docs and release impact
UI evidence (if applicable)
All five changes verified live on the deployed branch as described under Manual verification notes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.