[PR #7807] [MERGED] feat(peek-prompt): copy the assembled prompt in one click #7936

Closed
opened 2026-10-24 04:08:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7807
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/7798-copy-assembled-prompt


📝 Commits (1)

  • 6581506 feat(peek-prompt): copy the assembled prompt in one click

📊 Changes

4 files changed (+56 additions, -9 deletions)

View changed files

📝 docs/chats/peek-prompt.md (+2 -0)
📝 e2e/core-flows.e2e.ts (+18 -0)
📝 packages/client/src/components/chat/PeekPromptModal.tsx (+32 -9)
📝 packages/client/src/localization/locales/en.json (+4 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7798

Why this change

  • To debug a reply, or to paste the whole prompt into another LLM tool, people currently have to expand every section and the Chat History in Peek Prompt and then select and copy the text by hand. That is slow for a long prompt and easy to get wrong. The issue asked for one narrow copy button in the existing viewer (not the broader view proposed in #6440).

What changed

  • PeekPromptModal.tsx: a small icon button next to the close button in the Assembled Prompt header. One click copies every message the viewer holds, in send order, as plain text. Each message sits under a [system] / [user] / [assistant] line, with a blank line between messages and the content left exactly as it is. Collapsed sections and chat history are included because the copy is built from the messages, not from the opened sections.
  • It copies the messages the viewer is showing. For an Exact Text Model Request, that means the saved request; nothing is rebuilt from current settings. Copying sends no model request and leaves the prompt unchanged. (After a Decision test, if you switch to Show tested prompt, the button copies that tested prompt, because that is what the viewer is then showing.)
  • Reuses the shared copyToClipboard helper (with its HTTP fallback) and the existing sonner toast pattern. The control is a native type="button" with an aria-label and a tooltip, so it works from the keyboard and with screen readers.
  • en.json: four new keys, sorted: ui.chat.peekpromptmodal.copyPrompt, copyPromptHint, promptCopied and promptCopyFailed. Community locales fall back to English.
  • e2e/core-flows.e2e.ts: the existing mobile Peek Prompt test, which opens an exact saved two-message request, now taps Copy assembled prompt and checks the toast and the exact clipboard text: "[system]\nStay in character.\n\n[user]\nContinue the scene.".
  • docs/chats/peek-prompt.md: one paragraph describing the copy button.

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

Commands the agent ran (results as reported, not ticked):

  • pnpm check: exit 0. This includes localization:check, format:check, lint, check:e2e-types and build.
  • pnpm exec prettier --check e2e/core-flows.e2e.ts docs/chats/peek-prompt.md: clean.
  • PLAYWRIGHT_ONLY_PROJECT=mobile pnpm exec playwright test e2e/core-flows.e2e.ts -g "Peek prompt keeps its tapped action visible" --project mobile-chromium --project mobile-webkit (on custom ports): 12/12 passed, covering Roleplay, Classic Conversation and Bubble Conversation in dark and light.
  • pnpm build:shared && node ./scripts/run-regressions.mjs --filter roleplay-streaming: passed. This regression reads PeekPromptModal.tsx source.

Manual verification notes

  • Manually verify in a desktop browser that the copy icon appears beside the close button in the Peek Prompt header and that its tooltip reads "Copy the whole prompt as plain text, including closed sections."
  • Manually verify in Roleplay and Conversation chats that one click copies the whole prompt, including Chat History and sections you have not expanded, with a [role] line before each message, and that a "Prompt copied." toast appears.
  • Manually verify on a historical reply (Exact Text Model Request badge) that the copied text matches the saved request, even after changing preset or character settings.
  • Manually verify that Tab reaches the copy button and that Enter or Space copies.
  • Manually verify over plain HTTP (for example a LAN or Tailscale address) that copying still works, or that "Could not copy the prompt." appears if the browser blocks it.
  • Manually verify the header layout on a narrow mobile viewport in light and dark themes.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

English docs changed: docs/chats/peek-prompt.md. Translations will be handled in the release docs-i18n sweep, so no separate [docs-i18n] issue was opened.

UI evidence (if applicable)

  • The Playwright run attaches mobile-roleplay-peek-prompt-*.png screenshots that show the header with the new button and the copy toast.

Summary by CodeRabbit

  • New Features
    • Added an option to copy the assembled prompt as plain text, including unopened sections and chat messages in send order with role labels.
    • Copying saved requests preserves the exact text as sent and does not send a new model request or change the prompt.
    • Success and failure messages confirm the result of copying.

🔄 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/7807 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/7798-copy-assembled-prompt` --- ### 📝 Commits (1) - [`6581506`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6581506c96e4770b1064dfa9fe4de701c4f5aaff) feat(peek-prompt): copy the assembled prompt in one click ### 📊 Changes **4 files changed** (+56 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `docs/chats/peek-prompt.md` (+2 -0) 📝 `e2e/core-flows.e2e.ts` (+18 -0) 📝 `packages/client/src/components/chat/PeekPromptModal.tsx` (+32 -9) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7798 ## Why this change - To debug a reply, or to paste the whole prompt into another LLM tool, people currently have to expand every section and the Chat History in Peek Prompt and then select and copy the text by hand. That is slow for a long prompt and easy to get wrong. The issue asked for one narrow copy button in the existing viewer (not the broader view proposed in #6440). ## What changed - `PeekPromptModal.tsx`: a small icon button next to the close button in the **Assembled Prompt** header. One click copies every message the viewer holds, in send order, as plain text. Each message sits under a `[system]` / `[user]` / `[assistant]` line, with a blank line between messages and the content left exactly as it is. Collapsed sections and chat history are included because the copy is built from the messages, not from the opened sections. - It copies the messages the viewer is showing. For an **Exact Text Model Request**, that means the saved request; nothing is rebuilt from current settings. Copying sends no model request and leaves the prompt unchanged. (After a Decision test, if you switch to **Show tested prompt**, the button copies that tested prompt, because that is what the viewer is then showing.) - Reuses the shared `copyToClipboard` helper (with its HTTP fallback) and the existing sonner toast pattern. The control is a native `type="button"` with an `aria-label` and a tooltip, so it works from the keyboard and with screen readers. - `en.json`: four new keys, sorted: `ui.chat.peekpromptmodal.copyPrompt`, `copyPromptHint`, `promptCopied` and `promptCopyFailed`. Community locales fall back to English. - `e2e/core-flows.e2e.ts`: the existing mobile Peek Prompt test, which opens an exact saved two-message request, now taps **Copy assembled prompt** and checks the toast and the exact clipboard text: `"[system]\nStay in character.\n\n[user]\nContinue the scene."`. - `docs/chats/peek-prompt.md`: one paragraph describing the copy button. ## 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` Commands the agent ran (results as reported, not ticked): - `pnpm check`: exit 0. This includes localization:check, format:check, lint, check:e2e-types and build. - `pnpm exec prettier --check e2e/core-flows.e2e.ts docs/chats/peek-prompt.md`: clean. - `PLAYWRIGHT_ONLY_PROJECT=mobile pnpm exec playwright test e2e/core-flows.e2e.ts -g "Peek prompt keeps its tapped action visible" --project mobile-chromium --project mobile-webkit` (on custom ports): 12/12 passed, covering Roleplay, Classic Conversation and Bubble Conversation in dark and light. - `pnpm build:shared && node ./scripts/run-regressions.mjs --filter roleplay-streaming`: passed. This regression reads `PeekPromptModal.tsx` source. ### Manual verification notes - Manually verify in a desktop browser that the copy icon appears beside the close button in the Peek Prompt header and that its tooltip reads "Copy the whole prompt as plain text, including closed sections." - Manually verify in Roleplay and Conversation chats that one click copies the whole prompt, including Chat History and sections you have not expanded, with a `[role]` line before each message, and that a "Prompt copied." toast appears. - Manually verify on a historical reply (Exact Text Model Request badge) that the copied text matches the saved request, even after changing preset or character settings. - Manually verify that Tab reaches the copy button and that Enter or Space copies. - Manually verify over plain HTTP (for example a LAN or Tailscale address) that copying still works, or that "Could not copy the prompt." appears if the browser blocks it. - Manually verify the header layout on a narrow mobile viewport in light and dark themes. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) English docs changed: `docs/chats/peek-prompt.md`. Translations will be handled in the release docs-i18n sweep, so no separate `[docs-i18n]` issue was opened. ## UI evidence (if applicable) - The Playwright run attaches `mobile-roleplay-peek-prompt-*.png` screenshots that show the header with the new button and the copy toast. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added an option to copy the assembled prompt as plain text, including unopened sections and chat messages in send order with role labels. * Copying saved requests preserves the exact text as sent and does not send a new model request or change the prompt. * Success and failure messages confirm the result of copying. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:58 +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#7936
No description provided.