[PR #3414] [MERGED] Improve NovelAI storyboard prompts and generation reliability #5925

Closed
opened 2026-10-23 04:05:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: agent/fix-storyboard-nai-prompts-3413


📝 Commits (5)

  • 588eb08 fix(storyboards): preserve direct prompts and serialize NovelAI
  • 9745c8b feat(storyboards): update default generation settings
  • 1d05c5e feat(novelai): add native storyboard character prompts
  • 3fc9874 feat(storyboards): add NovelAI controls and presets
  • 0892ca5 Apply CodeRabbit storyboard review suggestions

📊 Changes

20 files changed (+555 additions, -79 deletions)

View changed files

📝 docs/IMAGE_GENERATION.md (+10 -0)
📝 docs/SCENE_VIDEO_GENERATION.md (+4 -4)
📝 docs/STORYBOARD_ENGINE_GUIDE.md (+4 -3)
📝 docs/TROUBLESHOOTING.md (+3 -2)
📝 packages/client/src/components/chat/AgentAddSetupFields.tsx (+12 -5)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+62 -29)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+2 -0)
📝 packages/client/src/components/chat/HomeFaq.tsx (+1 -1)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+4 -2)
📝 packages/server/src/routes/game.routes.ts (+194 -16)
📝 packages/server/src/services/agents/agent-executor.ts (+3 -3)
📝 packages/server/src/services/agents/default-prompt-migration.ts (+12 -0)
📝 packages/server/src/services/game/game-asset-generation.ts (+27 -3)
📝 packages/server/src/services/image/image-generation.ts (+86 -4)
📝 packages/shared/src/constants/game-storyboard-prompts.ts (+31 -5)
📝 packages/shared/src/features/agents/illustrator/manifest.ts (+1 -0)
📝 packages/shared/src/types/agent.ts (+15 -2)
📝 packages/shared/src/types/chat.ts (+4 -0)
📝 packages/shared/src/types/sidecar.ts (+14 -0)
📝 scripts/regressions/prompt.regression.ts (+66 -0)

📄 Description

Linked issue

Closes #3413

Why this change

  • NovelAI V4/V4.5 supports native per-character captions, negative captions, and positions, but Game Mode storyboards previously flattened every subject into one shared prompt. In crowded scenes, identities, actions, and traits could bleed between characters or disappear after prompt shaping.
  • Users need to compare the native Add Character path with the legacy combined prompt on a per-game basis because different custom prompts and scenes can favor different behavior.
  • Custom Storyboard Illustrator output can already be a provider-ready tag list, so NovelAI users need a built-in compact tagged preset and a predictable direct-prompt path that preserves those tags.
  • NovelAI locks concurrent generations, while storyboard frames previously used the normal parallel worker pool and could fail with HTTP 429 Concurrent generation is locked.
  • The generic Illustrator default should favor reusable backgrounds, while explicit Illustration, Selfie, comic, and manga selections must continue to work.

What changed

  • Add structured characterPrompts to storyboard illustration requests and the Storyboard Illustrator contract for official NovelAI V4/V4.5 generations.
  • Ask the illustrator to keep shared composition, camera, setting, and subject counts in the base prompt while describing each visible subject separately with identity, appearance, clothing, expression, pose, scene role, negative tags, and normalized position coordinates.
  • Send up to six native NovelAI char_captions in both v4_prompt and v4_negative_prompt, with use_coords and deterministic fallback positions.
  • Add a per-chat Use NovelAI Character Prompts toggle. It defaults on for official NovelAI V4/V4.5 storyboards; turning it off skips structured planner instructions and native captions so the combined legacy prompt is used.
  • Sanitize, deduplicate, clamp, and reconcile character prompts against the final visible-character list. Multi-character fallback frames can synthesize a minimal character prompt and optionally include card appearance text.
  • Limit the native path to the official NovelAI endpoint and native V4/V4.5 models. Proxies, older NovelAI models, and other providers retain the existing combined-prompt behavior.
  • Keep avatar/image references independently governed by Send Avatar References. Native character captions do not silently enable reference images.
  • Add the built-in NovelAI Keyframes storyboard preset with compact ASCII Danbooru tags and no prose wrapper fields inside imagePrompt.
  • Add Add NovelAI Copy to Edit Storyboard Presets so the built-in can be copied and edited like the other read-only presets. Custom copies remain chat-local.
  • Add a per-chat Use Storyboard Prompt Directly option. It is off by default; enabling it sends the illustrator's imagePrompt directly, bypasses the Game Scene Illustration wrapper and override, and prevents source-tag distillation while retaining global style prefixes.
  • Preserve full storyboard prompts in wrapped mode as well, so disabling the direct toggle no longer reintroduces tag distillation.
  • Serialize NovelAI storyboard frame generation while preserving the configured worker limit for providers that allow concurrency.
  • Default automatic storyboard illustrations to on, keyframes per turn to 3, and storyboard animation duration to 6 seconds. Automatic animations and direct prompting remain off by default.
  • Make Background the generic Illustrator agent's default prompt mode. Explicit per-chat selections still win, and Game Mode image instructions now respect the selected Background, Illustration, Selfie, comic, or manga mode.
  • Document the native multi-character behavior, provider limitations, debug output, defaults, preset workflow, and troubleshooting guidance.

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

