The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat: Z-Image own strategy, Image-to-Image, process cleanup
PurpleDoubleDb91dbee42e7b
diff --git a/CLAUDE.md b/CLAUDE.mdindex a4cdbf83..0b9319f2 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -27,7 +27,7 @@ src-tauri/src/commands/ — Rust commands: install, process, download, prox## Current Work: v2.3.0 (branch: full-comfyui-fix)-### What's DONE (601 tests passing):+### What's DONE (607 tests passing):1. **7 new ModelTypes:** mochi, cosmos, cogvideo, svd, framepack, pyramidflow, allegro2. **7 new WorkflowStrategies** with complete node chains for each model3. **14 video bundles + 6 image bundles** in discover.ts with HuggingFace URLs@@ -78,14 +78,17 @@ src-tauri/src/commands/ — Rust commands: install, process, download, prox44. **FramePack preflight custom node check** — Added framepack to customNodeModels in preflight.ts. Now checks for LoadFramePackModel + FramePackSampler before generation.45. **FramePack DualCLIPLoader fix** — CLIPLoader type "wan" creates Llama2 with 128256 vocab but llava_llama3 has 128320 tokens. Fixed: use DualCLIPLoader (clip_l + llava_llama3) with type "hunyuan_video". Added CLIPVisionLoader + CLIPVisionEncode for image_embeds. Full I2V pipeline verified in .exe (OOM on 12GB VRAM = hardware limit, not software bug).+46. **Z-Image own ModelType + strategy** — Z-Image was classified as `flux2` but uses `qwen_3_4b` CLIP (not `qwen_3_4b_fp4_flux2`), causing KSampler shape mismatch [2560] vs [1, 77, 768]. Fixed: new ModelType `zimage`, new strategy `unet_zimage`, CLIPLoader type `qwen_image` (queried from ComfyUI /object_info). Added findMatchingVAE/CLIP for zimage (exact match `qwen_3_4b.safetensors`, excludes fp4_flux2 variant). COMPONENT_REGISTRY in both comfyui.ts and discover.ts. Defaults: 12 steps, CFG 3.5, euler/simple. Z-Image Turbo E2E verified in .exe — 5 steps generates correct 1024x1024 image.+47. **Image-to-Image (I2I) feature** — Complete I2I pipeline: LoadImage → VAEEncode → KSampler (denoise < 1.0) → VAEDecode → SaveImage. Sub-tabs in Parameters panel (Text to Image / Image to Image) matching Video's T2V/I2V pattern. Upload zone with drag & drop, denoise slider (0.0-1.0) in both main area and sidebar. Works with all image models (SDXL, FLUX, Z-Image). Store migration from old `mode: 'i2i'` to `imageSubMode`. E2E verified in .exe — Z-Image I2I with denoise 0.7 generates correct output.+48. **ComfyUI process cleanup on app kill** — Windows Job Object with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE`. When Tauri app is killed (even via Task Manager), OS kernel automatically terminates ComfyUI Python process. Applied to both `start_comfyui()` and `auto_start_comfyui()`. Added `windows-sys` crate dependency.+### What's LEFT to finish v2.3.0:-1. **Z-Image Turbo/Base strategy** — Z-Image is classified as `flux2` but uses `qwen_3_4b` CLIP (not `t5xxl`). KSampler shape mismatch: [2560] vs [512, 7680]. Needs its own ModelType + strategy with correct CLIPLoader config. Z-Image Base likely has the same issue.-2. **Tauri proxy_localhost investigation** — reqwest in Tauri subprocess can't reach localhost. Direct fetch workaround in place but root cause unknown. Low priority since workaround works. Deferred to next release.-3. **LTX VAEDecode reference** — dynamic-workflow.ts line 263: vaeSourceId incorrectly points to UNETLoader output for LTX strategy. Fix when LTX model is installed for testing.+1. **Tauri proxy_localhost investigation** — reqwest in Tauri subprocess can't reach localhost. Direct fetch workaround in place but root cause unknown. Low priority since workaround works. Deferred to next release.+2. **LTX VAEDecode reference** — dynamic-workflow.ts line 263: vaeSourceId incorrectly points to UNETLoader output for LTX strategy. Fix when LTX model is installed for testing.### Files modified in this branch (30+ files):-- `src/api/comfyui.ts` — 7 new ModelTypes, COMPONENT_REGISTRY, uploadImage(), inputImage in VideoParams-- `src/api/dynamic-workflow.ts` — 7 new strategies, 5 wrapper builders, inputImage support in SVD/FramePack+- `src/api/comfyui.ts` — 8 new ModelTypes (incl. zimage), COMPONENT_REGISTRY, uploadImage(), inputImage/denoise in GenerateParams, findMatchingVAE/CLIP for zimage+- `src/api/dynamic-workflow.ts` — 8 new strategies (incl. unet_zimage), 5 wrapper builders, inputImage support in SVD/FramePack, I2I pipeline (LoadImage→VAEEncode→KSampler denoise)- `src/api/comfyui-nodes.ts` — 30+ new nodes in categorization mapping- `src/api/discover.ts` — 14 video + 6 image bundles, CUSTOM_NODE_REGISTRY, installBundleComplete(), uncensored flags, ALL sizeGB verified, HF GGUF unified text model lists (34 uncensored + 30 mainstream), removed Ollama search/fetch functions- `src/api/backend.ts` — install_custom_node endpoint mapping, openExternal() for system browser@@ -94,7 +97,7 @@ src-tauri/src/commands/ — Rust commands: install, process, download, prox- `src-tauri/src/commands/download.rs` — download_model with resume, progress, speed tracking (camelCase params), 50% threshold for check_model_sizes- `src-tauri/src/main.rs` — registered install_custom_node- `src-tauri/capabilities/default.json` — added shell:allow-open for external links-- `src/components/create/CreateView.tsx` — I2V upload UI (drag & drop, preview, replace/remove)+- `src/components/create/CreateView.tsx` — I2V upload UI, I2I upload zone + denoise slider, Image/Video top-tabs only- `src/components/create/WorkflowSearchModal.tsx` — openExternal for CivitAI link- `src/components/create/WorkflowCard.tsx` — openExternal for source links- `src/components/chat/MarkdownRenderer.tsx` — openExternal for all chat links@@ -105,9 +108,12 @@ src-tauri/src/commands/ — Rust commands: install, process, download, prox- `src/stores/providerStore.ts` — LM Studio default disabled (auto-detect only)- `src/stores/updateStore.ts` — openExternal for release page- `src/lib/constants.ts` — OnboardingModel: vramGB, uncensored, agent fields, qwen2.5-abliterate typo fix, HF GGUF downloadUrl/filename/sizeGB for all 17 onboarding models-- `src/hooks/useCreate.ts` — i2vImage pass-through to workflow builder+- `src/hooks/useCreate.ts` — i2vImage + i2iImage pass-through, I2I validation, imageSubMode-based generate logic- `src/lib/constants.ts` — OnboardingModel: vramGB, uncensored, agent fields + mainstream models-- `src/stores/createStore.ts` — i2vImage state+- `src/stores/createStore.ts` — i2vImage/i2iImage/denoise/imageSubMode state, persist migration for old 'i2i' mode+- `src/components/create/ParamPanel.tsx` — Z-Image badge, Text to Image / Image to Image sub-tabs, denoise slider+- `src-tauri/src/commands/process.rs` — Windows Job Object for ComfyUI process cleanup on app kill+- `src-tauri/Cargo.toml` — windows-sys dependency for Job Object API- `src/stores/downloadStore.ts` — NEW: unified ComfyUI download tracking (polling, bundle grouping)- `src/stores/uiStore.ts` — default view changed to 'chat'- `src/lib/model-compatibility.ts` — added isThinkingCompatible() + THINKING_COMPATIBLE listdiff --git a/README.md b/README.mdindex 10d2dfd6..fc1b08b3 100644--- a/README.md+++ b/README.md@@ -34,6 +34,22 @@ No cloud. No censorship. No data collection. Auto-detects 12 local backends. You---+## v2.3.0 — Coming Soon++**ComfyUI Plug & Play, 20 Video/Image Models, Image-to-Image, Z-Image Support**++- **ComfyUI Plug & Play** — Auto-detect, one-click install, auto-start. Zero config image and video generation.+- **20 Model Bundles** — 14 video + 6 image bundles with one-click download (Wan 2.1, HunyuanVideo, FLUX 2, Z-Image, CogVideoX, FramePack, and more).+- **Z-Image Turbo/Base** — Uncensored image model with own strategy and qwen_image CLIP type. 8-15 seconds per image.+- **Image-to-Image (I2I)** — Upload a source image, adjust denoise strength (0.0-1.0), transform with any prompt. Works with all image models.+- **Image-to-Video (I2V)** — SVD and FramePack support with drag & drop image upload.+- **Dynamic Workflow Builder** — Auto-detects installed nodes and builds the correct pipeline for any model type.+- **VRAM-Aware Model Filtering** — Lightweight / Mid-Range / High-End tabs based on GPU VRAM.+- **Unified Download Manager** — Track all downloads (text models, image models, video models) with progress, speed, pause/resume.+- **Process Cleanup** — ComfyUI Python process automatically terminates when app is closed or killed.++---+## v2.2.3 — Latest Release**Plug & Play Setup, Multi-Provider Overhaul, Codex Agent, MCP Tools**@@ -67,6 +83,7 @@ See [Release Notes](https://github.com/PurpleDoubleD/locally-uncensored/releases| **A/B Model Compare** | **Yes** | No | No | No || **Local Benchmark** | **Yes** | No | No | No || Image Generation | **Yes** | No | No | No |+| **Image-to-Image** | **Yes** | No | No | No || Video Generation | **Yes** | No | No | No || **File Upload + Vision** | **Yes** | Yes | Yes | No || **Thinking Mode** | **Yes** | No | No | No |diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex f375ad9c..cb963f5b 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -2221,6 +2221,7 @@ dependencies = ["urlencoding","walkdir","whoami",+ "windows-sys 0.59.0",][[package]]diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.tomlindex 060d6bf6..cfd22e01 100644--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@ -31,6 +31,9 @@ urlencoding = "2"url = "2"rfd = "0.15"+[target.'cfg(windows)'.dependencies]+windows-sys = { version = "0.59", features = ["Win32_System_JobObjects", "Win32_System_Threading", "Win32_Foundation", "Win32_Security"] }+[profile.release]panic = "abort"codegen-units = 1diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rsindex a06b8cfd..716877e5 100644--- a/src-tauri/src/commands/process.rs+++ b/src-tauri/src/commands/process.rs@@ -12,6 +12,46 @@ use crate::state::AppState;#[cfg(target_os = "windows")]const CREATE_NO_WINDOW: u32 = 0x08000000;+/// Assign a child process to a Windows Job Object with KILL_ON_JOB_CLOSE.+/// When the Tauri parent process dies (even via Task Manager), the OS kernel+/// automatically terminates all processes in the job — no Drop needed.+#[cfg(target_os = "windows")]+fn assign_to_kill_on_close_job(child: &std::process::Child) {+ use windows_sys::Win32::System::JobObjects::*;+ use windows_sys::Win32::Foundation::*;++ unsafe {+ let job = CreateJobObjectW(std::ptr::null(), std::ptr::null());+ if job.is_null() { return; }++ let mut info: JOBOBJECT_EXTENDED_LIMIT_INFORMATION = std::mem::zeroed();+ info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;++ SetInformationJobObject(+ job,+ JobObjectExtendedLimitInformation,+ &info as *const _ as *const _,+ std::mem::size_of::<JOBOBJECT_EXTENDED_LIMIT_INFORMATION>() as u32,+ );++ // Open process handle from PID+ let pid = child.id();+ let handle = windows_sys::Win32::System::Threading::OpenProcess(+ windows_sys::Win32::System::Threading::PROCESS_SET_QUOTA+ | windows_sys::Win32::System::Threading::PROCESS_TERMINATE,+ 0, // FALSE+ pid,+ );+ if !handle.is_null() {+ AssignProcessToJobObject(job, handle);+ CloseHandle(handle);+ }+ // Intentionally leak the job handle — it must stay alive for the duration+ // of the parent process. When the parent dies, the handle is closed by the+ // OS and KILL_ON_JOB_CLOSE triggers.+ }+}+/// Show the main window (called from frontend after React renders)#[tauri::command]pub fn show_window(app: tauri::AppHandle) {@@ -232,6 +272,10 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, Stlet mut child = cmd.spawn().map_err(|e| format!("Failed to start ComfyUI (python={}): {}", python, e))?;+ // Assign to Job Object so child dies when parent dies (even via Task Manager)+ #[cfg(target_os = "windows")]+ assign_to_kill_on_close_job(&child);+// Drain stdout/stderr in background threads to prevent buffer deadlockif let Some(stdout) = child.stdout.take() {std::thread::spawn(move || {@@ -423,6 +467,10 @@ pub fn auto_start_comfyui(state: &AppState) {cmd.creation_flags(CREATE_NO_WINDOW);match cmd.spawn() {Ok(mut child) => {+ // Assign to Job Object so child dies when parent dies (even via Task Manager)+ #[cfg(target_os = "windows")]+ assign_to_kill_on_close_job(&child);+// Drain stdout/stderr in background threads to prevent buffer deadlockif let Some(stdout) = child.stdout.take() {std::thread::spawn(move || {diff --git a/src/api/__tests__/comfyui-models.test.ts b/src/api/__tests__/comfyui-models.test.tsindex 3f3f0b18..c8ebd0e7 100644--- a/src/api/__tests__/comfyui-models.test.ts+++ b/src/api/__tests__/comfyui-models.test.ts@@ -75,6 +75,13 @@ describe('classifyModel', () => {expect(classifyModel('allegro_model.safetensors')).toBe('allegro')})+ it('classifies Z-Image models', () => {+ expect(classifyModel('z_image_turbo_bf16.safetensors')).toBe('zimage')+ expect(classifyModel('z_image_bf16.safetensors')).toBe('zimage')+ expect(classifyModel('z-image-turbo.safetensors')).toBe('zimage')+ expect(classifyModel('zimage_base.safetensors')).toBe('zimage')+ })+it('returns unknown for unrecognized models', () => {expect(classifyModel('totally_custom_model.safetensors')).toBe('unknown')})@@ -84,7 +91,7 @@ describe('classifyModel', () => {describe('isVideoModelType', () => {const videoTypes = ['wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro'] as const- const imageTypes = ['flux', 'flux2', 'sdxl', 'sd15', 'unknown'] as const+ const imageTypes = ['flux', 'flux2', 'zimage', 'sdxl', 'sd15', 'unknown'] as constfor (const t of videoTypes) {it(`${t} is a video model type`, () => {@@ -132,7 +139,7 @@ describe('MODEL_TYPE_DEFAULTS', () => {// ─── COMPONENT_REGISTRY ───describe('COMPONENT_REGISTRY', () => {- const allTypes = ['sd15', 'sdxl', 'flux', 'flux2', 'wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro', 'unknown']+ const allTypes = ['sd15', 'sdxl', 'flux', 'flux2', 'zimage', 'wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro', 'unknown']for (const t of allTypes) {it(`${t} has a registry entry`, () => {@@ -290,6 +297,17 @@ describe('determineStrategy', () => {expect(r.strategy).toBe('unet_flux2')})+ it('zimage → unet_zimage', () => {+ const r = determineStrategy('zimage', false, makeNodes(), emptyModels)+ expect(r.strategy).toBe('unet_zimage')+ })++ it('zimage → unavailable without loaders', () => {+ const nodes = makeNodes({ loaders: [] })+ const r = determineStrategy('zimage', false, nodes, emptyModels)+ expect(r.strategy).toBe('unavailable')+ })+it('sdxl → checkpoint', () => {const r = determineStrategy('sdxl', false, makeNodes(), emptyModels)expect(r.strategy).toBe('checkpoint')diff --git a/src/api/__tests__/comfyui-workflows.test.ts b/src/api/__tests__/comfyui-workflows.test.tsindex 5dd14705..c46ed9f8 100644--- a/src/api/__tests__/comfyui-workflows.test.ts+++ b/src/api/__tests__/comfyui-workflows.test.ts@@ -43,7 +43,7 @@ const defaultModels: AvailableModels = {// ─── Strategy mapping tests ───-describe('determineStrategy — all 14 model types', () => {+describe('determineStrategy — all 15 model types', () => {const strategyMap: [ModelType, WorkflowStrategy][] = [['wan', 'unet_video'],['hunyuan', 'unet_video'],@@ -57,6 +57,7 @@ describe('determineStrategy — all 14 model types', () => {['allegro', 'allegro'],['flux', 'unet_flux'],['flux2', 'unet_flux2'],+ ['zimage', 'unet_zimage'],]for (const [modelType, expectedStrategy] of strategyMap) {diff --git a/src/api/comfyui.ts b/src/api/comfyui.tsindex f76c54c3..01ad4d14 100644--- a/src/api/comfyui.ts+++ b/src/api/comfyui.ts@@ -14,6 +14,8 @@ export interface GenerateParams {height: numberseed: numberbatchSize: number+ inputImage?: string // I2I source image filename (uploaded to ComfyUI)+ denoise?: number // I2I denoise strength (0.0–1.0, default 1.0 = full txt2img)}export interface VideoParams extends GenerateParams {@@ -28,7 +30,7 @@ export interface ComfyUIOutput {type: string}-export type ModelType = 'flux' | 'flux2' | 'sdxl' | 'sd15' | 'wan' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'unknown'+export type ModelType = 'flux' | 'flux2' | 'zimage' | 'sdxl' | 'sd15' | 'wan' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'unknown'export type VideoBackend = 'wan' | 'animatediff' | 'none'export interface ClassifiedModel {@@ -73,8 +75,8 @@ export function classifyModel(name: string): ModelType {if (lower.includes('hunyuan')) return 'hunyuan'if (lower.includes('ltx')) return 'ltx'- // FLUX variants + Z-Image (same architecture as FLUX 2: UNETLoader + separate VAE/CLIP)- if (lower.includes('z_image') || lower.includes('z-image') || lower.includes('zimage')) return 'flux2'+ // Z-Image (uses qwen_image CLIP type, NOT flux2 — different embedding dimensions)+ if (lower.includes('z_image') || lower.includes('z-image') || lower.includes('zimage')) return 'zimage'if (lower.includes('flux-2') || lower.includes('flux2')) return 'flux2'if (lower.includes('flux')) return 'flux'@@ -97,7 +99,7 @@ export function classifyModel(name: string): ModelType {}export function isImageModelType(type: ModelType): boolean {- return type === 'flux' || type === 'flux2' || type === 'sdxl' || type === 'sd15' || type === 'unknown'+ return type === 'flux' || type === 'flux2' || type === 'zimage' || type === 'sdxl' || type === 'sd15' || type === 'unknown'}export function isVideoModelType(type: ModelType): boolean {@@ -170,6 +172,11 @@ export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {vae: { matchPatterns: ['flux2', 'flux'], downloadFilename: 'flux2-vae.safetensors' },clip: { matchPatterns: ['qwen', 'mistral'], downloadFilename: 'qwen_3_4b_fp4_flux2.safetensors' },},+ zimage: {+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'qwen_image',+ vae: { matchPatterns: ['ae', 'flux'], downloadFilename: 'ae.safetensors' },+ clip: { matchPatterns: ['qwen_3_4b', 'qwen3'], downloadFilename: 'qwen_3_4b.safetensors' },+ },wan: {loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',vae: { matchPatterns: ['wan', 'hunyuan'], downloadFilename: 'wan_2.1_vae.safetensors' },@@ -479,6 +486,14 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {if (vaes.length === 0) throw new Error('No VAE models found. Download a VAE for your model type from the Model Manager.')const lower = (s: string) => s.toLowerCase()+ if (modelType === 'zimage') {+ // Z-Image uses ae.safetensors (same as FLUX but prefer exact match)+ const match = vaes.find(v => lower(v) === 'ae.safetensors')+ || vaes.find(v => lower(v).includes('ae'))+ || vaes.find(v => lower(v).includes('flux'))+ if (match) return match+ throw new Error(`No Z-Image VAE found. Download "ae.safetensors" from the Model Manager.`)+ }if (modelType === 'flux' || modelType === 'flux2') {const match = vaes.find(v => lower(v).includes('flux2') || lower(v).includes('flux'))|| vaes.find(v => lower(v).includes('ae'))@@ -538,6 +553,14 @@ export async function findMatchingCLIP(modelType: ModelType): Promise<string> {if (clips.length === 0) throw new Error('No text encoder models found. Download a CLIP/T5 model for your model type from the Model Manager.')const lower = (s: string) => s.toLowerCase()+ if (modelType === 'zimage') {+ // Z-Image uses qwen_3_4b.safetensors (NOT the fp4_flux2 variant — different embedding dimensions!)+ const match = clips.find(c => lower(c) === 'qwen_3_4b.safetensors')+ || clips.find(c => lower(c).includes('qwen_3_4b') && !lower(c).includes('fp4') && !lower(c).includes('flux2'))+ || clips.find(c => lower(c).includes('qwen3') && !lower(c).includes('fp4'))+ if (match) return match+ throw new Error(`No Z-Image text encoder found. Download "qwen_3_4b.safetensors" from the Model Manager.`)+ }if (modelType === 'flux2') {// FLUX 2 uses Qwen or Mistral text encoders, NOT T5const match = clips.find(c => lower(c).includes('qwen') && !lower(c).includes('qwen_2.5_vl'))diff --git a/src/api/discover.ts b/src/api/discover.tsindex 094b8003..683be540 100644--- a/src/api/discover.ts+++ b/src/api/discover.ts@@ -274,6 +274,12 @@ export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {clip: { patterns: ['qwen', 'mistral'], downloadName: 'qwen_3_4b_fp4_flux2.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/text_encoders/qwen_3_4b_fp4_flux2.safetensors', subfolder: 'text_encoders' },needsSeparateVAE: true, needsSeparateCLIP: true,},+ zimage: {+ loader: 'UNETLoader',+ vae: { patterns: ['ae', 'flux'], downloadName: 'ae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors', subfolder: 'vae' },+ clip: { patterns: ['qwen_3_4b', 'qwen3'], downloadName: 'qwen_3_4b.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors', subfolder: 'text_encoders' },+ needsSeparateVAE: true, needsSeparateCLIP: true,+ },wan: {loader: 'UNETLoader',vae: { patterns: ['wan'], downloadName: 'wan_2.1_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors', subfolder: 'vae' },@@ -725,7 +731,7 @@ export function getImageBundles(): ModelBundle[] {uncensored: true,totalSizeGB: 19.3,vramRequired: '10-16 GB',- workflow: 'flux2',+ workflow: 'zimage',url: 'https://huggingface.co/Comfy-Org/z_image_turbo',files: [{@@ -758,7 +764,7 @@ export function getImageBundles(): ModelBundle[] {uncensored: true,totalSizeGB: 19.3,vramRequired: '10-16 GB',- workflow: 'flux2',+ workflow: 'zimage',url: 'https://huggingface.co/Comfy-Org/z_image',files: [{diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.tsindex 763816a8..c3cf0e42 100644--- a/src/api/dynamic-workflow.ts+++ b/src/api/dynamic-workflow.ts@@ -14,6 +14,7 @@ import {export type WorkflowStrategy =| 'unet_flux' // FLUX 1: UNETLoader + CLIPLoader + VAELoader + EmptySD3LatentImage| 'unet_flux2' // FLUX 2: UNETLoader + CLIPLoader + VAELoader + EmptyFlux2LatentImage+ | 'unet_zimage' // Z-Image: UNETLoader + CLIPLoader(qwen_image) + VAELoader + EmptySD3LatentImage| 'unet_video' // Wan/Hunyuan: UNETLoader + CLIPLoader + VAELoader + EmptyHunyuanLatentVideo| 'unet_ltx' // LTX Video: UNETLoader + CLIPLoader + EmptyLTXVLatentVideo| 'unet_mochi' // Mochi: UNETLoader + CLIPLoader + VAELoader + EmptyMochiLatentVideo@@ -44,6 +45,14 @@ export function determineStrategy(const hasVAELoader = nodes.loaders.includes('VAELoader')const hasAnimateDiff = nodes.motion.includes('ADE_LoadAnimateDiffModel')+ // Z-Image → UNET + CLIPLoader(qwen_image) + VAE + SD3LatentImage+ if (modelType === 'zimage') {+ if (hasUNET && hasCLIPLoader && hasVAELoader) {+ return { strategy: 'unet_zimage', reason: 'Z-Image model → UNETLoader + CLIPLoader(qwen_image)' }+ }+ return { strategy: 'unavailable', reason: 'Z-Image requires UNETLoader + CLIPLoader + VAELoader nodes' }+ }+// FLUX 2 → UNET + Flux2LatentImageif (modelType === 'flux2') {if (hasUNET && hasCLIPLoader && hasVAELoader) {@@ -223,13 +232,14 @@ export async function buildDynamicWorkflow(vaeOutputSlot = 2samplerModelId = modelNodeId- } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_video' || strategy === 'unet_ltx'+ } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_zimage' || strategy === 'unet_video' || strategy === 'unet_ltx'|| strategy === 'unet_mochi' || strategy === 'unet_cosmos') {// Separate loadersconst unetId = String(n++)const clipId = String(n++)- const clipType = type === 'flux2' ? 'flux2'+ const clipType = type === 'zimage' ? 'qwen_image'+ : type === 'flux2' ? 'flux2': type === 'flux' ? 'flux': type === 'ltx' ? 'ltxv': (type === 'wan' || type === 'hunyuan') ? 'wan'@@ -324,6 +334,8 @@ export async function buildDynamicWorkflow(}// ─── Phase 3: Latent Initialization ───+ // I2I mode: LoadImage → VAEEncode instead of empty latent+ const isI2I = !isVideo && params.inputImage && (params.denoise ?? 1.0) < 1.0const latentId = String(n++)@@ -378,6 +390,15 @@ export async function buildDynamicWorkflow(class_type: latentNode,inputs: { width: params.width, height: params.height, batch_size: params.batchSize },}+ } else if (strategy === 'unet_zimage') {+ // Z-Image uses SD3 latent (same architecture family)+ const latentNode = nodes.latentInit.includes('EmptySD3LatentImage')+ ? 'EmptySD3LatentImage'+ : 'EmptyLatentImage'+ workflow[latentId] = {+ class_type: latentNode,+ inputs: { width: params.width, height: params.height, batch_size: params.batchSize },+ }} else if (strategy === 'unet_flux') {// FLUX 1 uses SD3 latentconst latentNode = nodes.latentInit.includes('EmptySD3LatentImage')@@ -395,6 +416,24 @@ export async function buildDynamicWorkflow(}}+ // I2I override: replace empty latent with LoadImage → VAEEncode+ let latentSourceId = latentId+ if (isI2I) {+ const loadImageId = String(n++)+ const vaeEncodeId = String(n++)+ workflow[loadImageId] = {+ class_type: 'LoadImage',+ inputs: { image: params.inputImage },+ }+ workflow[vaeEncodeId] = {+ class_type: 'VAEEncode',+ inputs: { pixels: [loadImageId, 0], vae: [vaeSourceId, vaeOutputSlot] },+ }+ latentSourceId = vaeEncodeId+ // Remove the empty latent node since we're using the encoded image+ delete workflow[latentId]+ }+// ─── Phase 4: Sampling ───const samplerId = String(n++)@@ -405,13 +444,13 @@ export async function buildDynamicWorkflow(model: [samplerModelId, 0],positive: [posId, 0],negative: [negId, 0],- latent_image: [latentId, 0],+ latent_image: [latentSourceId, 0],seed,steps: params.steps,cfg: params.cfgScale,sampler_name: params.sampler,scheduler: params.scheduler,- denoise: 1.0,+ denoise: isI2I ? (params.denoise ?? 0.7) : 1.0,},}diff --git a/src/api/preflight.ts b/src/api/preflight.tsindex 5341be5e..ab9032c2 100644--- a/src/api/preflight.ts+++ b/src/api/preflight.ts@@ -94,7 +94,7 @@ export async function preflightCheck(}}- const needsUnet = modelType === 'flux' || modelType === 'flux2' || modelType === 'wan' || modelType === 'hunyuan'+ const needsUnet = modelType === 'flux' || modelType === 'flux2' || modelType === 'zimage' || modelType === 'wan' || modelType === 'hunyuan'|| modelType === 'ltx' || modelType === 'mochi' || modelType === 'cosmos'|| modelType === 'framepack'if (needsUnet) {diff --git a/src/components/create/CreateView.tsx b/src/components/create/CreateView.tsxindex 48c0c4ef..a08d20dc 100644--- a/src/components/create/CreateView.tsx+++ b/src/components/create/CreateView.tsx@@ -113,7 +113,7 @@ export function CreateView() {connected, imageModels, videoModels, samplerList, schedulerList,videoBackend, modelsLoaded, checkConnection, fetchModels, runPreflight, generate, cancel,} = useCreate()- const { mode, setMode, error, preflightReady, preflightErrors, preflightWarnings, videoModel, i2vImage, setI2vImage } = useCreateStore()+ const { mode, setMode, imageSubMode, error, preflightReady, preflightErrors, preflightWarnings, videoModel, i2vImage, setI2vImage, i2iImage, setI2iImage, denoise, setDenoise } = useCreateStore()const [status, setStatus] = useState<ComfyStatus | null>(null)const [startupLogs, setStartupLogs] = useState<string[]>([])@@ -128,6 +128,8 @@ export function CreateView() {const [showConnected, setShowConnected] = useState(true)const [i2vUploading, setI2vUploading] = useState(false)const [i2vDragOver, setI2vDragOver] = useState(false)+ const [i2iUploading, setI2iUploading] = useState(false)+ const [i2iDragOver, setI2iDragOver] = useState(false)const installPollRef = useRef<ReturnType<typeof setInterval> | null>(null)const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)const pollIdRef = useRef(0)@@ -226,6 +228,25 @@ export function CreateView() {if (file) handleI2vUpload(file)}+ const handleI2iUpload = async (file: File) => {+ if (!file.type.startsWith('image/')) return+ setI2iUploading(true)+ try {+ const filename = await uploadImage(file)+ setI2iImage(filename)+ } catch (err) {+ console.error('[CreateView] I2I image upload failed:', err)+ }+ setI2iUploading(false)+ }++ const handleI2iDrop = (e: React.DragEvent) => {+ e.preventDefault()+ setI2iDragOver(false)+ const file = e.dataTransfer.files[0]+ if (file) handleI2iUpload(file)+ }+const isStarting = status?.starting || status?.processAliveconst notFound = status && !status.found && !status.running@@ -509,6 +530,74 @@ export function CreateView() {</div>)}+ {/* I2I Image Upload + Denoise Slider — shown when Image sub-tab is "Image to Image" */}+ {mode === 'image' && imageSubMode === 'img2img' && connected === true && (+ <div className="space-y-2">+ <div+ onDragOver={(e) => { e.preventDefault(); setI2iDragOver(true) }}+ onDragLeave={() => setI2iDragOver(false)}+ onDrop={handleI2iDrop}+ className={`relative rounded-lg border-2 border-dashed transition-colors ${+ i2iDragOver+ ? 'border-blue-400 bg-blue-500/10'+ : i2iImage+ ? 'border-emerald-500/30 bg-emerald-500/5'+ : 'border-white/10 bg-white/[0.02] hover:border-white/20'+ }`}+ >+ {i2iImage ? (+ <div className="flex items-center justify-between px-3 py-2">+ <div className="flex items-center gap-2 text-emerald-400 text-[11px]">+ <CheckCircle2 size={12} />+ <span className="truncate max-w-[200px]">{i2iImage}</span>+ </div>+ <div className="flex items-center gap-1">+ <label className="cursor-pointer px-2 py-0.5 rounded text-[10px] text-gray-400 hover:text-white hover:bg-white/10 transition-colors">+ Replace+ <input type="file" accept="image/*" className="hidden" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleI2iUpload(f) }} />+ </label>+ <button+ onClick={() => setI2iImage(null)}+ className="p-0.5 rounded text-gray-500 hover:text-red-400 hover:bg-white/10 transition-colors"+ title="Remove image"+ >+ <XIcon size={10} />+ </button>+ </div>+ </div>+ ) : (+ <label className="flex flex-col items-center gap-1 px-3 py-3 cursor-pointer">+ {i2iUploading ? (+ <Loader2 size={16} className="animate-spin text-gray-400" />+ ) : (+ <Upload size={16} className="text-gray-500" />+ )}+ <span className="text-[11px] text-gray-400">+ {i2iUploading ? 'Uploading...' : 'Drop or click to upload source image'}+ </span>+ <span className="text-[9px] text-gray-600">+ Image-to-Image: transforms your image guided by the prompt+ </span>+ <input type="file" accept="image/*" className="hidden" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleI2iUpload(f) }} />+ </label>+ )}+ </div>++ {/* Denoise Strength Slider */}+ <div className="flex items-center gap-3 px-1">+ <span className="text-[10px] text-gray-500 whitespace-nowrap">Denoise</span>+ <input+ type="range"+ min={0} max={1} step={0.05}+ value={denoise}+ onChange={(e) => setDenoise(parseFloat(e.target.value))}+ className="flex-1 h-1 accent-blue-500"+ />+ <span className="text-[10px] text-gray-400 font-mono w-8 text-right">{denoise.toFixed(2)}</span>+ </div>+ </div>+ )}+{/* Output area */}<div className="flex-1 min-h-0 rounded-xl border border-gray-200 dark:border-white/5 bg-gray-100 dark:bg-white/[0.03] overflow-hidden flex flex-col"><OutputDisplay />diff --git a/src/components/create/ParamPanel.tsx b/src/components/create/ParamPanel.tsxindex 12286cdd..e77d4fbe 100644--- a/src/components/create/ParamPanel.tsx+++ b/src/components/create/ParamPanel.tsx@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'import { useCreateStore } from '../../stores/createStore'import { SliderControl } from '../settings/SliderControl'import { WorkflowFinder } from './WorkflowFinder'-import { Dice5, Info, AlertTriangle, Film, ImageIcon } from 'lucide-react'+import { Dice5, Info, AlertTriangle, Film, ImageIcon, ImagePlus } from 'lucide-react'import type { ClassifiedModel, ModelType } from '../../api/comfyui'import { snapToVideoGrid, isI2VModel } from '../../api/comfyui'@@ -43,6 +43,7 @@ const VID_SIZE_PRESETS = [const TYPE_BADGE: Record<ModelType, { label: string; color: string }> = {flux: { label: 'FLUX', color: 'bg-purple-500/15 text-purple-300' },flux2: { label: 'FLUX 2', color: 'bg-purple-500/15 text-purple-300' },+ zimage: { label: 'Z-Image', color: 'bg-rose-500/15 text-rose-300' },sdxl: { label: 'SDXL', color: 'bg-blue-500/15 text-blue-300' },sd15: { label: 'SD 1.5', color: 'bg-green-500/15 text-green-300' },wan: { label: 'Wan', color: 'bg-orange-500/15 text-orange-300' },@@ -61,6 +62,7 @@ const TYPE_BADGE: Record<ModelType, { label: string; color: string }> = {export function ParamPanel({ imageModels, videoModels, samplerList, schedulerList, modelsLoaded }: Props) {const store = useCreateStore()const isVideo = store.mode === 'video'+ const isI2I = store.mode === 'image' && store.imageSubMode === 'img2img'const [videoSubTab, setVideoSubTab] = useState<'t2v' | 'i2v'>('t2v')const sizePresets = isVideo ? VID_SIZE_PRESETS : getImageSizePresets(store.imageModelType)@@ -68,7 +70,7 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLisconst filteredVideoModels = isVideo? videoModels.filter(m => videoSubTab === 'i2v' ? isI2VModel(m.name) : !isI2VModel(m.name)): videoModels- const models = isVideo ? filteredVideoModels : imageModels+ const models = isVideo ? filteredVideoModels : imageModels // i2i also uses imageModels// Auto-select first model in filtered list when switching video sub-tabsuseEffect(() => {@@ -125,6 +127,34 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLis</div>)}+ {/* Image Sub-Tabs: Text to Image / Image to Image */}+ {!isVideo && (+ <div className="flex rounded-lg bg-gray-100 dark:bg-white/5 p-0.5 gap-0.5">+ <button+ onClick={() => store.setImageSubMode('text2img')}+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md text-[10px] font-medium transition-all ${+ store.imageSubMode === 'text2img'+ ? 'bg-white dark:bg-white/15 text-gray-900 dark:text-white shadow-sm'+ : 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'+ }`}+ >+ <ImageIcon size={11} />+ Text to Image+ </button>+ <button+ onClick={() => store.setImageSubMode('img2img')}+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md text-[10px] font-medium transition-all ${+ store.imageSubMode === 'img2img'+ ? 'bg-white dark:bg-white/15 text-gray-900 dark:text-white shadow-sm'+ : 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'+ }`}+ >+ <ImagePlus size={11} />+ Image to Image+ </button>+ </div>+ )}+{/* Model */}<div><label className={lbl}>{isVideo ? (videoSubTab === 'i2v' ? 'I2V Model' : 'Video Model') : 'Image Model'}</label>@@ -181,11 +211,16 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLis<SliderControl label="CFG" value={store.cfgScale} min={0} max={30} step={0.5} onChange={store.setCfgScale} /></div>- {/* Batch Size */}- {!isVideo && (+ {/* Batch Size (not for I2I) */}+ {!isVideo && !isI2I && (<SliderControl label="Batch" value={store.batchSize} min={1} max={4} step={1} onChange={store.setBatchSize} />)}+ {/* Denoise Strength (I2I only) */}+ {isI2I && (+ <SliderControl label="Denoise" value={store.denoise} min={0.05} max={1.0} step={0.05} onChange={store.setDenoise} />+ )}+{/* Size */}<div><label className={lbl}>Size ({store.width}x{store.height})</label>diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.tsindex 31ce29c4..67eaf5d1 100644--- a/src/hooks/useCreate.ts+++ b/src/hooks/useCreate.ts@@ -135,10 +135,12 @@ export function useCreate() {const state = useCreateStore.getState()const {mode, prompt, negativePrompt, imageModel, videoModel,- sampler, scheduler, steps, cfgScale, width, height, seed, batchSize, frames, fps, i2vImage,+ sampler, scheduler, steps, cfgScale, width, height, seed, batchSize, frames, fps, denoise, i2iImage, i2vImage,setIsGenerating, setProgress, setCurrentPromptId, setError, addToGallery, addToPromptHistory,} = state+ const isI2I = mode === 'image' && state.imageSubMode === 'img2img'+setError(null)const activeModel = mode === 'image' ? imageModel : videoModel// Always re-classify from model name to avoid stale type@@ -148,6 +150,10 @@ export function useCreate() {setError('Please enter a prompt.')return}+ if (isI2I && !i2iImage) {+ setError('Please upload a source image for Image-to-Image.')+ return+ }if (!activeModel) {setError(mode === 'image'? 'No image model selected. Add checkpoints or FLUX models to ComfyUI.'@@ -166,7 +172,10 @@ export function useCreate() {abortRef.current = new AbortController()try {- const baseParams = { prompt, negativePrompt, model: activeModel, sampler, scheduler, steps, cfgScale, width, height, seed, batchSize }+ const baseParams = {+ prompt, negativePrompt, model: activeModel, sampler, scheduler, steps, cfgScale, width, height, seed, batchSize,+ ...(isI2I && i2iImage ? { inputImage: i2iImage, denoise } : {}),+ }let workflow: Record<string, any>let builderUsed: 'dynamic' | 'legacy' | 'custom' = 'dynamic'@@ -175,7 +184,7 @@ export function useCreate() {let customWf = useWorkflowStore.getState().getWorkflowForModel(activeModel, imageModelType)if (customWf) {const wfNodes = Object.values(customWf.workflow).map((n: any) => n.class_type)- const needsUnet = imageModelType === 'flux' || imageModelType === 'flux2' || imageModelType === 'wan' || imageModelType === 'hunyuan'+ const needsUnet = imageModelType === 'flux' || imageModelType === 'flux2' || imageModelType === 'zimage' || imageModelType === 'wan' || imageModelType === 'hunyuan'const hasUnet = wfNodes.includes('UNETLoader')const hasCheckpoint = wfNodes.includes('CheckpointLoaderSimple')if (needsUnet && !hasUnet && hasCheckpoint) {diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex db7b667f..c9ae6ca5 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -3,7 +3,7 @@ import { persist } from 'zustand/middleware'import type { ModelType } from '../api/comfyui'import { classifyModel } from '../api/comfyui'import type { PreflightError } from '../api/preflight'-// ModelType includes: flux, flux2, sdxl, sd15, wan, hunyuan, unknown+// ModelType includes: flux, flux2, zimage, sdxl, sd15, wan, hunyuan, unknownexport type ProgressPhase = 'idle' | 'queued' | 'loading-model' | 'loading-clip' | 'loading-vae' | 'sampling' | 'decoding' | 'complete'@@ -17,6 +17,7 @@ export const MODEL_TYPE_DEFAULTS: Record<ModelType, {sdxl: { steps: 25, cfgScale: 7.0, sampler: 'dpmpp_2m', scheduler: 'karras', width: 1024, height: 1024 },flux: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },flux2: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },+ zimage: { steps: 12, cfgScale: 3.5, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },wan: { steps: 25, cfgScale: 5.0, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 49, fps: 16 },hunyuan: { steps: 30, cfgScale: 6.0, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 45, fps: 15 },ltx: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 768, height: 512, frames: 97, fps: 24 },@@ -48,6 +49,7 @@ export interface GalleryItem {interface CreateState {mode: 'image' | 'video'+ imageSubMode: 'text2img' | 'img2img'prompt: stringnegativePrompt: stringimageModel: string@@ -63,6 +65,8 @@ interface CreateState {batchSize: numberframes: numberfps: number+ denoise: number // Denoise strength for I2I (0.0–1.0)+ i2iImage: string | null // Uploaded image filename for I2Ii2vImage: string | null // Uploaded image filename for I2V models (SVD, FramePack)isGenerating: booleanprogress: number@@ -79,6 +83,7 @@ interface CreateState {setPreflightStatus: (ready: boolean | null, errors: PreflightError[], warnings: string[]) => voidsetMode: (mode: 'image' | 'video') => void+ setImageSubMode: (subMode: 'text2img' | 'img2img') => voidsetPrompt: (prompt: string) => voidsetNegativePrompt: (negativePrompt: string) => voidsetImageModel: (model: string, type: ModelType) => void@@ -92,6 +97,8 @@ interface CreateState {setBatchSize: (batchSize: number) => voidsetFrames: (frames: number) => voidsetFps: (fps: number) => void+ setDenoise: (denoise: number) => void+ setI2iImage: (image: string | null) => voidsetI2vImage: (image: string | null) => voidsetIsGenerating: (generating: boolean) => voidsetProgress: (progress: number, text?: string) => void@@ -109,6 +116,7 @@ export const useCreateStore = create<CreateState>()(persist((set) => ({mode: 'image',+ imageSubMode: 'text2img' as 'text2img' | 'img2img',prompt: '',negativePrompt: '',imageModel: '',@@ -124,6 +132,8 @@ export const useCreateStore = create<CreateState>()(batchSize: 1,frames: 24,fps: 8,+ denoise: 0.7,+ i2iImage: null,i2vImage: null,isGenerating: false,progress: 0,@@ -165,6 +175,7 @@ export const useCreateStore = create<CreateState>()(}return { mode }}),+ setImageSubMode: (subMode) => set({ imageSubMode: subMode }),setPrompt: (prompt) => set({ prompt }),setNegativePrompt: (negativePrompt) => set({ negativePrompt }),setImageModel: (model, type) => {@@ -200,6 +211,8 @@ export const useCreateStore = create<CreateState>()(setBatchSize: (batchSize) => set({ batchSize: Math.max(1, Math.min(8, Math.floor(batchSize))) }),setFrames: (frames) => set({ frames: Math.max(1, Math.min(120, Math.floor(frames))) }),setFps: (fps) => set({ fps: Math.max(1, Math.min(60, Math.floor(fps))) }),+ setDenoise: (denoise) => set({ denoise: Math.max(0, Math.min(1, denoise)) }),+ setI2iImage: (image) => set({ i2iImage: image }),setI2vImage: (image) => set({ i2vImage: image }),setIsGenerating: (generating) => set({ isGenerating: generating, ...(generating ? {} : { progressPhase: 'idle' as ProgressPhase }) }),setProgress: (progress, text) => set({ progress, progressText: text ?? '' }),@@ -231,9 +244,19 @@ export const useCreateStore = create<CreateState>()(batchSize: state.batchSize,frames: state.frames,fps: state.fps,+ denoise: state.denoise,gallery: state.gallery,promptHistory: state.promptHistory,}),+ // Migrate old 'i2i' mode to imageSubMode (v2.3.0 refactor)+ merge: (persisted: any, current: any) => {+ const merged = { ...current, ...persisted }+ if (merged.mode === 'i2i') {+ merged.mode = 'image'+ merged.imageSubMode = 'img2img'+ }+ return merged+ },}))