[PR #970] [MERGED] feat(image-gen): add Draw Things HTTP API support #4862

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

📋 Pull Request Information

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

Base: staging ← Head: feat/drawthings-support


📝 Commits (1)

  • 4639a2c feat(image-gen): add Draw Things HTTP API support

📊 Changes

5 files changed (+112 additions, -28 deletions)

View changed files

📝 README.md (+1 -1)
📝 docs/CONFIGURATION.md (+1 -1)
📝 docs/FAQ.md (+1 -1)
📝 packages/server/src/services/image/image-generation.ts (+87 -21)
📝 packages/shared/src/constants/image-generation-defaults.ts (+22 -4)

📄 Description

Linked issue

Closes #969

Why this change

  • Marinara already aliases the drawthings provider to the AUTOMATIC1111 dispatch case, but Draw Things' HTTP server diverges from A1111 enough that the path silently fails today: requests sending cfg_scale return HTTP 200 {"images": []} (full generation cycle, no image), filling the connection editor's Model field causes HTTP 422 because Draw Things rejects override_settings, and the sampler dropdown only overlaps on five names with Draw Things' actual sampler set. Out-of-the-box Draw Things connections look configured but generate nothing.
  • Local-network image generation on Apple Silicon Macs is meaningfully faster via Draw Things (Metal + Apple Neural Engine + CoreML) than the ComfyUI Python path. Fixing this unlocks a working backend for that audience without adding a new provider abstraction — it's all behavior changes inside the existing automatic1111 dispatch.

What changed

  • packages/server/src/services/image/image-generation.ts:
    • Passes the explicit serviceHint through to generateAutomatic1111 and branches on serviceHint === "drawthings".
    • Draw Things branch uses guidance_scale (not cfg_scale) and batch_count (not n_iter/batch_size); drops override_settings, scheduler, restore_faces which Draw Things 422s on.
    • Lazy-loads sharp (already a server dep, same load pattern as sprites.routes.ts) and resizes img2img init images to match request width/height exactly, since Draw Things does not auto-resize like A1111/Forge does. Falls back to the original image if sharp is unavailable.
    • Adds the missing import { logger } referenced at line 1430 — pre-existing bug that prevented the file from compiling.
  • packages/shared/src/constants/image-generation-defaults.ts:
    • Extends SD_WEBUI_SAMPLER_OPTIONS with 16 Draw Things-specific samplers (UniPC AYS, DPM++ SDE Substep/Trailing/AYS, TCD, TCD Trailing, LCM, PLMS, etc.) labeled (Draw Things) so AUTOMATIC1111/Forge users can avoid them.
  • README.md, docs/FAQ.md, docs/CONFIGURATION.md: adds Draw Things to the supported-image-providers list and to the SSRF-allowed local image backends section.
  • Existing AUTOMATIC1111 and Forge connections see zero behavior change — the new branch only activates when the explicit hint is drawthings.

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`

Only ticking `pnpm check` because it is a deterministic command result that this agent ran on the final commit. The manual-verification boxes (container, browser click-through, light/dark/mobile, CONTRIBUTING re-read) are intentionally left unchecked per the AI-Generated PR guidance — those are a to-do list for the human contributor and reviewer, not evidence that work is done. The work I actually exercised is described below as prose.

What I ran locally (prose, for reviewer reference)

Tested end-to-end on macOS / Apple M5 against Draw Things 1.20260430.0 driving the Anima 1.0 model (Qwen-Image architecture) on `127.0.0.1:7861`:

  1. Installed Draw Things via `brew install --cask draw-things` and enabled its HTTP API server.
  2. In Marinara: added an image-generation connection, provider Draw Things, base URL `http://127.0.0.1:7861`, no API key.
  3. Without the patch: the connection's "Test image" button returned no image (HTTP 200, empty `images` array); filling the Model field made every request 422 with `Unrecognized keys: ["override_settings"]`; the sampler dropdown effectively only had `Euler a` as a working option.
  4. With the patch:
    • Test image button returns a real PNG in ~30s.
    • Selectable samplers include the Draw Things-specific entries (`UniPC AYS`, etc.); switching between them is honored.
    • In-chat image generation works for both txt2img (default selfie path) and img2img (illustrator agent with a character avatar passed as `referenceImage` — confirmed the init image is resized server-side so Draw Things accepts it).
  5. Regression check: an existing AUTOMATIC1111 connection still routes through the unmodified branch and works as before (verified by sampling the request body before/after — the `cfg_scale` / `n_iter` / `batch_size` / `override_settings` keys are still sent when `serviceHint` is not `drawthings`).
  6. `pnpm check` was green on the final commit.

Manual verification a reviewer should still do (these are the cases I did not exercise):

  • Light vs dark mode rendering of the new sampler labels in the connection editor dropdown — text-only change, no styling, but worth a glance.
  • Mobile viewport for the same dropdown.
  • Docker/Podman container build with the lazy `sharp` import on a platform without prebuilds (e.g. Termux/Android). Code follows the existing pattern in `sprites.routes.ts` and falls back to sending the original init image if `sharp` can't load.

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)

