Commit graph

3 commits

Author SHA1 Message Date
Anil Matcha
d4e645defc fix(local): route Video Studio uploads + generate through Wan2GP when a local model is selected
Closes the gap reported in #126 where local users hit "Not authorized:
missing or invalid credentials" on upload and couldn't generate video
locally even with WanGP installed. Image, video, and reference uploads
were all hard-wired to the Muapi-hosted upload endpoint, and Video
Studio had no branch into the local Wan2GP provider for generate.

- electron/wan2gpProvider: new wan2gp:upload-file IPC that POSTs to the
  Gradio /upload endpoint, caches the returned path, and rehydrates it
  into a Gradio FileData descriptor on generate. Adds wan2gp:wan22-i2v.
- preload + localInferenceClient: expose uploadFileToWan2gp(file).
- localModels: wan22-i2v entry, isWan2gpModelId, localT2VModels/localI2VModels.
- UploadPicker: accept optional uploadFn + requireApiKey so callers can
  bypass the Muapi auth modal when the active provider is local.
- VideoStudio: merge Wan2GP video models into t2v/i2v lists, route the
  reference-image upload through the local provider when a Wan2GP model
  is selected, skip the Muapi key gate for local generations, call
  localAI.generate, and surface step progress in the button label.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 19:55:35 +05:30
Anil Matcha
032ab0c693 feat(local-ai): add Wan2GP HTTP provider as a second local engine
The desktop app already has a bundled sd.cpp engine for local generation. This
adds a second, complementary engine: an HTTP client that talks to a user-run
Wan2GP Gradio server (https://github.com/deepbeepmeep/Wan2GP). Useful when
sd.cpp can't run a target model — Wan2GP brings video models (Wan 2.2,
Hunyuan, LTX) and large image models (Flux, Qwen-Image) without bundling
Python or weights into the app.

Architecture
- Each model in the unified catalog now carries a `provider` field
  (`'sdcpp' | 'wan2gp'`). The renderer's `localAI.generate()` routes to the
  right backend based on that flag.
- sd.cpp keeps its existing IPC channels (`local-ai:*`) untouched. Wan2GP
  gets its own channel namespace (`wan2gp:*`) and lives in its own
  `electron/lib/wan2gpProvider.js`.
- Wan2GP server URL is persisted in `userData/local-ai/wan2gp.json`.
  `Settings → Local Models` exposes a config bar to test/save the URL.
- Generation streams Gradio v4 SSE protocol; both engines emit progress on
  the shared `local-ai:progress` channel.

ImageStudio
- Local-model dropdown now filters out video models (`type === 'video'`)
  since the studio is image-only. SD 1.5 / SDXL / Z-Image (sd.cpp) and Flux /
  Qwen-Image (Wan2GP) still surface; Wan/Hunyuan/LTX are hidden until the
  Video Studio is wired up to the same surface.
- Progress event handler updated to tolerate both engines' shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 02:13:58 +05:30
Anil Matcha
36d392ab78 feat: add local model inference via sd.cpp (Electron-only)
- Scaffold full IPC bridge: preload.js exposes localAI API to renderer
- electron/lib/localInference.js: binary download (Metal-enabled macOS build),
  model management, auxiliary file downloads (Qwen3-4B LLM + FLUX VAE for Z-Image),
  and generation via sd-cli with DYLD_LIBRARY_PATH + xattr quarantine stripping
- electron/lib/modelCatalog.js: Z-Image Turbo/Base (featured) + SD 1.5/SDXL models
- Z-Image requires 3 components loaded via --diffusion-model + --llm + --vae flags
- ImageStudio: Local/API toggle (Electron-only), local model selector, progress bar
- SettingsModal: tabbed UI with Local Models tab (hidden on web/hosted version)
- LocalModelManager: engine status bar, per-model download cards, auxiliary
  component download UI (text encoder + VAE) for Z-Image models
- localInferenceClient.js: safe wrapper with isLocalAIAvailable() guard
- All local features gated behind isLocalAIAvailable() — web version unaffected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 17:47:17 +05:30