Automated evidence produced while preparing this draft:

  • Final pnpm check completed successfully on the exact committed implementation (Impeccable context, shared/server/client lint, and production builds).
  • pnpm regression:prompt completed successfully, including deterministic checks for the NovelAI built-in, editor copy action, toggle wiring, and Background default with explicit-mode override.
  • Focused shared, server, and client lint commands completed successfully.
  • The final production client bundle contains NovelAI Keyframes, Use NovelAI Character Prompts, and Add NovelAI Copy.
  • A built-server payload proof produced separate positive and negative captions for 2B and Mitsuri with distinct left/right coordinates.
  • A bounds/provider proof confirmed six V4.5 captions maximum, zero V3 captions, official-endpoint support, and proxy-endpoint rejection.
  • git diff --cached --check completed without whitespace errors before commit.

Manual verification notes

The following remains a human/provider verification to-do list:

  • Rebuild/restart Marinara, open Chat Settings -> Agents -> Storyboards, and verify Use NovelAI Character Prompts, NovelAI Keyframes, and Add NovelAI Copy are visible and usable on desktop/mobile and both themes.
  • Generate a multi-character Game Mode storyboard using the official NovelAI V4.5 backend and confirm the debug log contains nativeCharacterPrompts plus separate character captions.
  • Compare two- and four-character frames for identity, clothing, action, and position separation with native character prompts on, then compare with the legacy combined prompt off-path.
  • Verify no reference images are attached with Send Avatar References off, then verify they are attached when it is on.
  • Verify the direct-prompt toggle bypasses the Game Scene Illustration wrapper and that wrapped mode still preserves the complete scene prompt.
  • Verify a multi-frame NovelAI storyboard completes serially without HTTP 429 concurrency failures.
  • Verify a proxy or non-V4 NovelAI configuration follows the legacy combined-prompt path.
  • Verify a chat without an explicit Illustrator prompt mode shows Background, while explicitly selecting Illustration or another mode persists and is respected.

pnpm smoke:ui was attempted twice, including outside the restricted filesystem shell. Playwright never reached UI assertions because its isolated test server did not become ready at http://127.0.0.1:7971/api/health within 180 seconds. No live NovelAI generation was performed during automated validation because it would use the configured external provider account.

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)

Updated docs/IMAGE_GENERATION.md, docs/SCENE_VIDEO_GENERATION.md, docs/STORYBOARD_ENGINE_GUIDE.md, and docs/TROUBLESHOOTING.md. No release metadata or version-bearing files changed.

UI evidence (if applicable)

No screenshot is attached. The Playwright smoke server did not start, and manual UI verification remains listed above.

Summary by CodeRabbit

  • New Features

    • Added structured multi-character storyboard prompts for supported NovelAI models, including character-specific descriptions, negatives, and positioning.
    • Added “NovelAI Keyframes,” “Use Storyboard Prompt Directly,” and “Use NovelAI Character Prompts” options.
    • Illustrator now defaults to Background mode, with additional selectable styles.
    • Storyboard illustrations are enabled by default with visual generation.
  • Improvements

    • Storyboards now default to three keyframes and six-second animations.
    • Improved provider-aware generation behavior and prompt-template defaults.
  • Documentation

    • Expanded setup, usage, and troubleshooting guidance for storyboard generation and NovelAI options.

