Skip to content

feat(ai): add SD.Next image generation and background removal support - #8

Open
BillyOutlast wants to merge 1 commit into
BotTony329:mainfrom
BillyOutlast:feat/sdnext-support
Open

feat(ai): add SD.Next image generation and background removal support#8
BillyOutlast wants to merge 1 commit into
BotTony329:mainfrom
BillyOutlast:feat/sdnext-support

Conversation

@BillyOutlast

Copy link
Copy Markdown

Summary

Adds first-class support for SD.Next via its REST API, enabling local and self-hosted Stable Diffusion workflows with Manga Studio.

Changes

1. SD.Next Image Generation Provider

  • Implemented src/ai/providers/sdnext.ts with ImageGenerationProvider interface.
  • Text-to-Image: POST /sdapi/v1/txt2img with prompt, negative prompt, dimensions, sampling steps, CFG scale, and per-request model overrides (override_settings.sd_model_checkpoint).
  • Reference Conditioning & Image Variation: POST /sdapi/v1/img2img with init_images (base64) for character consistency across pose/expression generations.
  • Image Editing: POST /sdapi/v1/img2img for local edits and prompt-driven inpainting.
  • Authentication: Supports unauthenticated local instances (default http://127.0.0.1:7860), HTTP Basic Auth (username:password) when started with --auth, or Bearer tokens.
  • Connection Check: Checks /sdapi/v1/options for real-time connection status.
  • Live Model Discovery: Querying GET /sdapi/v1/sd-models dynamically populates installed checkpoints in the model selector.

2. SD.Next Background Removal (Rembg)

  • Implemented src/assets/providers/sdnext.ts using SD.Next's built-in Rembg module on POST /sdapi/v1/extra-single-image (rembg_model: u2net).
  • Validates returned transparency according to the asset post-processing alpha contract.

3. UI & Configuration

  • Added SD.Next and SD.Next (rembg) options to AI Settings (AiSettingsDialog.tsx).
  • Enabled model discovery button ("Fetch models") for SD.Next.
  • Added SD.Next txt2img and SD.Next rembg quick presets in CustomProviderForm.tsx.
  • Updated session config validation in providerSession.ts to allow empty keys for unauthenticated local instances.

4. Tests & Documentation

  • Added unit tests in src/ai/providers/sdnext.test.ts, src/assets/providers/sdnext.test.ts, and src/server/providerSession.test.ts.
  • Added mock /sdapi/v1/* routes to scripts/fake-providers.mjs.
  • Updated AI_PROVIDER_ARCHITECTURE.md, DEPLOYMENT.md, README.md, and .env.example.

Verification

  • npm run typecheck: 0 errors.
  • npm test: 95 test suites passed, 1,089 tests passed (0 failures).

- Add SD.Next image provider adapter supporting txt2img, img2img, and editImage
- Add SD.Next Rembg background removal adapter for extra-single-image postprocessing
- Add live model checkpoint discovery route for /sdapi/v1/sd-models
- Add SD.Next protocols and custom presets in AI Settings and Custom Provider forms
- Support optional authentication for local and --auth SD.Next instances
- Add unit and contract tests for SD.Next generation, rembg, and session config
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the personal Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant