[PR #1859] [MERGED] Fix ArliAI SD API image requests #5318

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1859
Author: @cha1latte
Created: 6/1/2026
Status: ✅ Merged
Merged: 6/1/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-1852-arliai-sd-api


📝 Commits (2)

  • e62b402 Fix ArliAI SD API image requests
  • 17c0dca Tighten ArliAI image source detection

📊 Changes

3 files changed (+205 additions, -13 deletions)

View changed files

📝 src-tauri/src/commands/storage/images.rs (+1 -0)
📝 src-tauri/src/commands/storage/images/providers.rs (+202 -11)
📝 src-tauri/src/commands/storage/llm.rs (+2 -2)

📄 Description

Linked issue

Closes #1852

Why this change

  • ArliAI's SD API uses the SDNext/AUTOMATIC1111-style /sdapi/v1/txt2img response shape, but Marinara's image-generation request path did not send bearer auth and only placed the selected model in override_settings.
  • Users could also paste the documented /sdapi/v1/txt2img endpoint as the base URL, which made related SD API paths append another /sdapi/v1/... segment.

What changed

  • Route ArliAI hosts and explicit /sdapi/v1 image URLs to the AUTOMATIC1111/SDNext image provider instead of the OpenAI-compatible image path.
  • Send configured API keys as Authorization: Bearer ... for AUTOMATIC1111/SDNext image generation requests.
  • Include the selected image model as top-level sd_model_checkpoint while preserving the existing override_settings.sd_model_checkpoint behavior for local WebUI compatibility.
  • Normalize SD API root, /sdapi/v1, and endpoint URLs before generation, connection checks, and model-list fetches.
  • Added focused Rust regression coverage with a local HTTP harness that captures the outgoing request and returns an images[] base64 response.

Refactor impact

Primary owner:

Rust storage / image provider transport

Impact areas reviewed:

  • AUTOMATIC1111 / SDNext image generation request construction
  • Image-generation connection checks
  • AUTOMATIC1111 / SDNext model-list fetching
  • Image provider inference for ArliAI and /sdapi/v1 URLs

Boundary notes:

  • The change stays inside src-tauri privileged provider/runtime code.
  • No React feature code, engine contracts, storage schema, dependency declarations, or prompt assembly paths changed.

Pressure points touched:

  • src-tauri/src/commands/storage/images/providers.rs
  • src-tauri/src/commands/storage/images.rs
  • src-tauri/src/commands/storage/llm.rs

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo test --manifest-path src-tauri/Cargo.toml automatic1111 passed.
  • cargo check --manifest-path src-tauri/Cargo.toml passed.
  • pnpm check passed.
  • node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed locally.
  • Focused before/after proof: before the fix, the request harness failed because the captured SD API request lacked Authorization: Bearer arliai-secret; after the fix, the harness verified /sdapi/v1/txt2img, bearer auth, top-level prompt, top-level sd_model_checkpoint, ArliAI/SD API source inference, and images[] base64 parsing.
  • Not manually tested against live ArliAI credentials; the core request/response contract was verified with a local harness instead.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix for an existing image-generation provider path; no new user-facing feature or discoverable workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

N/A; backend/provider transport fix with command proof above.

Summary by CodeRabbit

  • New Features

    • Added support for ArliAI endpoints as Automatic1111-compatible providers.
    • Improved recognition of Automatic1111-compatible endpoints.
  • Bug Fixes

    • Fixed model checkpoint handling in Automatic1111 requests.
    • Enhanced API URL normalization and endpoint detection for Stable Diffusion Web UI providers.

🔄 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/1859 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/1/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1852-arliai-sd-api` --- ### 📝 Commits (2) - [`e62b402`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e62b40274b32b26dfca7626f71d1e5c15cb56da5) Fix ArliAI SD API image requests - [`17c0dca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/17c0dca50ae3273425a6a3c524f5daac7f359095) Tighten ArliAI image source detection ### 📊 Changes **3 files changed** (+205 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/images.rs` (+1 -0) 📝 `src-tauri/src/commands/storage/images/providers.rs` (+202 -11) 📝 `src-tauri/src/commands/storage/llm.rs` (+2 -2) </details> ### 📄 Description ## Linked issue Closes #1852 ## Why this change - ArliAI's SD API uses the SDNext/AUTOMATIC1111-style `/sdapi/v1/txt2img` response shape, but Marinara's image-generation request path did not send bearer auth and only placed the selected model in `override_settings`. - Users could also paste the documented `/sdapi/v1/txt2img` endpoint as the base URL, which made related SD API paths append another `/sdapi/v1/...` segment. ## What changed - Route ArliAI hosts and explicit `/sdapi/v1` image URLs to the AUTOMATIC1111/SDNext image provider instead of the OpenAI-compatible image path. - Send configured API keys as `Authorization: Bearer ...` for AUTOMATIC1111/SDNext image generation requests. - Include the selected image model as top-level `sd_model_checkpoint` while preserving the existing `override_settings.sd_model_checkpoint` behavior for local WebUI compatibility. - Normalize SD API root, `/sdapi/v1`, and endpoint URLs before generation, connection checks, and model-list fetches. - Added focused Rust regression coverage with a local HTTP harness that captures the outgoing request and returns an `images[]` base64 response. ## Refactor impact Primary owner: Rust storage / image provider transport Impact areas reviewed: - AUTOMATIC1111 / SDNext image generation request construction - Image-generation connection checks - AUTOMATIC1111 / SDNext model-list fetching - Image provider inference for ArliAI and `/sdapi/v1` URLs Boundary notes: - The change stays inside `src-tauri` privileged provider/runtime code. - No React feature code, engine contracts, storage schema, dependency declarations, or prompt assembly paths changed. Pressure points touched: - `src-tauri/src/commands/storage/images/providers.rs` - `src-tauri/src/commands/storage/images.rs` - `src-tauri/src/commands/storage/llm.rs` ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo test --manifest-path src-tauri/Cargo.toml automatic1111` passed. - `cargo check --manifest-path src-tauri/Cargo.toml` passed. - `pnpm check` passed. - `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed locally. - Focused before/after proof: before the fix, the request harness failed because the captured SD API request lacked `Authorization: Bearer arliai-secret`; after the fix, the harness verified `/sdapi/v1/txt2img`, bearer auth, top-level `prompt`, top-level `sd_model_checkpoint`, ArliAI/SD API source inference, and `images[]` base64 parsing. - Not manually tested against live ArliAI credentials; the core request/response contract was verified with a local harness instead. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix for an existing image-generation provider path; no new user-facing feature or discoverable workflow. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence N/A; backend/provider transport fix with command proof above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for ArliAI endpoints as Automatic1111-compatible providers. * Improved recognition of Automatic1111-compatible endpoints. * **Bug Fixes** * Fixed model checkpoint handling in Automatic1111 requests. * Enhanced API URL normalization and endpoint detection for Stable Diffusion Web UI providers. <!-- 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:15: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#5318
No description provided.