🔄 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/3414 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/10/2026 **Status:** ✅ Merged **Merged:** 7/10/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/fix-storyboard-nai-prompts-3413` --- ### 📝 Commits (5) - [`588eb08`](https://github.com/Pasta-Devs/Marinara-Engine/commit/588eb08c81221218715f36a2da995474c5c73ba3) fix(storyboards): preserve direct prompts and serialize NovelAI - [`9745c8b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9745c8b788388f7f92c5b1060cc42539cd149bd5) feat(storyboards): update default generation settings - [`1d05c5e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1d05c5ebd7ad67af2534beb8883f665285ebd347) feat(novelai): add native storyboard character prompts - [`3fc9874`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3fc987493602584fd1b54e211a97b498d34b9d19) feat(storyboards): add NovelAI controls and presets - [`0892ca5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0892ca57be65ee01f946d5f28046c61226d0c97f) Apply CodeRabbit storyboard review suggestions ### 📊 Changes **20 files changed** (+555 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `docs/IMAGE_GENERATION.md` (+10 -0) 📝 `docs/SCENE_VIDEO_GENERATION.md` (+4 -4) 📝 `docs/STORYBOARD_ENGINE_GUIDE.md` (+4 -3) 📝 `docs/TROUBLESHOOTING.md` (+3 -2) 📝 `packages/client/src/components/chat/AgentAddSetupFields.tsx` (+12 -5) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+62 -29) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+2 -0) 📝 `packages/client/src/components/chat/HomeFaq.tsx` (+1 -1) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+4 -2) 📝 `packages/server/src/routes/game.routes.ts` (+194 -16) 📝 `packages/server/src/services/agents/agent-executor.ts` (+3 -3) 📝 `packages/server/src/services/agents/default-prompt-migration.ts` (+12 -0) 📝 `packages/server/src/services/game/game-asset-generation.ts` (+27 -3) 📝 `packages/server/src/services/image/image-generation.ts` (+86 -4) 📝 `packages/shared/src/constants/game-storyboard-prompts.ts` (+31 -5) 📝 `packages/shared/src/features/agents/illustrator/manifest.ts` (+1 -0) 📝 `packages/shared/src/types/agent.ts` (+15 -2) 📝 `packages/shared/src/types/chat.ts` (+4 -0) 📝 `packages/shared/src/types/sidecar.ts` (+14 -0) 📝 `scripts/regressions/prompt.regression.ts` (+66 -0) </details> ### 📄 Description <!-- Target branch: `staging`. --> ## Linked issue Closes #3413 ## Why this change - NovelAI V4/V4.5 supports native per-character captions, negative captions, and positions, but Game Mode storyboards previously flattened every subject into one shared prompt. In crowded scenes, identities, actions, and traits could bleed between characters or disappear after prompt shaping. - Users need to compare the native Add Character path with the legacy combined prompt on a per-game basis because different custom prompts and scenes can favor different behavior. - Custom Storyboard Illustrator output can already be a provider-ready tag list, so NovelAI users need a built-in compact tagged preset and a predictable direct-prompt path that preserves those tags. - NovelAI locks concurrent generations, while storyboard frames previously used the normal parallel worker pool and could fail with HTTP 429 `Concurrent generation is locked`. - The generic Illustrator default should favor reusable backgrounds, while explicit Illustration, Selfie, comic, and manga selections must continue to work. ## What changed - Add structured `characterPrompts` to storyboard illustration requests and the Storyboard Illustrator contract for official NovelAI V4/V4.5 generations. - Ask the illustrator to keep shared composition, camera, setting, and subject counts in the base prompt while describing each visible subject separately with identity, appearance, clothing, expression, pose, scene role, negative tags, and normalized position coordinates. - Send up to six native NovelAI `char_captions` in both `v4_prompt` and `v4_negative_prompt`, with `use_coords` and deterministic fallback positions. - Add a per-chat **Use NovelAI Character Prompts** toggle. It defaults on for official NovelAI V4/V4.5 storyboards; turning it off skips structured planner instructions and native captions so the combined legacy prompt is used. - Sanitize, deduplicate, clamp, and reconcile character prompts against the final visible-character list. Multi-character fallback frames can synthesize a minimal character prompt and optionally include card appearance text. - Limit the native path to the official NovelAI endpoint and native V4/V4.5 models. Proxies, older NovelAI models, and other providers retain the existing combined-prompt behavior. - Keep avatar/image references independently governed by **Send Avatar References**. Native character captions do not silently enable reference images. - Add the built-in **NovelAI Keyframes** storyboard preset with compact ASCII Danbooru tags and no prose wrapper fields inside `imagePrompt`. - Add **Add NovelAI Copy** to **Edit Storyboard Presets** so the built-in can be copied and edited like the other read-only presets. Custom copies remain chat-local. - Add a per-chat **Use Storyboard Prompt Directly** option. It is off by default; enabling it sends the illustrator's `imagePrompt` directly, bypasses the Game Scene Illustration wrapper and override, and prevents source-tag distillation while retaining global style prefixes. - Preserve full storyboard prompts in wrapped mode as well, so disabling the direct toggle no longer reintroduces tag distillation. - Serialize NovelAI storyboard frame generation while preserving the configured worker limit for providers that allow concurrency. - Default automatic storyboard illustrations to on, keyframes per turn to 3, and storyboard animation duration to 6 seconds. Automatic animations and direct prompting remain off by default. - Make **Background** the generic Illustrator agent's default prompt mode. Explicit per-chat selections still win, and Game Mode image instructions now respect the selected Background, Illustration, Selfie, comic, or manga mode. - Document the native multi-character behavior, provider limitations, debug output, defaults, preset workflow, and troubleshooting guidance. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] 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` Automated evidence produced while preparing this draft: - Final `pnpm check` completed successfully on the exact committed implementation (Impeccable context, shared/server/client lint, and production builds). - `pnpm regression:prompt` completed successfully, including deterministic checks for the NovelAI built-in, editor copy action, toggle wiring, and Background default with explicit-mode override. - Focused shared, server, and client lint commands completed successfully. - The final production client bundle contains **NovelAI Keyframes**, **Use NovelAI Character Prompts**, and **Add NovelAI Copy**. - A built-server payload proof produced separate positive and negative captions for 2B and Mitsuri with distinct left/right coordinates. - A bounds/provider proof confirmed six V4.5 captions maximum, zero V3 captions, official-endpoint support, and proxy-endpoint rejection. - `git diff --cached --check` completed without whitespace errors before commit. ### Manual verification notes The following remains a human/provider verification to-do list: - Rebuild/restart Marinara, open **Chat Settings -> Agents -> Storyboards**, and verify **Use NovelAI Character Prompts**, **NovelAI Keyframes**, and **Add NovelAI Copy** are visible and usable on desktop/mobile and both themes. - Generate a multi-character Game Mode storyboard using the official NovelAI V4.5 backend and confirm the debug log contains `nativeCharacterPrompts` plus separate character captions. - Compare two- and four-character frames for identity, clothing, action, and position separation with native character prompts on, then compare with the legacy combined prompt off-path. - Verify no reference images are attached with **Send Avatar References** off, then verify they are attached when it is on. - Verify the direct-prompt toggle bypasses the Game Scene Illustration wrapper and that wrapped mode still preserves the complete scene prompt. - Verify a multi-frame NovelAI storyboard completes serially without HTTP 429 concurrency failures. - Verify a proxy or non-V4 NovelAI configuration follows the legacy combined-prompt path. - Verify a chat without an explicit Illustrator prompt mode shows Background, while explicitly selecting Illustration or another mode persists and is respected. `pnpm smoke:ui` was attempted twice, including outside the restricted filesystem shell. Playwright never reached UI assertions because its isolated test server did not become ready at `http://127.0.0.1:7971/api/health` within 180 seconds. No live NovelAI generation was performed during automated validation because it would use the configured external provider account. ## 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) Updated `docs/IMAGE_GENERATION.md`, `docs/SCENE_VIDEO_GENERATION.md`, `docs/STORYBOARD_ENGINE_GUIDE.md`, and `docs/TROUBLESHOOTING.md`. No release metadata or version-bearing files changed. ## UI evidence (if applicable) No screenshot is attached. The Playwright smoke server did not start, and manual UI verification remains listed above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added structured multi-character storyboard prompts for supported NovelAI models, including character-specific descriptions, negatives, and positioning. * Added “NovelAI Keyframes,” “Use Storyboard Prompt Directly,” and “Use NovelAI Character Prompts” options. * Illustrator now defaults to Background mode, with additional selectable styles. * Storyboard illustrations are enabled by default with visual generation. * **Improvements** * Storyboards now default to three keyframes and six-second animations. * Improved provider-aware generation behavior and prompt-template defaults. * **Documentation** * Expanded setup, usage, and troubleshooting guidance for storyboard generation and NovelAI options. <!-- 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-23 04:05:12 +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#5925
No description provided.