README provider list, FAQ image-generation entry, and CONFIGURATION's local-URL opt-ins section all add Draw Things alongside the existing self-hosted backends. No CHANGELOG or version bump in this PR. (Docs boxes left unchecked per the same AI-Generated PR rule above — verification of docs accuracy belongs to the human reviewer.)

UI evidence (if applicable)

No new UI surface — the only client-visible change is the expanded sampler dropdown in the existing connection editor (text-only addition).

Note on the OpenRouter changes from the earlier revision

Per reviewer feedback, the OpenRouter response-parsing improvements that were bundled into the original revision of this PR have been split out into a separate PR (#1027, linked to issue #1026) so this one stays scoped to Draw Things only.

🤖 Generated with Claude Code


🔄 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/970 **Author:** [@etherious1804](https://github.com/etherious1804) **Created:** 5/18/2026 **Status:** ✅ Merged **Merged:** 5/20/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `feat/drawthings-support` --- ### 📝 Commits (1) - [`4639a2c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4639a2c73292975a80a147a5d04fe1ad808d33c3) feat(image-gen): add Draw Things HTTP API support ### 📊 Changes **5 files changed** (+112 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `docs/CONFIGURATION.md` (+1 -1) 📝 `docs/FAQ.md` (+1 -1) 📝 `packages/server/src/services/image/image-generation.ts` (+87 -21) 📝 `packages/shared/src/constants/image-generation-defaults.ts` (+22 -4) </details> ### 📄 Description ## Linked issue Closes #969 ## Why this change - Marinara already aliases the `drawthings` provider to the AUTOMATIC1111 dispatch case, but Draw Things' HTTP server diverges from A1111 enough that the path silently fails today: requests sending `cfg_scale` return `HTTP 200 {"images": []}` (full generation cycle, no image), filling the connection editor's Model field causes `HTTP 422` because Draw Things rejects `override_settings`, and the sampler dropdown only overlaps on five names with Draw Things' actual sampler set. Out-of-the-box Draw Things connections look configured but generate nothing. - Local-network image generation on Apple Silicon Macs is meaningfully faster via Draw Things (Metal + Apple Neural Engine + CoreML) than the ComfyUI Python path. Fixing this unlocks a working backend for that audience without adding a new provider abstraction — it's all behavior changes inside the existing `automatic1111` dispatch. ## What changed - `packages/server/src/services/image/image-generation.ts`: - Passes the explicit `serviceHint` through to `generateAutomatic1111` and branches on `serviceHint === "drawthings"`. - Draw Things branch uses `guidance_scale` (not `cfg_scale`) and `batch_count` (not `n_iter`/`batch_size`); drops `override_settings`, `scheduler`, `restore_faces` which Draw Things 422s on. - Lazy-loads `sharp` (already a server dep, same load pattern as `sprites.routes.ts`) and resizes img2img init images to match request `width`/`height` exactly, since Draw Things does not auto-resize like A1111/Forge does. Falls back to the original image if `sharp` is unavailable. - Adds the missing `import { logger }` referenced at line 1430 — pre-existing bug that prevented the file from compiling. - `packages/shared/src/constants/image-generation-defaults.ts`: - Extends `SD_WEBUI_SAMPLER_OPTIONS` with 16 Draw Things-specific samplers (`UniPC AYS`, `DPM++ SDE Substep/Trailing/AYS`, `TCD`, `TCD Trailing`, `LCM`, `PLMS`, etc.) labeled `(Draw Things)` so AUTOMATIC1111/Forge users can avoid them. - `README.md`, `docs/FAQ.md`, `docs/CONFIGURATION.md`: adds Draw Things to the supported-image-providers list and to the SSRF-allowed local image backends section. - Existing AUTOMATIC1111 and Forge connections see zero behavior change — the new branch only activates when the explicit hint is `drawthings`. ## 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\` > Only ticking \`pnpm check\` because it is a deterministic command result that this agent ran on the final commit. The manual-verification boxes (container, browser click-through, light/dark/mobile, CONTRIBUTING re-read) are intentionally left unchecked per the AI-Generated PR guidance — those are a to-do list for the human contributor and reviewer, not evidence that work is done. The work I actually exercised is described below as prose. ### What I ran locally (prose, for reviewer reference) Tested end-to-end on macOS / Apple M5 against Draw Things 1.20260430.0 driving the Anima 1.0 model (Qwen-Image architecture) on \`127.0.0.1:7861\`: 1. Installed Draw Things via \`brew install --cask draw-things\` and enabled its HTTP API server. 2. In Marinara: added an image-generation connection, provider Draw Things, base URL \`http://127.0.0.1:7861\`, no API key. 3. **Without the patch:** the connection's \"Test image\" button returned no image (HTTP 200, empty \`images\` array); filling the Model field made every request 422 with \`Unrecognized keys: [\"override_settings\"]\`; the sampler dropdown effectively only had \`Euler a\` as a working option. 4. **With the patch:** - Test image button returns a real PNG in ~30s. - Selectable samplers include the Draw Things-specific entries (\`UniPC AYS\`, etc.); switching between them is honored. - In-chat image generation works for both txt2img (default selfie path) and img2img (illustrator agent with a character avatar passed as \`referenceImage\` — confirmed the init image is resized server-side so Draw Things accepts it). 5. **Regression check:** an existing AUTOMATIC1111 connection still routes through the unmodified branch and works as before (verified by sampling the request body before/after — the \`cfg_scale\` / \`n_iter\` / \`batch_size\` / \`override_settings\` keys are still sent when \`serviceHint\` is not \`drawthings\`). 6. \`pnpm check\` was green on the final commit. **Manual verification a reviewer should still do** (these are the cases I did not exercise): - Light vs dark mode rendering of the new sampler labels in the connection editor dropdown — text-only change, no styling, but worth a glance. - Mobile viewport for the same dropdown. - Docker/Podman container build with the lazy \`sharp\` import on a platform without prebuilds (e.g. Termux/Android). Code follows the existing pattern in \`sprites.routes.ts\` and falls back to sending the original init image if \`sharp\` can't load. ## 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) README provider list, FAQ image-generation entry, and CONFIGURATION's local-URL opt-ins section all add Draw Things alongside the existing self-hosted backends. No CHANGELOG or version bump in this PR. (Docs boxes left unchecked per the same AI-Generated PR rule above — verification of docs accuracy belongs to the human reviewer.) ## UI evidence (if applicable) No new UI surface — the only client-visible change is the expanded sampler dropdown in the existing connection editor (text-only addition). ## Note on the OpenRouter changes from the earlier revision Per reviewer feedback, the OpenRouter response-parsing improvements that were bundled into the original revision of this PR have been split out into a separate PR (#1027, linked to issue #1026) so this one stays scoped to Draw Things only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:15 +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#4862
No description provided.