[PR #1765] [MERGED] fix: conversation prompt inspector uses saved per-message snapshots #5269

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1765
Author: @JorgeLTE
Created: 6/1/2026
Status: ✅ Merged
Merged: 6/1/2026
Merged by: @JorgeLTE

Base: refactor ← Head: fix/conversation-prompt-inspector-snapshots


📝 Commits (2)

  • 1bf31eb fix: conversation prompt inspector uses saved per-message snapshots
  • 35a1041 Merge branch 'refactor' into fix/conversation-prompt-inspector-snapshots

📊 Changes

9 files changed (+230 additions, -35 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/entities.rs (+1 -0)
📝 src-tauri/src/commands/storage/shared.rs (+142 -0)
📝 src/features/modes/conversation/components/ChatConversationSurface.tsx (+8 -2)
📝 src/features/modes/conversation/components/ConversationMessage.tsx (+31 -7)
📝 src/features/modes/conversation/components/ConversationView.tsx (+3 -3)
📝 src/features/modes/shared/chat-ui/components/ChatMessage.tsx (+4 -13)
📝 src/features/modes/shared/chat-ui/hooks/use-chat-timeline-actions.ts (+3 -10)
📝 src/features/modes/shared/chat-ui/index.ts (+1 -0)
➕ src/features/modes/shared/chat-ui/lib/prompt-snapshot.ts (+37 -0)

📄 Description

The Assembled Prompt inspector in conversation mode always did a lossy live rebuild instead of showing the saved snapshot of what was actually sent, and imported v1.6.1 chats showed "No saved prompt snapshot" even though the prompt survived under the legacy extra.cachedPrompt field.

  • Conversation peek now passes { messageId, promptSnapshot } and shows on every assistant message, matching roleplay/game. All modes share a new resolvePromptSnapshotFromExtra helper (bySwipe -> singular precedence).
  • Synthesize a generationPromptSnapshot from legacy extra.cachedPrompt at the storage timeline-projection boundary (non-destructive). Runs in both the single-message mutation projection and the bulk timeline list load, before the field whitelist strips cachedPrompt.

Imported v1.6.1 chats only retain prompts for their last 2 assistant messages (1.6.1 evicts cachedPrompt from older ones); native refactor chats keep a snapshot for every message.

Linked issue

Closes #1702

Why this change

  • Prompt Inspector should now feel like how it was in 1.6.1in Conversation mode

What changed

  • Prompt snapshots are now saved and displayed in the conversation mode, similar to how it is done currently in Roleplay mode.
  • Important conversations from the version 1.6.1 now display their prompts correctly on the prompt inspector.

Validation

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

Manual verification notes

  • Open the refactor.
  • Import a conversation from 1.6.1
  • Inspect the prompt of the last message.
  • Should be the same as in 1.6.1
  • Generate a new message.
  • Inspect the prompt.
  • Should include the actual things that got sent

Docs and release impact

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

UI evidence (if applicable)


🔄 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/1765 **Author:** [@JorgeLTE](https://github.com/JorgeLTE) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/1/2026 **Merged by:** [@JorgeLTE](https://github.com/JorgeLTE) **Base:** `refactor` ← **Head:** `fix/conversation-prompt-inspector-snapshots` --- ### 📝 Commits (2) - [`1bf31eb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1bf31eb908a51d8794c7c44c811ea74b5f04a206) fix: conversation prompt inspector uses saved per-message snapshots - [`35a1041`](https://github.com/Pasta-Devs/Marinara-Engine/commit/35a104114c4811192732e9e05287796a98f7726f) Merge branch 'refactor' into fix/conversation-prompt-inspector-snapshots ### 📊 Changes **9 files changed** (+230 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+1 -0) 📝 `src-tauri/src/commands/storage/shared.rs` (+142 -0) 📝 `src/features/modes/conversation/components/ChatConversationSurface.tsx` (+8 -2) 📝 `src/features/modes/conversation/components/ConversationMessage.tsx` (+31 -7) 📝 `src/features/modes/conversation/components/ConversationView.tsx` (+3 -3) 📝 `src/features/modes/shared/chat-ui/components/ChatMessage.tsx` (+4 -13) 📝 `src/features/modes/shared/chat-ui/hooks/use-chat-timeline-actions.ts` (+3 -10) 📝 `src/features/modes/shared/chat-ui/index.ts` (+1 -0) ➕ `src/features/modes/shared/chat-ui/lib/prompt-snapshot.ts` (+37 -0) </details> ### 📄 Description The Assembled Prompt inspector in conversation mode always did a lossy live rebuild instead of showing the saved snapshot of what was actually sent, and imported v1.6.1 chats showed "No saved prompt snapshot" even though the prompt survived under the legacy extra.cachedPrompt field. - Conversation peek now passes { messageId, promptSnapshot } and shows on every assistant message, matching roleplay/game. All modes share a new resolvePromptSnapshotFromExtra helper (bySwipe -> singular precedence). - Synthesize a generationPromptSnapshot from legacy extra.cachedPrompt at the storage timeline-projection boundary (non-destructive). Runs in both the single-message mutation projection and the bulk timeline list load, before the field whitelist strips cachedPrompt. Imported v1.6.1 chats only retain prompts for their last 2 assistant messages (1.6.1 evicts cachedPrompt from older ones); native refactor chats keep a snapshot for every message. <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## 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 #1702 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Prompt Inspector should now feel like how it was in 1.6.1in Conversation mode ## What changed <!-- List the key changes in this PR --> - Prompt snapshots are now saved and displayed in the conversation mode, similar to how it is done currently in Roleplay mode. - Important conversations from the version 1.6.1 now display their prompts correctly on the prompt inspector. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [x ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x ] Ran the app, clicked through the changes manually - [x ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x ] 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. --> - Open the refactor. - Import a conversation from 1.6.1 - Inspect the prompt of the last message. - Should be the same as in 1.6.1 - Generate a new message. - Inspect the prompt. - Should include the actual things that got sent ## Docs and release impact - [x ] No docs changes needed - [ x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [x ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <!-- Add before/after screenshots or recordings for UI changes --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:14:45 +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#5269
No description provided.