[PR #888] [MERGED] Fix NovelAI Illustrator prompt handling #4821

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/888
Author: @cha1latte
Created: 5/15/2026
Status: ✅ Merged
Merged: 5/15/2026
Merged by: @cha1latte

Base: staging ← Head: fix/issue-852-novelai-illustrator


📝 Commits (2)

  • dcf47b3 Fix NovelAI illustrator prompt handling
  • 0e79e23 Tighten NovelAI V4 model matching

📊 Changes

2 files changed (+90 additions, -10 deletions)

View changed files

📝 packages/server/src/services/image/image-generation.ts (+44 -4)
📝 packages/server/test/image-generation-local.test.ts (+46 -6)

📄 Description

Linked issue

Closes #852

Why this change

  • The Illustrator agent can send LLM-authored prompts to NovelAI V4/V4.5 that contain unsupported Unicode characters, while the connection test only proves a simple ASCII prompt. That makes the connection test pass but the Illustrator path fail with an opaque NovelAI 500.

What changed

  • Normalize NovelAI V4/V4.5 prompt and negative prompt text before sending the native NovelAI request, converting common smart punctuation/diacritics and removing unsupported Unicode prompt characters.
  • Add an actionable NovelAI-specific hint to remaining V4/V4.5 provider 500 errors so the UI can explain the likely prompt constraints instead of only showing Internal Server Error.
  • Extend the local image-generation tests to cover sanitized V4 prompt payloads, unchanged V3 prompt behavior, and the new NovelAI V4 error 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

Manual verification notes

  • Codex reproduced the request-shape failure with a mocked native NovelAI endpoint: before the fix, a connection-test-like ASCII prompt passed while an Illustrator-like prompt with unsupported Unicode failed with NovelAI image generation failed (500).
  • Codex reran the same repro after the fix with output saved at scratch/issue-852-after-output.txt: connection-test-like prompt passed, Illustrator-like prompt passed, Unicode negative prompt passed, reference images still passed, and an unsupported-only V4 prompt failed locally with the new actionable error.
  • Codex manually exercised the two route call shapes against a local fake native NovelAI endpoint with output saved at scratch/issue-852-manual-like-output.txt: the Settings connection-test-shaped request passed, the Illustrator-shaped request passed, the submitted Illustrator prompt/negative prompt were ASCII-normalized, and one reference image was preserved in the NovelAI V4 payload.
  • Codex ran pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/image-generation-local.test.ts and all 6 tests passed.
  • Codex ran pnpm check and it passed.
  • Real provider/device verification was not available from this environment: no NovelAI API/account credential was present, and the reported Android/Termux setup was not available. Recommended human follow-up: generate one Illustrator image against a real NovelAI account/API key, ideally on Android/Termux.

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)

N/A - server-side image generation request handling only.


🔄 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/888 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/15/2026 **Status:** ✅ Merged **Merged:** 5/15/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-852-novelai-illustrator` --- ### 📝 Commits (2) - [`dcf47b3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dcf47b3f820b6b24522c13c232de8a2c7a1978c4) Fix NovelAI illustrator prompt handling - [`0e79e23`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0e79e23c137c7101c621382c186ffc08a9780f76) Tighten NovelAI V4 model matching ### 📊 Changes **2 files changed** (+90 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/image/image-generation.ts` (+44 -4) 📝 `packages/server/test/image-generation-local.test.ts` (+46 -6) </details> ### 📄 Description ## 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 #852 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - The Illustrator agent can send LLM-authored prompts to NovelAI V4/V4.5 that contain unsupported Unicode characters, while the connection test only proves a simple ASCII prompt. That makes the connection test pass but the Illustrator path fail with an opaque NovelAI 500. ## What changed <!-- List the key changes in this PR --> - Normalize NovelAI V4/V4.5 prompt and negative prompt text before sending the native NovelAI request, converting common smart punctuation/diacritics and removing unsupported Unicode prompt characters. - Add an actionable NovelAI-specific hint to remaining V4/V4.5 provider 500 errors so the UI can explain the likely prompt constraints instead of only showing `Internal Server Error`. - Extend the local image-generation tests to cover sanitized V4 prompt payloads, unchanged V3 prompt behavior, and the new NovelAI V4 error guidance. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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 <!-- 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. --> - Codex reproduced the request-shape failure with a mocked native NovelAI endpoint: before the fix, a connection-test-like ASCII prompt passed while an Illustrator-like prompt with unsupported Unicode failed with `NovelAI image generation failed (500)`. - Codex reran the same repro after the fix with output saved at `scratch/issue-852-after-output.txt`: connection-test-like prompt passed, Illustrator-like prompt passed, Unicode negative prompt passed, reference images still passed, and an unsupported-only V4 prompt failed locally with the new actionable error. - Codex manually exercised the two route call shapes against a local fake native NovelAI endpoint with output saved at `scratch/issue-852-manual-like-output.txt`: the Settings connection-test-shaped request passed, the Illustrator-shaped request passed, the submitted Illustrator prompt/negative prompt were ASCII-normalized, and one reference image was preserved in the NovelAI V4 payload. - Codex ran `pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/image-generation-local.test.ts` and all 6 tests passed. - Codex ran `pnpm check` and it passed. - Real provider/device verification was not available from this environment: no NovelAI API/account credential was present, and the reported Android/Termux setup was not available. Recommended human follow-up: generate one Illustrator image against a real NovelAI account/API key, ideally on Android/Termux. ## 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) N/A - server-side image generation request handling only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:10:56 +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#4821
No description provided.