[PR #1089] [MERGED] Add registered prompt override editor #4917

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1089
Author: @Xelvanis
Created: 5/22/2026
Status: ✅ Merged
Merged: 5/22/2026
Merged by: @Xelvanis

Base: staging ← Head: feature/issue-1075-prompt-overrides


📝 Commits (6)

  • 48d88a6 Add prompt override editor
  • 7e63ebf Test conversation selfie prompt override resolution
  • d4e4e2e Collapse prompt overrides settings
  • e1a0afd Simplify prompt override option labels
  • 4036695 Preserve prompt override draft while collapsed
  • 282fcfb Tighten selfie prompt override test fake

📊 Changes

6 files changed (+588 additions, -16 deletions)

View changed files

📝 packages/client/src/components/panels/SettingsPanel.tsx (+3 -0)
➕ packages/client/src/components/panels/settings/PromptOverridesEditor.tsx (+379 -0)
➕ packages/client/src/hooks/use-prompt-overrides.ts (+98 -0)
📝 packages/server/src/routes/generate.routes.ts (+5 -16)
➕ packages/server/src/services/conversation/selfie-prompt.ts (+28 -0)
➕ packages/server/test/conversation-selfie-prompt.test.ts (+75 -0)

📄 Description

Linked issue

Closes #1075

Why this change

  • Registered prompt overrides already have server support, but users had no app UI for editing or resetting them. This gives power users a discoverable editor without requiring DevTools or direct API calls.

What changed

  • Added React Query hooks for listing prompt override keys, loading one override, loading its default, saving, and resetting.
  • Added an Advanced settings Prompt Overrides editor for registered keys such as conversation.selfie.
  • Shows allowed ${variable} tokens and inserts them into the template editor.
  • Converts example-rendered defaults back into editable token templates where possible before showing them in the editor.
  • Supports enable/disable for a saved override and Reset to Default by deleting the saved override row.
  • Moved conversation selfie prompt resolution into a small server helper so it can be tested without starting a real image generation.
  • Added a focused server test that fakes prompt override storage and the prompt-builder response, then captures the system prompt that would be sent for selfie prompt-building.
  • Moved Prompt Overrides below Updates and made it a collapsed drawer by default.

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

Manual verification notes

  • Ran pnpm --filter @marinara-engine/client lint.
  • Ran pnpm build:client.
  • Ran pnpm --filter @marinara-engine/server lint.
  • Ran pnpm build:server (completed with the existing Node DEP0190 warning from the build command).
  • Ran pnpm --filter @marinara-engine/server exec tsx --test test/conversation-selfie-prompt.test.ts.
  • Opened the local app with an existing server on port 7860 and a Vite client on port 5173.
  • Opened Settings > Advanced and verified the Prompt Overrides section renders.
  • Verified Updates appears above the collapsed Prompt Overrides drawer.
  • Verified Prompt Overrides starts collapsed (aria-expanded="false") and expands to show the registered prompt editor.
  • Verified an unsaved editor draft survives collapsing and reopening the Prompt Overrides drawer.
  • Verified conversation.selfie is selected by default when available.
  • Verified the default editor text contains ${appearance}, ${charName}, and ${selfieTagsBlock} tokens rather than only sample rendered values.
  • Clicked a variable token and verified the editor becomes dirty, the textarea remains focused, and Save/Reset become enabled.
  • Clicked Reset to Default while no override was saved and verified the draft returns to default and Save/Reset become disabled again.
  • Verified the focused server test renders a registered conversation.selfie override into the selfie prompt-builder system message and returns empty fake content, so no image-generation request is needed.
  • Did not press Save during browser smoke, to avoid changing local prompt override data.

Docs and release impact

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

UI evidence (if applicable)

Summary by CodeRabbit

  • New Features
    • Added a prompt overrides editor in Advanced Settings, allowing users to customize and manage prompt templates.
    • Users can view, edit, save, and reset custom prompts with real-time character count feedback and enable/disable toggling.
    • Added support for inserting variable tokens and persisting prompt customizations with confirmation dialogs for destructive actions.

Review Change Stack


🔄 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/1089 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/22/2026 **Status:** ✅ Merged **Merged:** 5/22/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `staging` ← **Head:** `feature/issue-1075-prompt-overrides` --- ### 📝 Commits (6) - [`48d88a6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/48d88a69d0283c5e42d55bb43c792bfc078a254e) Add prompt override editor - [`7e63ebf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7e63ebf59125def6e71eb0fc91ab9595897ad750) Test conversation selfie prompt override resolution - [`d4e4e2e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d4e4e2e1c1c2b0a39cfc63fdfc10d8087bb67ccc) Collapse prompt overrides settings - [`e1a0afd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e1a0afd0faa93894b174f5c99f117032eb50998d) Simplify prompt override option labels - [`4036695`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4036695d02d012de2cffb18fba8490c342e47336) Preserve prompt override draft while collapsed - [`282fcfb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/282fcfb7cf55fbe2442e0f9d6f3870fbd121ac0c) Tighten selfie prompt override test fake ### 📊 Changes **6 files changed** (+588 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+3 -0) ➕ `packages/client/src/components/panels/settings/PromptOverridesEditor.tsx` (+379 -0) ➕ `packages/client/src/hooks/use-prompt-overrides.ts` (+98 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+5 -16) ➕ `packages/server/src/services/conversation/selfie-prompt.ts` (+28 -0) ➕ `packages/server/test/conversation-selfie-prompt.test.ts` (+75 -0) </details> ### 📄 Description <!-- 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 #1075 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Registered prompt overrides already have server support, but users had no app UI for editing or resetting them. This gives power users a discoverable editor without requiring DevTools or direct API calls. ## What changed <!-- List the key changes in this PR --> - Added React Query hooks for listing prompt override keys, loading one override, loading its default, saving, and resetting. - Added an Advanced settings Prompt Overrides editor for registered keys such as `conversation.selfie`. - Shows allowed `${variable}` tokens and inserts them into the template editor. - Converts example-rendered defaults back into editable token templates where possible before showing them in the editor. - Supports enable/disable for a saved override and Reset to Default by deleting the saved override row. - Moved conversation selfie prompt resolution into a small server helper so it can be tested without starting a real image generation. - Added a focused server test that fakes prompt override storage and the prompt-builder response, then captures the system prompt that would be sent for selfie prompt-building. - Moved Prompt Overrides below Updates and made it a collapsed drawer by default. ## 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) - [x] 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. --> - Ran `pnpm --filter @marinara-engine/client lint`. - Ran `pnpm build:client`. - Ran `pnpm --filter @marinara-engine/server lint`. - Ran `pnpm build:server` (completed with the existing Node DEP0190 warning from the build command). - Ran `pnpm --filter @marinara-engine/server exec tsx --test test/conversation-selfie-prompt.test.ts`. - Opened the local app with an existing server on port 7860 and a Vite client on port 5173. - Opened Settings > Advanced and verified the Prompt Overrides section renders. - Verified Updates appears above the collapsed Prompt Overrides drawer. - Verified Prompt Overrides starts collapsed (`aria-expanded="false"`) and expands to show the registered prompt editor. - Verified an unsaved editor draft survives collapsing and reopening the Prompt Overrides drawer. - Verified `conversation.selfie` is selected by default when available. - Verified the default editor text contains `${appearance}`, `${charName}`, and `${selfieTagsBlock}` tokens rather than only sample rendered values. - Clicked a variable token and verified the editor becomes dirty, the textarea remains focused, and Save/Reset become enabled. - Clicked Reset to Default while no override was saved and verified the draft returns to default and Save/Reset become disabled again. - Verified the focused server test renders a registered `conversation.selfie` override into the selfie prompt-builder system message and returns empty fake content, so no image-generation request is needed. - Did not press Save during browser smoke, to avoid changing local prompt override data. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] 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 --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a prompt overrides editor in Advanced Settings, allowing users to customize and manage prompt templates. * Users can view, edit, save, and reset custom prompts with real-time character count feedback and enable/disable toggling. * Added support for inserting variable tokens and persisting prompt customizations with confirmation dialogs for destructive actions. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1089?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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-22 04:11:42 +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#4917
No description provided.