[PR #5345] [MERGED] Filtered ModelList for NovelAI Image, disabled the fetch button, added Nai Diffusion 5 full/curated to Image_Gen_Model: Known Model[], provided barebones nai v5 support #6735

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5345
Author: @ylli-selmani
Created: 8/21/2026
Status: ✅ Merged
Merged: 8/21/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/novelAI-ModelList-and-v5Support


📝 Commits (7)

  • 8994143 enabled model List for novelAi image, disabled fetch button (doesn't work for nAI) and provided barebones diffusion v5 support (v4.5 is still the fallback... everywhere, but i didn't want to touch all that on my own)
  • 3e902a4 added to changelog
  • 2b445af ran prettier on connectioneditor.tsx (thought i did that already. oops)
  • c115820 addressed coderabbit suggestions and checked (model list refreshes on switch between models in both directions. didn't check error though. i'll just BELIEVE)
  • 148514d addressed various issues, removed precise reference compatibility, added v5 error message, included asci support, ran.. prettier.
  • 332ad83 code rabbit suggestions (make café accents survive, and fetchScopeRef something something edge case.)
  • 6062437 hopefully last coderabbit review

📊 Changes

5 files changed (+71 additions, -43 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 packages/client/src/components/connections/ConnectionEditor.tsx (+42 -32)
📝 packages/server/src/services/game/game-asset-generation.ts (+3 -1)
📝 packages/server/src/services/image/image-generation.ts (+19 -9)
📝 packages/shared/src/constants/model-lists.ts (+4 -1)

📄 Description

Name: Nai Diffusion v5 support (no reference images YET), Filtered Dropdown ModelList for NovelAI Image, disabled the fetch button, added Nai Diffusion 5 full/curated to Image_Gen_Model: Known Model[] (the model list),

Disclaimer

This was fully vibe-coded by Mari using GLM 5.2 Thinking, and my very human suggestions and testing. However, since the code changes are very minor, i think it's okay?

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #5344 - NovelAI's Model List Dropdown and Fetch button
Closes #5343 - NovelAI Diffusion v5 support + added both new models to the Known Model array.

Why this change

  • NovelAI released Diffusion v5 (nai-diffusion-5-full, nai-diffusion-5-curated). Marinara Engine's hardcoded regex did not recognize v5 model IDs as V4+ models, causing a 500 error on image generation because the request was sent using the legacy pre-V4 parameter format instead of params_version: 3 with v4_prompt / v4_negative_prompt structures.
  • The new v5 models were not yet added to IMAGE_GEN_MODELS in model-lists.ts.
  • The NovelAI image connection model dropdown showed the entire app-wide IMAGE_GEN_MODELS catalog (all providers) instead of only NovelAI-relevant models. The "Fetch from API" button hit the base URL with no path appended (empty modelsEndpoint), got a plain text OK body, and failed JSON parsing with "Failed to fetch models: OK".
  • NovelAI's https://image.novelai.net/oa/v1/models returns text models (xialong-v1, glm-4-6), not image models, so it cannot be used to populate the image model list.

What changed

  • Extended the isNovelAiV4Model regex in packages/server/src/services/image/image-generation.ts to match nai-diffusion-5-full and nai-diffusion-5-curated so v5 models are routed through the V4+ code path.
  • Applied the same regex fix to the duplicated pattern in packages/server/src/services/game-asset-generation.ts.
  • Added nai-diffusion-5-full and nai-diffusion-5-curated entries to IMAGE_GEN_MODELS in packages/shared/src/constants/model-lists.ts with display names "NAI Diffusion 5 Full" and "NAI Diffusion 5 Curated".
  • Added isNovelAiV5Model predicate to image-generation.ts to identify V5 model IDs.
  • Added allowUnicode parameter to sanitizeNovelAiV4Prompt so V5 prompts skip the ASCII strip and preserve Japanese/Chinese/Cyrillic text.
  • Split NOVELAI_V4_PROMPT_HINT into separate V4/V4.5 and V5 hints with accurate token limits (V4.5: ~505 tokens, V5 Curated: 703, V5 Full: 1471) and correct Unicode guidance per model.
  • Made the empty-prompt and HTTP error messages model-aware, showing the correct hint based on the selected model.
  • Filtered the providerModels memo in packages/client/src/components/connections/ConnectionEditor.tsx to return only nai- prefixed models when the image source is NovelAI.
  • Added selectedImageService to the providerModels memo dependency array so the dropdown recomputes when switching image services.
  • Wrapped the "Fetch from API" button block in ConnectionEditor.tsx with a guard that hides it for NovelAI image connections, since the endpoint returns text models and the fetch is not useful.
  • Added a fetchScopeRef stale-response guard so in-flight fetch results from a previous image service are dropped when the user switches services mid-fetch.

Notes

  • NovelAI Diffusion v5 does not support Precise Reference yet. The isNovelAiPreciseReferenceModel check remains V4.5-only, so attempting precise reference with a V5 model correctly returns the existing error message: "NovelAI precise reference images require a V4.5 model such as nai-diffusion-4-5-full."

Validation

  • pnpm check passes locally - My pnpm check fails on prettier for 1200+ regardless of my branch, even on staging. since i don't know the fix yet, i can't fully check this. However, this PR fails on the exact same spot as staging, so there's that.
  • 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

  • Created a NovelAI image generation connection, confirmed the model dropdown shows only nai- prefixed models (NAI Diffusion 3, 4.5 Full, 5 Full, 5 Curated). Models from other providers (grok, stability, etc.) no longer appear.
  • Confirmed the "Fetch from API" button is no longer visible for NovelAI connections.
  • Tested nai-diffusion-5-full using the "Test Image" button in connection settings. Generation succeeded with no 500 error.
  • Tested nai-diffusion-5-full using the Illustrate button inside a roleplay chat. Generation succeeded.
  • Light/dark mode and mobile viewport testing skipped: the changes are backend regex patterns and a dropdown filter condition, with no new UI components or styling.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Dropdown Menu

Before
novelai model list old
After
novelai model list

Nai-diffusion-5 support

Before
novel ai v5 missing support
After
nai v5 support
illustrator prove

Summary by CodeRabbit

New Features

  • Added support for NovelAI Diffusion 5, including Curated and Full models.
  • Updated image generation and character prompt workflows for Diffusion 5.
  • Added the latest NovelAI models to the available model list.

Improvements

  • Improved Diffusion 5 prompt handling, including Unicode support and validation guidance.
  • NovelAI connections now show only compatible local models.
  • Hid unsupported model-fetch controls and cleared outdated model data when changing image services.
  • Improved model ordering to make newer NovelAI versions easier to find.

🔄 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/5345 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 8/21/2026 **Status:** ✅ Merged **Merged:** 8/21/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/novelAI-ModelList-and-v5Support` --- ### 📝 Commits (7) - [`8994143`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8994143a717f069ee929b4b89542124651b04be9) enabled model List for novelAi image, disabled fetch button (doesn't work for nAI) and provided barebones diffusion v5 support (v4.5 is still the fallback... everywhere, but i didn't want to touch all that on my own) - [`3e902a4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3e902a433e89d01ee06ca0a44ec271a3ff98a921) added to changelog - [`2b445af`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2b445af01583ceb12fe4df061980bd6987341e23) ran prettier on connectioneditor.tsx (thought i did that already. oops) - [`c115820`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c115820fb17deda7824588f442c15306e307ca31) addressed coderabbit suggestions and checked (model list refreshes on switch between models in both directions. didn't check error though. i'll just BELIEVE) - [`148514d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/148514da6836adba308905596f7f8ee93f38a588) addressed various issues, removed precise reference compatibility, added v5 error message, included asci support, ran.. prettier. - [`332ad83`](https://github.com/Pasta-Devs/Marinara-Engine/commit/332ad83fc292d81097e65abdddf08c87120a0e11) code rabbit suggestions (make café accents survive, and fetchScopeRef something something edge case.) - [`6062437`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6062437b044f6a37d5accc9445a550673b7fd015) hopefully last coderabbit review ### 📊 Changes **5 files changed** (+71 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `packages/client/src/components/connections/ConnectionEditor.tsx` (+42 -32) 📝 `packages/server/src/services/game/game-asset-generation.ts` (+3 -1) 📝 `packages/server/src/services/image/image-generation.ts` (+19 -9) 📝 `packages/shared/src/constants/model-lists.ts` (+4 -1) </details> ### 📄 Description Name: Nai Diffusion v5 support (no reference images YET), Filtered Dropdown ModelList for NovelAI Image, disabled the fetch button, added Nai Diffusion 5 full/curated to Image_Gen_Model: Known Model[] (the model list), ## Disclaimer This was fully vibe-coded by Mari using GLM 5.2 Thinking, and my very human suggestions and testing. However, since the code changes are very minor, i think it's okay? > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #5344 - NovelAI's Model List Dropdown and Fetch button Closes #5343 - NovelAI Diffusion v5 support + added both new models to the Known Model array. ## Why this change - NovelAI released Diffusion v5 (nai-diffusion-5-full, nai-diffusion-5-curated). Marinara Engine's hardcoded regex did not recognize v5 model IDs as V4+ models, causing a 500 error on image generation because the request was sent using the legacy pre-V4 parameter format instead of params_version: 3 with v4_prompt / v4_negative_prompt structures. - The new v5 models were not yet added to IMAGE_GEN_MODELS in model-lists.ts. - The NovelAI image connection model dropdown showed the entire app-wide IMAGE_GEN_MODELS catalog (all providers) instead of only NovelAI-relevant models. The "Fetch from API" button hit the base URL with no path appended (empty modelsEndpoint), got a plain text OK body, and failed JSON parsing with "Failed to fetch models: OK". - NovelAI's https://image.novelai.net/oa/v1/models returns text models (xialong-v1, glm-4-6), not image models, so it cannot be used to populate the image model list. ## What changed - Extended the isNovelAiV4Model regex in packages/server/src/services/image/image-generation.ts to match nai-diffusion-5-full and nai-diffusion-5-curated so v5 models are routed through the V4+ code path. - Applied the same regex fix to the duplicated pattern in packages/server/src/services/game-asset-generation.ts. - Added nai-diffusion-5-full and nai-diffusion-5-curated entries to IMAGE_GEN_MODELS in packages/shared/src/constants/model-lists.ts with display names "NAI Diffusion 5 Full" and "NAI Diffusion 5 Curated". - Added isNovelAiV5Model predicate to image-generation.ts to identify V5 model IDs. - Added allowUnicode parameter to sanitizeNovelAiV4Prompt so V5 prompts skip the ASCII strip and preserve Japanese/Chinese/Cyrillic text. - Split NOVELAI_V4_PROMPT_HINT into separate V4/V4.5 and V5 hints with accurate token limits (V4.5: ~505 tokens, V5 Curated: 703, V5 Full: 1471) and correct Unicode guidance per model. - Made the empty-prompt and HTTP error messages model-aware, showing the correct hint based on the selected model. - Filtered the providerModels memo in packages/client/src/components/connections/ConnectionEditor.tsx to return only nai- prefixed models when the image source is NovelAI. - Added selectedImageService to the providerModels memo dependency array so the dropdown recomputes when switching image services. - Wrapped the "Fetch from API" button block in ConnectionEditor.tsx with a guard that hides it for NovelAI image connections, since the endpoint returns text models and the fetch is not useful. - Added a fetchScopeRef stale-response guard so in-flight fetch results from a previous image service are dropped when the user switches services mid-fetch. ### Notes - NovelAI Diffusion v5 does not support Precise Reference yet. The isNovelAiPreciseReferenceModel check remains V4.5-only, so attempting precise reference with a V5 model correctly returns the existing error message: "NovelAI precise reference images require a V4.5 model such as nai-diffusion-4-5-full." ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - My pnpm check fails on prettier for 1200+ regardless of my branch, even on staging. since i don't know the fix yet, i can't fully check this. However, this PR fails on the exact same spot as staging, so there's that. - [ ] 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) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Created a NovelAI image generation connection, confirmed the model dropdown shows only nai- prefixed models (NAI Diffusion 3, 4.5 Full, 5 Full, 5 Curated). Models from other providers (grok, stability, etc.) no longer appear. - Confirmed the "Fetch from API" button is no longer visible for NovelAI connections. - Tested nai-diffusion-5-full using the "Test Image" button in connection settings. Generation succeeded with no 500 error. - Tested nai-diffusion-5-full using the Illustrate button inside a roleplay chat. Generation succeeded. - Light/dark mode and mobile viewport testing skipped: the changes are backend regex patterns and a dropdown filter condition, with no new UI components or styling. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) ### Dropdown Menu Before <img width="435" height="263" alt="novelai model list old" src="https://github.com/user-attachments/assets/6b993528-a79f-4414-85ae-17496b5c8a98" /> After <img width="435" height="263" alt="novelai model list" src="https://github.com/user-attachments/assets/d90e15a5-04da-4a69-a41b-d327405018be" /> ### Nai-diffusion-5 support Before <img width="435" height="435" alt="novel ai v5 missing support" src="https://github.com/user-attachments/assets/fa8e8cfc-0c42-4949-8dbc-4efefb2e45fd" /> After <img width="435" height="597" alt="nai v5 support" src="https://github.com/user-attachments/assets/65c619e0-992a-44d9-90ab-040476c3babf" /> <img width="468" height="597" alt="illustrator prove" src="https://github.com/user-attachments/assets/581e66ff-8e4f-47b7-9a5b-9864e176e886" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## New Features - Added support for NovelAI Diffusion 5, including Curated and Full models. - Updated image generation and character prompt workflows for Diffusion 5. - Added the latest NovelAI models to the available model list. ## Improvements - Improved Diffusion 5 prompt handling, including Unicode support and validation guidance. - NovelAI connections now show only compatible local models. - Hid unsupported model-fetch controls and cleared outdated model data when changing image services. - Improved model ordering to make newer NovelAI versions easier to find. <!-- 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:13:10 +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#6735
No description provided.