mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #78] [MERGED] fix: preserve per-message persona identity across persona switches #4447
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#4447
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/78
Author: @LukaTheHero
Created: 4/9/2026
Status: ✅ Merged
Merged: 4/9/2026
Merged by: @LukaTheHero
Base:
main← Head:fix/chat-multi-persona-support📝 Commits (1)
a83612ffix: preserve per-message persona identity across persona switches📊 Changes
7 files changed (+113 additions, -12 deletions)
View changed files
📝
packages/client/src/components/chat/ChatArea.tsx(+10 -1)📝
packages/client/src/components/chat/ChatMessage.tsx(+17 -3)📝
packages/client/src/components/chat/ConversationMessage.tsx(+13 -7)📝
packages/client/src/components/chat/ConversationView.tsx(+12 -0)📝
packages/client/src/hooks/use-generate.ts(+32 -1)📝
packages/server/src/routes/generate.routes.ts(+20 -0)📝
packages/shared/src/types/chat.ts(+9 -0)📄 Description
Problem
When chatting as one persona and then switching to another mid-conversation, all previous user messages retroactively changed their profile picture and name to the new persona. This made multi-persona conversations confusing — you couldn't tell which persona sent which message.
Root Cause
Persona info (name, avatar, colors) was resolved once from the currently active persona and applied identically to all user messages. Messages had no memory of which persona was active when they were sent.
Solution
Store a
personaSnapshotin each user message'sextraJSON field at creation time. This snapshot captures the persona's ID, name, avatar URL, and color settings. Rendering now reads from this snapshot first, preserving the original persona's identity on every message.Changes across 3 packages (7 files):
Shared types (
packages/shared/src/types/chat.ts)personaSnapshotfield toMessageExtrainterfaceServer (
packages/server/src/routes/generate.routes.ts)extraviaupdateMessageExtraClient (
packages/client/)use-generate.ts— Include persona snapshot in the optimistic message (read from React Query cache) so it renders correctly immediatelyConversationMessage.tsx— Readextra.personaSnapshotfor user messages; fall back topersonaInfoprop for older messagesChatMessage.tsx— Same snapshot-first logic for roleplay mode renderingConversationView.tsx— Break Discord-style message grouping when persona changes between consecutive user messages (always show avatar + name for the new persona)ChatArea.tsx— Break roleplay-mode grouping on persona changeBackward compatibility
personaSnapshotgracefully fall back to showing the current active persona (old behavior)extraJSON fieldpnpm check— 0 errors)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.