mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #1238] [CLOSED] feat(magic-rewrite): V1 — AI-assisted text rewriting for editors #4998
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#4998
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/1238
Author: @kevin-ho
Created: 5/26/2026
Status: ❌ Closed
Base:
staging← Head:feat/magic-rewrite-v1📝 Commits (3)
19411f3Fix mobile composer text input collapse (#1136)77a30faFix tracker aliases, avatars, HUD temps, and changelog (#1137)1a9b2ddfeat(magic-rewrite): V1 — instruction + diff rewrite for editors📊 Changes
15 files changed (+601 additions, -109 deletions)
View changed files
📝
CHANGELOG.md(+16 -0)📝
packages/client/src/components/chat/ConversationInput.tsx(+5 -5)📝
packages/client/src/components/chat/RoleplayHUD.tsx(+19 -37)📝
packages/client/src/components/lorebooks/LorebookFormFields.tsx(+78 -24)📝
packages/client/src/components/panels/SettingsPanel.tsx(+1 -1)📝
packages/client/src/components/panels/settings/TrackerCardColorSettings.tsx(+17 -11)📝
packages/client/src/components/ui/ExpandedTextarea.tsx(+84 -17)➕
packages/client/src/components/ui/MagicRewritePanel.tsx(+148 -0)📝
packages/client/src/features/tracker-panel/hooks/use-tracker-sprite-lookup.ts(+11 -6)📝
packages/client/src/features/tracker-panel/lib/tracker-metadata.ts(+31 -0)📝
packages/client/src/lib/character-display.ts(+40 -0)📝
packages/server/src/routes/generate.routes.ts(+8 -4)📝
packages/server/src/routes/generate/generate-route-utils.ts(+40 -4)📝
packages/server/src/routes/index.ts(+2 -0)➕
packages/server/src/routes/magic-rewrite.routes.ts(+101 -0)📄 Description
Linked issue
Closes #1183
Why this change
Writing and maintaining long-form text entries — character descriptions, persona definitions, lorebook entries — is tedious. Other RP platforms offer AI-assisted rewriting with natural language instructions ("add more detail about their childhood," "convert to XML format," "make this more token-efficient"). Currently Marinara has no built-in mechanism for this. A third-party extension exists as a proof of concept but requires users to manually enter API keys. This PR ships the feature natively, reusing Marinara's existing connection infrastructure.
What changed
packages/server/src/routes/magic-rewrite.routes.ts(new):POST /api/magic-rewrite/generate— acceptstextandinstruction, resolves an LLM connection through the existing default → default agent fallback chain, returns rewritten text. No new DB columns, no migrations.packages/client/src/components/ui/MagicRewritePanel.tsx(new): Instruction textarea, generate button, word-level LCS diff view (green additions, red deletions). Falls back to plain text for inputs over 3 000 words. IncludesHelpTooltipnoting agent connection usage.packages/client/src/components/ui/ExpandedTextarea.tsx(modified): Rewrite button in fullscreen editor header, Apply/Back controls. Escape key suppressed during rewrite mode.packages/client/src/components/lorebooks/LorebookFormFields.tsx(modified): Same rewrite integration in lorebook expanded content modal. Modal widened tomax-w-5xl.packages/server/src/routes/index.ts(modified): Registered magic-rewrite routes under/api/magic-rewrite.Intentionally omitted (follow-up PRs)
Per maintainer feedback on #1184, V1 is scoped to the core rewrite flow:
defaultForRewriteflag)Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Docs and release impact
UI evidence (if applicable)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.