[PR #2967] [MERGED] [codex] Fix NovelAI V4.5 precise reference images #5781

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

📋 Pull Request Information

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

Base: staging ← Head: fix/novelai-precise-reference-images


📝 Commits (3)

  • 21d035e Fix NovelAI V4.5 precise reference images
  • 24c2272 Address NovelAI reference review feedback
  • ebc23c2 Merge branch 'staging' into fix/novelai-precise-reference-images

📊 Changes

5 files changed (+183 additions, -21 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+17 -4)
📝 packages/server/src/routes/generate/illustrator-references.ts (+14 -1)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+15 -4)
📝 packages/server/src/services/image/image-generation.ts (+135 -10)
📝 packages/server/src/services/mari-db/mari-images.service.ts (+2 -2)

📄 Description

## Linked issue

Closes #2968

Why this change

  • NovelAI V4.5 precise reference generation fails from Marinara when avatar/reference images are enabled, because the request was using the vibe-transfer reference fields instead of NovelAI's director reference fields.
  • Users enabling avatar references for Illustrator/selfie generation hit NovelAI 500 errors instead of getting an image.

What changed

  • Send NovelAI V4.5 precise references through director_reference_* parameters and multipart director_reference_images_cached uploads.
  • Preprocess reference images to NovelAI-supported precise-reference canvas sizes before upload.
  • Prefer character avatars before sprite fallback for Illustrator reference selection.
  • Suppress the extra reference-image prompt sentence for NovelAI, since the image reference is sent as a separate precise-reference input.
  • Limit Marinara's NovelAI reference-image capability marker to V4.5 models.

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 a live low-step NovelAI V4.5 generation through the patched generateImage path with the latest character avatar as a reference image; NovelAI returned a PNG.
  • Ran pnpm.cmd --filter @marinara-engine/server lint.
  • Ran pnpm.cmd --filter @marinara-engine/server build.
  • Ran pnpm.cmd check.

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 NovelAI request handling change.

Summary by CodeRabbit

  • New Features

    • Improved support for NovelAI image generation with precise reference images, including better handling of reference image uploads and responses.
    • Updated image prompt generation to use avatar references first in relevant workflows.
  • Bug Fixes

    • Prevented reference prompt lines from being added in cases where they can cause issues with NovelAI-compatible connections.
    • Tightened model requirements so precise reference editing only appears when supported, reducing failed requests.

🔄 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/2967 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 6/29/2026 **Status:** ✅ Merged **Merged:** 6/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/novelai-precise-reference-images` --- ### 📝 Commits (3) - [`21d035e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/21d035eebda913fc438f2d856492cefcadb4045b) Fix NovelAI V4.5 precise reference images - [`24c2272`](https://github.com/Pasta-Devs/Marinara-Engine/commit/24c22726566136146298b38abdabad158ac70954) Address NovelAI reference review feedback - [`ebc23c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ebc23c28586105d8de8e311e6f03e9defa27727c) Merge branch 'staging' into fix/novelai-precise-reference-images ### 📊 Changes **5 files changed** (+183 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+17 -4) 📝 `packages/server/src/routes/generate/illustrator-references.ts` (+14 -1) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+15 -4) 📝 `packages/server/src/services/image/image-generation.ts` (+135 -10) 📝 `packages/server/src/services/mari-db/mari-images.service.ts` (+2 -2) </details> ### 📄 Description ## Linked issue Closes #2968 ## Why this change - NovelAI V4.5 precise reference generation fails from Marinara when avatar/reference images are enabled, because the request was using the vibe-transfer reference fields instead of NovelAI's director reference fields. - Users enabling avatar references for Illustrator/selfie generation hit NovelAI 500 errors instead of getting an image. ## What changed - Send NovelAI V4.5 precise references through `director_reference_*` parameters and multipart `director_reference_images_cached` uploads. - Preprocess reference images to NovelAI-supported precise-reference canvas sizes before upload. - Prefer character avatars before sprite fallback for Illustrator reference selection. - Suppress the extra reference-image prompt sentence for NovelAI, since the image reference is sent as a separate precise-reference input. - Limit Marinara's NovelAI reference-image capability marker to V4.5 models. ## Validation - [x] `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 a live low-step NovelAI V4.5 generation through the patched `generateImage` path with the latest character avatar as a reference image; NovelAI returned a PNG. - Ran `pnpm.cmd --filter @marinara-engine/server lint`. - Ran `pnpm.cmd --filter @marinara-engine/server build`. - Ran `pnpm.cmd check`. ## 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 NovelAI request handling change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved support for NovelAI image generation with precise reference images, including better handling of reference image uploads and responses. * Updated image prompt generation to use avatar references first in relevant workflows. * **Bug Fixes** * Prevented reference prompt lines from being added in cases where they can cause issues with NovelAI-compatible connections. * Tightened model requirements so precise reference editing only appears when supported, reducing failed requests. <!-- 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:19:28 +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#5781
No description provided.