Skip to content

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.

feat(create): local render builders, model catalog and routing

purpleeb63eaf10f33
diff --git a/src/api/__tests__/comfyui-bundles.test.ts b/src/api/__tests__/comfyui-bundles.test.ts
index 01467f77..0be043e5 100644
--- a/src/api/__tests__/comfyui-bundles.test.ts
+++ b/src/api/__tests__/comfyui-bundles.test.ts
@@ -1,5 +1,8 @@
import { describe, it, expect, beforeAll } from 'vitest'
-import { getVideoBundles, CUSTOM_NODE_REGISTRY, type ModelBundle } from '../discover'
+import {
+ getVideoBundles, getAudioBundles, getLipsyncBundles, getMotionBundles,
+ CUSTOM_NODE_REGISTRY, type ModelBundle,
+} from '../discover'
describe('Video Bundle Definitions', () => {
let bundles: ModelBundle[]
@@ -8,10 +11,11 @@ describe('Video Bundle Definitions', () => {
bundles = getVideoBundles()
})
- it('has 14 video bundles', () => {
+ it('has 16 video bundles', () => {
// 14 original - Allegro (diffusers only) + CogVideoX 2B replaced by 5B I2V,
- // + Wan 2.2 TI2V-5B (unified T2V/I2V, 2026-06-11)
- expect(bundles.length).toBe(14)
+ // + Wan 2.2 TI2V-5B (unified T2V/I2V, 2026-06-11); 2.5.8 adds the two
+ // uncensored GGUF finetunes (NSFW Wan 14B t2v + Wan 2.2 Rapid AIO i2v).
+ expect(bundles.length).toBe(16)
})
it('every bundle has required fields', () => {
@@ -66,11 +70,13 @@ describe('Video Bundle Definitions', () => {
it('I2V bundles have i2v: true', () => {
const i2vBundles = bundles.filter(b => b.i2v)
- expect(i2vBundles.length).toBe(4) // SVD + FramePack + CogVideoX 5B I2V + Wan 2.2 TI2V-5B
+ // SVD + FramePack + CogVideoX 5B I2V + Wan 2.2 TI2V-5B + Rapid AIO (2.5.8)
+ expect(i2vBundles.length).toBe(5)
const i2vNames = i2vBundles.map(b => b.name)
expect(i2vNames.some(n => n.includes('SVD'))).toBe(true)
expect(i2vNames.some(n => n.includes('FramePack'))).toBe(true)
expect(i2vNames.some(n => n.includes('Wan 2.2'))).toBe(true)
+ expect(i2vNames.some(n => n.includes('Rapid AIO'))).toBe(true)
})
it('LTX bundle has workflow "ltx" not "wan"', () => {
@@ -107,12 +113,27 @@ describe('Custom Node Registry', () => {
expect(new Set(repos).size).toBe(repos.length)
})
- it('has 7 custom node entries', () => {
+ it('has 9 custom node entries', () => {
// v2.4.5 added 'videohelpersuite' for Bug A (MP4 video output); v2.5.7 added
- // 'rmbg' for the Remove-Background cutout. When this registry grows again,
- // bump the number AND add a smoke test below for the new entry so future
- // drift is loud.
- expect(Object.keys(CUSTOM_NODE_REGISTRY).length).toBe(7)
+ // 'rmbg' for the Remove-Background cutout; 2.5.8 adds 'gguf' (quant loader
+ // for the 14B lanes) and 'controlnet-aux' (DWPose for Motion Control).
+ // When this registry grows again, bump the number AND add a smoke test
+ // below for the new entry so future drift is loud.
+ expect(Object.keys(CUSTOM_NODE_REGISTRY).length).toBe(9)
+ })
+
+ it('gguf entry routes to city96 upstream and requires the GGUF loader', () => {
+ const entry = CUSTOM_NODE_REGISTRY['gguf']
+ expect(entry).toBeTruthy()
+ expect(entry.repo).toBe('https://github.com/city96/ComfyUI-GGUF')
+ expect(entry.requiredNodes).toContain('UnetLoaderGGUF')
+ })
+
+ it('controlnet-aux entry routes to Fannovel16 upstream and requires DWPose', () => {
+ const entry = CUSTOM_NODE_REGISTRY['controlnet-aux']
+ expect(entry).toBeTruthy()
+ expect(entry.repo).toBe('https://github.com/Fannovel16/comfyui_controlnet_aux')
+ expect(entry.requiredNodes).toContain('DWPreprocessor')
})
it('videohelpersuite entry routes to Kosinkadink upstream', () => {
@@ -130,6 +151,53 @@ describe('Custom Node Registry', () => {
})
})
+describe('2.5.8 specialized lane bundles (music / lipsync / motion)', () => {
+ const laneBundles = () => [...getAudioBundles(), ...getLipsyncBundles(), ...getMotionBundles()]
+
+ it('every lane bundle is complete and https', () => {
+ const all = laneBundles()
+ expect(all.length).toBe(6) // 2 music + 2 lipsync + 2 motion
+ for (const b of all) {
+ expect(b.name).toBeTruthy()
+ expect(b.totalSizeGB).toBeGreaterThan(0)
+ expect(b.vramRequired).toBeTruthy()
+ expect(b.files.length).toBeGreaterThan(0)
+ for (const f of b.files) {
+ expect(f.downloadUrl).toMatch(/^https:\/\//)
+ expect(f.filename).toBeTruthy()
+ expect(['checkpoints', 'diffusion_models', 'text_encoders', 'vae', 'audio_encoders']).toContain(f.subfolder)
+ }
+ }
+ })
+
+ it('music bundles are single-file ACE checkpoints', () => {
+ for (const b of getAudioBundles()) {
+ expect(b.workflow).toBe('ace')
+ expect(b.files.length).toBe(1)
+ expect(b.files[0].subfolder).toBe('checkpoints')
+ }
+ })
+
+ it('lipsync bundles carry the wav2vec2 audio encoder', () => {
+ for (const b of getLipsyncBundles()) {
+ expect(b.files.some((f) => f.subfolder === 'audio_encoders')).toBe(true)
+ }
+ })
+
+ it('gguf lane bundles request the gguf node pack', () => {
+ for (const b of laneBundles()) {
+ const hasGguf = b.files.some((f) => f.filename.toLowerCase().endsWith('.gguf'))
+ if (hasGguf) expect(b.customNodes).toContain('gguf')
+ }
+ })
+
+ it('motion bundles request the pose extractor pack', () => {
+ for (const b of getMotionBundles()) {
+ expect(b.customNodes).toContain('controlnet-aux')
+ }
+ })
+})
+
describe('Shared File Deduplication', () => {
let bundles: ModelBundle[]
diff --git a/src/api/__tests__/local-op-workflows.test.ts b/src/api/__tests__/local-op-workflows.test.ts
new file mode 100644
index 00000000..ebb98480
--- /dev/null
+++ b/src/api/__tests__/local-op-workflows.test.ts
@@ -0,0 +1,206 @@
+// 2.5.8 specialized local lanes: pure-graph tests for the music / talking
+// character / motion builders plus the classification + gallery-type helpers
+// they lean on. allNodes is mocked as a plain presence map — exactly what
+// getAllNodeInfo() feeds the builders at runtime.
+
+import { describe, it, expect } from 'vitest'
+import {
+ buildMusicWorkflow,
+ buildS2VWorkflow,
+ buildMotionWorkflow,
+ WorkflowUnavailableError,
+ type LocalOpParams,
+} from '../dynamic-workflow'
+import { classifyModel, galleryTypeForFile, resolveLocalOpPick, type ClassifiedModel } from '../comfyui'
+
+const FULL_NODES: Record<string, any> = Object.fromEntries(
+ [
+ 'TextEncodeAceStepAudio', 'EmptyAceStepLatentAudio',
+ 'TextEncodeAceStepAudio1.5', 'EmptyAceStep1.5LatentAudio',
+ 'VAEDecodeAudio', 'SaveAudioMP3', 'LoadAudio', 'ConditioningZeroOut',
+ 'AudioEncoderLoader', 'AudioEncoderEncode', 'WanSoundImageToVideo',
+ 'WanAnimateToVideo', 'WanVaceToVideo', 'TrimVideoLatent',
+ 'LoadVideo', 'GetVideoComponents', 'CreateVideo', 'SaveVideo',
+ 'DWPreprocessor', 'UnetLoaderGGUF', 'UNETLoader', 'CLIPLoader',
+ 'VAELoader', 'CLIPTextEncode', 'KSampler', 'VAEDecode',
+ 'ModelSamplingSD3', 'LoadImage', 'ImageScale',
+ ].map((n) => [n, {}]),
+)
+
+const nodesWithout = (...names: string[]) => {
+ const copy = { ...FULL_NODES }
+ for (const n of names) delete copy[n]
+ return copy
+}
+
+const classTypes = (wf: Record<string, any>) => Object.values(wf).map((n: any) => n.class_type)
+
+const baseParams = (over: Partial<LocalOpParams>): LocalOpParams => ({
+ op: 'music',
+ model: 'ace_step_v1_3.5b.safetensors',
+ prompt: 'dreamy lofi',
+ negativePrompt: '',
+ seed: 7, steps: 20, cfgScale: 5, sampler: 'euler', scheduler: 'simple',
+ width: 832, height: 480, frames: 77, fps: 16,
+ ...over,
+})
+
+describe('lane model classification', () => {
+ it('routes the specialized families before the generic wan/ace matches', () => {
+ expect(classifyModel('wan2.1_vace_1.3B_fp16.safetensors')).toBe('wanvace')
+ expect(classifyModel('Wan2.2-S2V-14B-Q4_K_M.gguf')).toBe('wans2v')
+ expect(classifyModel('wan2.2_s2v_14B_fp8_scaled.safetensors')).toBe('wans2v')
+ expect(classifyModel('Wan2.2-Animate-14B-Q4_K_M.gguf')).toBe('wananimate')
+ expect(classifyModel('ace_step_v1_3.5b.safetensors')).toBe('ace')
+ expect(classifyModel('ace_step_1.5_turbo_aio.safetensors')).toBe('ace')
+ })
+
+ it('rapid AIO merges are Wan 14B architecture, not the TI2V-5B path', () => {
+ expect(classifyModel('wan2.2-i2v-rapid-aio-v10-nsfw-Q4_K_M.gguf')).toBe('wan')
+ })
+
+ it('animatediff checkpoints never classify as wananimate', () => {
+ expect(classifyModel('wan_animatediff_motion.ckpt')).not.toBe('wananimate')
+ })
+})
+
+describe('galleryTypeForFile', () => {
+ it('audio extensions win regardless of render mode', () => {
+ expect(galleryTypeForFile('song_00001_.mp3', 'image')).toBe('audio')
+ expect(galleryTypeForFile('song.flac', 'video')).toBe('audio')
+ })
+ it('everything else keeps the mode (incl. the animated-webp fallback)', () => {
+ expect(galleryTypeForFile('a.png', 'image')).toBe('image')
+ expect(galleryTypeForFile('a.mp4', 'video')).toBe('video')
+ expect(galleryTypeForFile('a.webp', 'video')).toBe('video')
+ })
+})
+
+describe('resolveLocalOpPick', () => {
+ const list: ClassifiedModel[] = [
+ { name: 'ace_step_v1_3.5b.safetensors', type: 'ace', source: 'checkpoint' },
+ { name: 'ace_step_1.5_turbo_aio.safetensors', type: 'ace', source: 'checkpoint' },
+ ]
+ it('keeps a valid pick, coerces a stale one, empties on empty list', () => {
+ expect(resolveLocalOpPick('ace_step_1.5_turbo_aio.safetensors', list)).toBe('ace_step_1.5_turbo_aio.safetensors')
+ expect(resolveLocalOpPick('Wan2.2-S2V-14B-Q4_K_M.gguf', list)).toBe('ace_step_v1_3.5b.safetensors')
+ expect(resolveLocalOpPick('anything', [])).toBe('')
+ })
+})
+
+describe('buildMusicWorkflow', () => {
+ it('builds the v1 ACE graph (checkpoint, encode, latent, mp3 save)', () => {
+ const wf = buildMusicWorkflow(baseParams({ seconds: 45, lyrics: 'la la' }), 7, FULL_NODES)
+ const types = classTypes(wf)
+ expect(types).toContain('CheckpointLoaderSimple')
+ expect(types).toContain('TextEncodeAceStepAudio')
+ expect(types).toContain('EmptyAceStepLatentAudio')
+ expect(types).toContain('VAEDecodeAudio')
+ expect(types).toContain('SaveAudioMP3')
+ const latent = Object.values(wf).find((n: any) => n.class_type === 'EmptyAceStepLatentAudio') as any
+ expect(latent.inputs.seconds).toBe(45)
+ const enc = Object.values(wf).find((n: any) => n.class_type === 'TextEncodeAceStepAudio') as any
+ expect(enc.inputs.lyrics).toBe('la la')
+ })
+
+ it('routes ACE 1.5 checkpoints through the 1.5 node pair with a zeroed negative', () => {
+ const wf = buildMusicWorkflow(
+ baseParams({ model: 'ace_step_1.5_turbo_aio.safetensors', seconds: 60 }), 7, FULL_NODES)
+ const types = classTypes(wf)
+ expect(types).toContain('TextEncodeAceStepAudio1.5')
+ expect(types).toContain('EmptyAceStep1.5LatentAudio')
+ expect(types).toContain('ConditioningZeroOut')
+ expect(types).not.toContain('TextEncodeAceStepAudio')
+ })
+
+ it('REJECT-AND-REPORTs an old core with an update message', () => {
+ expect(() => buildMusicWorkflow(baseParams({}), 7, nodesWithout('TextEncodeAceStepAudio')))
+ .toThrowError(WorkflowUnavailableError)
+ try {
+ buildMusicWorkflow(baseParams({}), 7, nodesWithout('TextEncodeAceStepAudio'))
+ } catch (e) {
+ expect((e as Error).message).toMatch(/Update ComfyUI/)
+ }
+ })
+})
+
+describe('buildS2VWorkflow', () => {
+ const s2v = (over: Partial<LocalOpParams> = {}) => baseParams({
+ op: 'lipsync',
+ model: 'wan2.2_s2v_14B_fp8_scaled.safetensors',
+ audioFile: 'voice.mp3',
+ refImage: 'portrait.png',
+ ...over,
+ })
+
+ it('wires audio embeddings into the S2V conditioner and muxes the voice into the mp4', () => {
+ const wf = buildS2VWorkflow(s2v(), 7, FULL_NODES)
+ const types = classTypes(wf)
+ for (const t of ['LoadAudio', 'AudioEncoderLoader', 'AudioEncoderEncode', 'WanSoundImageToVideo', 'CreateVideo', 'SaveVideo']) {
+ expect(types).toContain(t)
+ }
+ const create = Object.values(wf).find((n: any) => n.class_type === 'CreateVideo') as any
+ expect(create.inputs.audio).toBeTruthy()
+ const s2vNode = Object.values(wf).find((n: any) => n.class_type === 'WanSoundImageToVideo') as any
+ // length stays on the 4k+1 grid
+ expect((s2vNode.inputs.length - 1) % 4).toBe(0)
+ })
+
+ it('loads .gguf quants through the GGUF pack and hints its install when missing', () => {
+ const wf = buildS2VWorkflow(s2v({ model: 'Wan2.2-S2V-14B-Q4_K_M.gguf' }), 7, FULL_NODES)
+ expect(classTypes(wf)).toContain('UnetLoaderGGUF')
+ try {
+ buildS2VWorkflow(s2v({ model: 'Wan2.2-S2V-14B-Q4_K_M.gguf' }), 7, nodesWithout('UnetLoaderGGUF'))
+ expect.unreachable('should have thrown')
+ } catch (e) {
+ expect(e).toBeInstanceOf(WorkflowUnavailableError)
+ expect((e as WorkflowUnavailableError).installHint?.pack).toBe('ComfyUI-GGUF')
+ }
+ })
+
+ it('rejects a missing voice or portrait before anything uploads', () => {
+ expect(() => buildS2VWorkflow(s2v({ audioFile: undefined }), 7, FULL_NODES)).toThrow(/voice/i)
+ expect(() => buildS2VWorkflow(s2v({ refImage: undefined }), 7, FULL_NODES)).toThrow(/portrait/i)
+ })
+})
+
+describe('buildMotionWorkflow', () => {
+ const motion = (over: Partial<LocalOpParams> = {}) => baseParams({
+ op: 'motion',
+ model: 'Wan2.2-Animate-14B-Q4_K_M.gguf',
+ drivingVideo: 'dance.mp4',
+ refImage: 'char.png',
+ ...over,
+ })
+
+ it('builds the Animate graph: DWPose skeleton in, trimmed latent out, driving audio carried over', () => {
+ const wf = buildMotionWorkflow(motion(), 7, FULL_NODES)
+ const types = classTypes(wf)
+ for (const t of ['LoadVideo', 'GetVideoComponents', 'DWPreprocessor', 'WanAnimateToVideo', 'TrimVideoLatent', 'CreateVideo']) {
+ expect(types).toContain(t)
+ }
+ const trim = Object.values(wf).find((n: any) => n.class_type === 'TrimVideoLatent') as any
+ expect(Array.isArray(trim.inputs.trim_amount)).toBe(true)
+ expect(trim.inputs.trim_amount[1]).toBe(3)
+ const create = Object.values(wf).find((n: any) => n.class_type === 'CreateVideo') as any
+ const components = Object.entries(wf).find(([, n]: [string, any]) => n.class_type === 'GetVideoComponents')![0]
+ expect(create.inputs.audio).toEqual([components, 1])
+ })
+
+ it('routes VACE models through WanVaceToVideo with the skeleton as control video', () => {
+ const wf = buildMotionWorkflow(motion({ model: 'wan2.1_vace_1.3B_fp16.safetensors' }), 7, FULL_NODES)
+ const types = classTypes(wf)
+ expect(types).toContain('WanVaceToVideo')
+ expect(types).not.toContain('WanAnimateToVideo')
+ })
+
+ it('hints the controlnet_aux install when DWPose is missing', () => {
+ try {
+ buildMotionWorkflow(motion(), 7, nodesWithout('DWPreprocessor'))
+ expect.unreachable('should have thrown')
+ } catch (e) {
+ expect(e).toBeInstanceOf(WorkflowUnavailableError)
+ expect((e as WorkflowUnavailableError).installHint?.pack).toBe('comfyui_controlnet_aux')
+ }
+ })
+})
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index bba8617d..e94c011e 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -118,7 +118,25 @@ export function extractComfyOutputFiles(nodeOutput: unknown): ComfyUIOutput[] {
return found
}
-export type ModelType = 'flux' | 'flux2' | 'zimage' | 'ernie_image' | 'sdxl' | 'sd15' | 'wan' | 'wan22' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'unknown'
+/** Gallery media type for a finished output file. The render mode alone
+ * mistagged audio outputs (SaveAudio & friends post .flac/.mp3/.wav) as
+ * image/video, so their tiles rendered as broken <img>/<video>. Only the
+ * audio axis is decided by extension — everything else keeps the mode, so
+ * the long-standing image/video tagging (incl. the animated-webp fallback)
+ * is untouched. */
+const AUDIO_OUTPUT_EXTS = new Set(['mp3', 'wav', 'flac', 'ogg', 'opus', 'm4a'])
+export function galleryTypeForFile(
+ filename: string,
+ mode: 'image' | 'video',
+): 'image' | 'video' | 'audio' {
+ const ext = (filename.split('.').pop() || '').toLowerCase()
+ return AUDIO_OUTPUT_EXTS.has(ext) ? 'audio' : mode
+}
+
+// 2.5.8: ace / wans2v / wananimate / wanvace are the specialized local-lane
+// architectures (music, talking character, motion control). They are neither
+// image nor video picker material — each lane has its own model list.
+export type ModelType = 'flux' | 'flux2' | 'zimage' | 'ernie_image' | 'sdxl' | 'sd15' | 'wan' | 'wan22' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'ace' | 'wans2v' | 'wananimate' | 'wanvace' | 'unknown'
export type VideoBackend = 'wan' | 'animatediff' | 'none'
export interface ClassifiedModel {
@@ -154,6 +172,18 @@ export function classifyModel(name: string | null | undefined): ModelType {
if (!name || typeof name !== 'string') return 'unknown'
const lower = name.toLowerCase()
+ // 2.5.8 specialized lanes — must beat the generic wan/ace substrings below.
+ // 'vace' before 'ace' (contains it), s2v/animate before the wan2.2 match
+ // (wan2.2_s2v / wan2.2_animate carry the wan2.2 tag too).
+ if (lower.includes('vace')) return 'wanvace'
+ if (lower.includes('s2v')) return 'wans2v'
+ if (lower.includes('animate') && lower.includes('wan') && !lower.includes('animatediff')) return 'wananimate'
+ if (lower.includes('ace_step') || lower.includes('ace-step') || lower.includes('acestep')) return 'ace'
+ // Merged 14B "rapid AIO" builds (e.g. wan2.2-i2v-rapid-aio) are Wan 14B
+ // architecture: classic WanImageToVideo graph + wan_2.1_vae — NOT the
+ // TI2V-5B path the wan2.2 tag would otherwise route them onto.
+ if (lower.includes('rapid') && lower.includes('aio')) return 'wan'
+
// Video models — most specific first (order matters: specific before generic)
if (lower.includes('cogvideo')) return 'cogvideo'
if (lower.includes('framepack')) return 'framepack'
@@ -230,6 +260,9 @@ export function isI2VModel(name: string): boolean {
*/
export function isT2VCapable(name: string): boolean {
const lower = name.toLowerCase()
+ // Merged i2v-only builds (rapid AIO) carry the wan2.2 tag but cannot run a
+ // T2V graph — check before the generic wan2.2 pass-through.
+ if (lower.includes('rapid') && lower.includes('i2v')) return false
if (lower.includes('ti2v') || lower.includes('wan2.2') || lower.includes('wan2_2') || lower.includes('wan22')) return true
if (lower.includes('svd') || lower.includes('framepack')) return false
if (lower.includes('video2world')) return false
@@ -281,6 +314,16 @@ export const MODEL_TYPE_DEFAULTS: Record<string, ModelTypeDefaults> = {
animatediff_lightning: { steps: 4, cfg: 1.0, sampler: 'euler', scheduler: 'sgm_uniform', width: 512, height: 512, frames: 16, fps: 8 },
// ERNIE-Image Turbo (Baidu 8B DiT)
ernie_image: { steps: 8, cfg: 1, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024, frames: 1, fps: 1 },
+ // ── 2.5.8 specialized local lanes (core-node defaults, July 2026) ──
+ // ACE-Step music: width/height are unused by the audio graph but keep the
+ // shared param scaffolding happy; track length lives in musicDuration.
+ ace: { steps: 50, cfg: 5.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024, frames: 1, fps: 1 },
+ // Wan 2.2 S2V — node defaults 832×480, length 77 @ 16 fps.
+ wans2v: { steps: 20, cfg: 6.0, sampler: 'euler', scheduler: 'simple', width: 832, height: 480, frames: 77, fps: 16 },
+ // Wan 2.2 Animate — node defaults 832×480, length 77 @ 16 fps.
+ wananimate: { steps: 20, cfg: 5.0, sampler: 'euler', scheduler: 'simple', width: 832, height: 480, frames: 77, fps: 16 },
+ // Wan 2.1 VACE — node defaults 832×480, length 81 @ 16 fps.
+ wanvace: { steps: 25, cfg: 5.0, sampler: 'euler', scheduler: 'simple', width: 832, height: 480, frames: 81, fps: 16 },
}
// ─── Component Requirements per model type ───
@@ -643,6 +686,70 @@ export async function getVideoModels(): Promise<ClassifiedModel[]> {
return result
}
+// ── 2.5.8 specialized local-lane model lists ─────────────────────────────────
+// Each lane owns its picker: an ACE checkpoint in the Image list (or a 14B S2V
+// in the Video list) would build a graph that ComfyUI rejects, so these
+// architectures are excluded from isImage/isVideo above and surfaced here.
+
+/** GGUF-quantized UNets (city96 ComfyUI-GGUF pack). Empty when the pack is not
+ * installed — callers merge these into their lane list and the builder swaps
+ * UNETLoader for UnetLoaderGGUF by extension. */
+export async function getGgufUnetModels(): Promise<string[]> {
+ try {
+ const res = await localFetch(comfyuiUrl('/object_info/UnetLoaderGGUF'), { timeoutMs: COMFY_LIST_TIMEOUT_MS })
+ if (!res.ok) return []
+ const data = await res.json()
+ return data?.UnetLoaderGGUF?.input?.required?.unet_name?.[0] ?? []
+ } catch {
+ return []
+ }
+}
+
+/** Music lane: ACE-Step all-in-one checkpoints (model + text encoder + VAE). */
+export async function getAudioModels(): Promise<ClassifiedModel[]> {
+ const checkpoints = await getCheckpoints()
+ const complete = await filterPartialFiles(checkpoints)
+ return checkpoints
+ .filter((name) => complete.has(name) && classifyModel(name) === 'ace')
+ .map((name) => ({ name, type: 'ace' as ModelType, source: 'checkpoint' as const }))
+}
+
+/** Talking-character lane: Wan 2.2 S2V UNets (safetensors via UNETLoader,
+ * .gguf via the GGUF pack when installed). */
+export async function getLipsyncModels(): Promise<ClassifiedModel[]> {
+ const [diffModels, ggufModels] = await Promise.all([getDiffusionModels(), getGgufUnetModels()])
+ const complete = await filterPartialFiles(diffModels)
+ const fromUnet = diffModels
+ .filter((name) => complete.has(name) && classifyModel(name) === 'wans2v')
+ .map((name) => ({ name, type: 'wans2v' as ModelType, source: 'diffusion_model' as const }))
+ const fromGguf = ggufModels
+ .filter((name) => classifyModel(name) === 'wans2v')
+ .map((name) => ({ name, type: 'wans2v' as ModelType, source: 'diffusion_model' as const }))
+ return [...fromUnet, ...fromGguf]
+}
+
+/** One rule for the specialized-lane picker AND submit: a pick that is not on
+ * the lane's list (stale cross-lane selection, deleted file) resolves to the
+ * list's first entry — the same guard the cloud op picker got after the
+ * take-01 wrong-trainer incident. */
+export function resolveLocalOpPick(picked: string, list: ClassifiedModel[]): string {
+ return list.some((m) => m.name === picked) ? picked : (list[0]?.name ?? '')
+}
+
+/** Motion-control lane: Wan 2.2 Animate UNets + Wan VACE UNets. */
+export async function getMotionModels(): Promise<ClassifiedModel[]> {
+ const [diffModels, ggufModels] = await Promise.all([getDiffusionModels(), getGgufUnetModels()])
+ const complete = await filterPartialFiles(diffModels)
+ const wanted = (t: ModelType) => t === 'wananimate' || t === 'wanvace'
+ const fromUnet = diffModels
+ .filter((name) => complete.has(name) && wanted(classifyModel(name)))
+ .map((name) => ({ name, type: classifyModel(name), source: 'diffusion_model' as const }))
+ const fromGguf = ggufModels
+ .filter((name) => wanted(classifyModel(name)))
+ .map((name) => ({ name, type: classifyModel(name), source: 'diffusion_model' as const }))
+ return [...fromUnet, ...fromGguf]
+}
+
// ─── Detect Video Backend (checks individual nodes + models — no full object_info fetch) ───
export async function detectVideoBackend(): Promise<VideoBackend> {
@@ -994,6 +1101,23 @@ export async function getHistory(promptId: string): Promise<any> {
}
}
+/** Is this prompt still alive inside ComfyUI (running or pending)? Used by
+ * the generation watchdog: a slow render that is still queued is progress,
+ * not a stall — only silence from BOTH the socket and the queue aborts.
+ * Queue entries are `[number, prompt_id, ...]` tuples. */
+export async function isPromptQueued(promptId: string): Promise<boolean> {
+ try {
+ const res = await localFetch(comfyuiUrl('/queue'), { timeoutMs: COMFY_POLL_TIMEOUT_MS })
+ if (!res.ok) return false
+ const q = await res.json()
+ const inList = (list: unknown) => Array.isArray(list)
+ && list.some((e) => Array.isArray(e) && e[1] === promptId)
+ return inList(q.queue_running) || inList(q.queue_pending)
+ } catch {
+ return false
+ }
+}
+
// ─── Upload image to ComfyUI (for I2V models like SVD, FramePack) ───
export async function uploadImage(file: File): Promise<string> {
@@ -1079,6 +1203,47 @@ export function ensureImageFilename(name: string | undefined, mime: string | und
return `${safeStem}.${ext}`
}
+/** Upload a NON-image media file (speech audio, driving video) into ComfyUI's
+ * input dir. Same /upload/image endpoint — it stores any file; LoadAudio /
+ * LoadVideo then list it by extension. The image uploader forces an image
+ * extension (PIL constraint), which would break these, so this variant keeps
+ * the file's own extension and only sanitizes the stem. */
+export async function uploadMediaFile(blob: Blob, name: string): Promise<string> {
+ if (!blob || blob.size === 0) {
+ throw new Error('Failed to upload media: the file is empty (0 bytes).')
+ }
+ const base = (name || '').replace(/^.*[\\/]/, '').trim() || 'lu_media'
+ const dot = base.lastIndexOf('.')
+ const stem = (dot > 0 ? base.slice(0, dot) : base).replace(/[^A-Za-z0-9._-]+/g, '_').slice(0, 64) || 'lu_media'
+ const ext = (dot > 0 ? base.slice(dot + 1) : '').replace(/[^A-Za-z0-9]+/g, '').toLowerCase() || 'bin'
+ const safeName = `${stem}.${ext}`
+
+ if (isTauri()) {
+ const bytes = Array.from(new Uint8Array(await blob.arrayBuffer()))
+ let body: string
+ try {
+ body = await backendCall<string>('comfy_upload_image', {
+ url: comfyuiUrl('/upload/image'),
+ filename: safeName,
+ contentType: blob.type || 'application/octet-stream',
+ fileBytes: bytes,
+ })
+ } catch (e) {
+ throw new Error(`Failed to upload media: ${e instanceof Error ? e.message : String(e)}`)
+ }
+ const data = JSON.parse(body)
+ return data.name
+ }
+
+ const formData = new FormData()
+ formData.append('image', blob, safeName)
+ formData.append('overwrite', 'true')
+ const res = await fetch(comfyuiUrl('/upload/image'), { method: 'POST', body: formData })
+ if (!res.ok) throw new Error(`Failed to upload media: HTTP ${res.status}`)
+ const data = await res.json()
+ return data.name
+}
+
export function getImageUrl(filename: string, subfolder: string = '', type: string = 'output', cacheBust?: string | number): string {
const path = `/view?filename=${encodeURIComponent(filename)}&subfolder=${encodeURIComponent(subfolder)}&type=${type}`
// A cache-buster is appended ONLY when an explicit, STABLE token is supplied
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 2a58b374..ade0958c 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -866,8 +866,8 @@ export async function startModelDownloadToPath(url: string, destDir: string, fil
/** Look up download URL + subfolder for a file by filename · searches all bundles + text models */
export function lookupFileMeta(filename: string): { url: string; subfolder: string } | null {
- // Search image + video bundles
- for (const bundle of [...getImageBundles(), ...getVideoBundles()]) {
+ // Search image + video + 2.5.8 specialized-lane bundles
+ for (const bundle of [...getImageBundles(), ...getVideoBundles(), ...getAudioBundles(), ...getLipsyncBundles(), ...getMotionBundles()]) {
for (const f of bundle.files) {
if (f.filename === filename && f.downloadUrl && f.subfolder) {
return { url: f.downloadUrl, subfolder: f.subfolder }
@@ -1322,6 +1322,24 @@ export const CUSTOM_NODE_REGISTRY: Record<string, { repo: string; name: string;
name: 'ComfyUI-RMBG',
requiredNodes: ['RMBG'],
},
+ // GGUF quant loader (city96). Lets the 2.5.8 lanes offer Q4 quants of the
+ // 14B Wan models (S2V / Animate / NSFW finetunes) — the difference between
+ // "needs 16 GB on disk and heavy offload" and "runs comfortably on 12 GB".
+ // requirements.txt is just the gguf package, no exotic wheels.
+ 'gguf': {
+ repo: 'https://github.com/city96/ComfyUI-GGUF',
+ name: 'ComfyUI-GGUF',
+ requiredNodes: ['UnetLoaderGGUF'],
+ },
+ // Pose extraction for the local Motion Control lane (DWPose skeletons feed
+ // WanAnimateToVideo / WanVaceToVideo). Its requirements pull the CPU
+ // onnxruntime wheel — works on every Windows box, no GPU wheel roulette;
+ // the DWPose onnx models auto-download on first run.
+ 'controlnet-aux': {
+ repo: 'https://github.com/Fannovel16/comfyui_controlnet_aux',
+ name: 'comfyui_controlnet_aux',
+ requiredNodes: ['DWPreprocessor'],
+ },
}
export interface ModelBundle {
@@ -1799,6 +1817,253 @@ export function getVideoBundles(): ModelBundle[] {
},
],
},
+ {
+ name: 'NSFW Wan 14B (Uncensored, GGUF)',
+ description: 'Full uncensored finetune of Wan 2.1 14B. Text to video, motion trained in, no helper LoRA needed.',
+ tags: ['Wan 2.1', 'Uncensored', 'GGUF', '480p'],
+ uncensored: true,
+ totalSizeGB: 15.5,
+ vramRequired: '10-12 GB',
+ workflow: 'wan',
+ customNodes: ['gguf'],
+ url: 'https://huggingface.co/NSFW-API/NSFW_Wan_14b',
+ files: [
+ {
+ name: 'NSFW Wan 14B Q4 (GGUF)',
+ description: 'The finetuned video model, final e15 epoch, Q4 quant.',
+ pulls: '', tags: ['Model', '9 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/NSFW-API/NSFW_Wan_14b/resolve/main/nsfw_wan_14b_e15_q4_k.gguf',
+ filename: 'nsfw_wan_14b_e15_q4_k.gguf', subfolder: 'diffusion_models', sizeGB: 9.0,
+ },
+ {
+ name: 'Wan 2.1 VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '250 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors',
+ filename: 'wan_2.1_vae.safetensors', subfolder: 'vae', sizeGB: 0.24,
+ },
+ {
+ name: 'Wan CLIP (UMT5-XXL FP8)',
+ description: 'Required text encoder.',
+ pulls: '', tags: ['CLIP', '6.3 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors',
+ filename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders', sizeGB: 6.27,
+ },
+ ],
+ },
+ {
+ name: 'Wan 2.2 Rapid AIO (Uncensored I2V, GGUF)',
+ description: 'Uncensored Wan 2.2 image to video, lightning merged for few step renders. Great for Animate and Extend.',
+ tags: ['Wan 2.2', 'Uncensored', 'I2V', 'GGUF', 'Fast'],
+ uncensored: true,
+ i2v: true,
+ totalSizeGB: 16.6,
+ vramRequired: '10-12 GB',
+ workflow: 'wan',
+ customNodes: ['gguf'],
+ url: 'https://huggingface.co/desirel/WAN2.2-14B-Rapid-AllInOne-GGUF-NSFW-v10',
+ files: [
+ {
+ name: 'Wan 2.2 Rapid AIO v10 Q4 (GGUF)',
+ description: 'The merged uncensored i2v model, Q4 quant.',
+ pulls: '', tags: ['Model', '10.1 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/desirel/WAN2.2-14B-Rapid-AllInOne-GGUF-NSFW-v10/resolve/main/wan2.2-i2v-rapid-aio-v10-nsfw-Q4_K_M.gguf',
+ filename: 'wan2.2-i2v-rapid-aio-v10-nsfw-Q4_K_M.gguf', subfolder: 'diffusion_models', sizeGB: 10.1,
+ },
+ {
+ name: 'Wan 2.1 VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '250 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors',
+ filename: 'wan_2.1_vae.safetensors', subfolder: 'vae', sizeGB: 0.24,
+ },
+ {
+ name: 'Wan CLIP (UMT5-XXL FP8)',
+ description: 'Required text encoder.',
+ pulls: '', tags: ['CLIP', '6.3 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors',
+ filename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders', sizeGB: 6.27,
+ },
+ ],
+ },
+ ]
+}
+
+// ─── 2.5.8 specialized local-lane bundles (music / talking character / motion) ───
+//
+// Every URL below was HEAD-verified against HuggingFace on 2026-07-18 (status
+// 200 + content-length; sizes in GiB from the actual response). Music and
+// talking character have no censored/uncensored axis — local rendering runs
+// unfiltered by nature, so no red badge games; the honest split lives in the
+// video list above (real uncensored finetunes) instead.
+
+export function getAudioBundles(): ModelBundle[] {
+ return [
+ {
+ name: 'ACE Step 1.5 Turbo (Music)',
+ description: 'Newest full song generator, MIT licensed. Vocals, lyrics and instruments from a text description. One file.',
+ tags: ['Music', 'Vocals', 'MIT'],
+ totalSizeGB: 9.4,
+ vramRequired: '6-8 GB',
+ workflow: 'ace',
+ url: 'https://huggingface.co/Comfy-Org/ace_step_1.5_ComfyUI_files',
+ files: [
+ {
+ name: 'ACE Step 1.5 Turbo (all in one)',
+ description: 'Complete music model. Includes its text encoder and audio VAE.',
+ pulls: '', tags: ['Checkpoint', '9.3 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/ace_step_1.5_ComfyUI_files/resolve/main/checkpoints/ace_step_1.5_turbo_aio.safetensors',
+ filename: 'ace_step_1.5_turbo_aio.safetensors', subfolder: 'checkpoints', sizeGB: 9.34,
+ },
+ ],
+ },
+ {
+ name: 'ACE Step v1 3.5B (Music, lighter)',
+ description: 'The proven full song generator. Smaller download, runs from 4 GB VRAM.',
+ tags: ['Music', 'Vocals', 'Light'],
+ totalSizeGB: 7.2,
+ vramRequired: '4-6 GB',
+ workflow: 'ace',
+ url: 'https://huggingface.co/Comfy-Org/ACE-Step_ComfyUI_repackaged',
+ files: [
+ {
+ name: 'ACE Step v1 3.5B (all in one)',
+ description: 'Complete music model. Includes its text encoder and audio VAE.',
+ pulls: '', tags: ['Checkpoint', '7.2 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/ACE-Step_ComfyUI_repackaged/resolve/main/all_in_one/ace_step_v1_3.5b.safetensors',
+ filename: 'ace_step_v1_3.5b.safetensors', subfolder: 'checkpoints', sizeGB: 7.17,
+ },
+ ],
+ },
+ ]
+}
+
+export function getLipsyncBundles(): ModelBundle[] {
+ // Shared support files for the S2V graph (text encoder, VAE, audio encoder).
+ const s2vSupport: DiscoverModel[] = [
+ {
+ name: 'Wan CLIP (UMT5-XXL FP8)',
+ description: 'Required text encoder.',
+ pulls: '', tags: ['CLIP', '6.3 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors',
+ filename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders', sizeGB: 6.27,
+ },
+ {
+ name: 'Wan 2.1 VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '250 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors',
+ filename: 'wan_2.1_vae.safetensors', subfolder: 'vae', sizeGB: 0.24,
+ },
+ {
+ name: 'Wav2Vec2 Audio Encoder',
+ description: 'Turns the speech audio into the embeddings the model lip reads from.',
+ pulls: '', tags: ['Audio Encoder', '600 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/audio_encoders/wav2vec2_large_english_fp16.safetensors',
+ filename: 'wav2vec2_large_english_fp16.safetensors', subfolder: 'audio_encoders', sizeGB: 0.59,
+ },
+ ]
+ return [
+ {
+ name: 'Wan 2.2 S2V Q4 (Talking Character, GGUF)',
+ description: 'A portrait plus any voice becomes a talking video. Q4 quant, the comfortable pick for 12 GB cards.',
+ tags: ['Wan 2.2', 'S2V', 'GGUF'],
+ totalSizeGB: 20.0,
+ vramRequired: '10-12 GB',
+ workflow: 'wans2v',
+ customNodes: ['gguf'],
+ url: 'https://huggingface.co/QuantStack/Wan2.2-S2V-14B-GGUF',
+ files: [
+ {
+ name: 'Wan 2.2 S2V 14B Q4 (GGUF)',
+ description: 'The sound to video model, Q4 quant.',
+ pulls: '', tags: ['Model', '12.9 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/QuantStack/Wan2.2-S2V-14B-GGUF/resolve/main/Wan2.2-S2V-14B-Q4_K_M.gguf',
+ filename: 'Wan2.2-S2V-14B-Q4_K_M.gguf', subfolder: 'diffusion_models', sizeGB: 12.91,
+ },
+ ...s2vSupport,
+ ],
+ },
+ {
+ name: 'Wan 2.2 S2V FP8 (Talking Character)',
+ description: 'The full precision friendly variant. Bigger file; offloads below 16 GB VRAM, so renders take longer there.',
+ tags: ['Wan 2.2', 'S2V', 'FP8'],
+ totalSizeGB: 22.4,
+ vramRequired: '16 GB best, offloads on less',
+ workflow: 'wans2v',
+ url: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged',
+ files: [
+ {
+ name: 'Wan 2.2 S2V 14B (FP8)',
+ description: 'The sound to video model.',
+ pulls: '', tags: ['Model', '15.3 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/diffusion_models/wan2.2_s2v_14B_fp8_scaled.safetensors',
+ filename: 'wan2.2_s2v_14B_fp8_scaled.safetensors', subfolder: 'diffusion_models', sizeGB: 15.27,
+ },
+ ...s2vSupport,
+ ],
+ },
+ ]
+}
+
+export function getMotionBundles(): ModelBundle[] {
+ const wanSupport: DiscoverModel[] = [
+ {
+ name: 'Wan CLIP (UMT5-XXL FP8)',
+ description: 'Required text encoder.',
+ pulls: '', tags: ['CLIP', '6.3 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors',
+ filename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders', sizeGB: 6.27,
+ },
+ {
+ name: 'Wan 2.1 VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '250 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors',
+ filename: 'wan_2.1_vae.safetensors', subfolder: 'vae', sizeGB: 0.24,
+ },
+ ]
+ return [
+ {
+ name: 'Wan VACE 1.3B (Motion Control, light)',
+ description: 'Your character copies the moves from any dance or pose video. The light pick, runs from 8 GB VRAM.',
+ tags: ['VACE', 'Motion', 'Light'],
+ totalSizeGB: 10.5,
+ vramRequired: '8-10 GB',
+ workflow: 'wanvace',
+ customNodes: ['controlnet-aux'],
+ url: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged',
+ files: [
+ {
+ name: 'Wan 2.1 VACE 1.3B',
+ description: 'The motion control model.',
+ pulls: '', tags: ['Model', '4 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/diffusion_models/wan2.1_vace_1.3B_fp16.safetensors',
+ filename: 'wan2.1_vace_1.3B_fp16.safetensors', subfolder: 'diffusion_models', sizeGB: 4.01,
+ },
+ ...wanSupport,
+ ],
+ },
+ {
+ name: 'Wan 2.2 Animate Q4 (Motion Control, GGUF)',
+ description: 'The bigger, better motion transfer model. Q4 quant for 12 GB cards.',
+ tags: ['Wan 2.2', 'Animate', 'GGUF'],
+ totalSizeGB: 17.3,
+ vramRequired: '10-12 GB',
+ workflow: 'wananimate',
+ customNodes: ['gguf', 'controlnet-aux'],
+ url: 'https://huggingface.co/QuantStack/Wan2.2-Animate-14B-GGUF',
+ files: [
+ {
+ name: 'Wan 2.2 Animate 14B Q4 (GGUF)',
+ description: 'The motion transfer model, Q4 quant.',
+ pulls: '', tags: ['Model', '10.7 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/QuantStack/Wan2.2-Animate-14B-GGUF/resolve/main/Wan2.2-Animate-14B-Q4_K_M.gguf',
+ filename: 'Wan2.2-Animate-14B-Q4_K_M.gguf', subfolder: 'diffusion_models', sizeGB: 10.71,
+ },
+ ...wanSupport,
+ ],
+ },
]
}
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index f2e60961..1f44ffe0 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -1236,6 +1236,352 @@ function buildWan22Workflow(params: VideoParams, seed: number, nodes: Categorize
return workflow
}
+// ─── 2.5.8 specialized local lanes (music / talking character / motion) ─────
+//
+// These intents run on node families that ship with CURRENT ComfyUI cores
+// (ACE audio, Wan 2.2 S2V, Wan 2.2 Animate, Wan VACE — verified against the
+// July 2026 core). Every builder gates on live node presence and throws
+// WorkflowUnavailableError with an "Update ComfyUI" message when the install
+// predates the family — REJECT-AND-REPORT, never a broken graph.
+
+export interface LocalOpParams {
+ op: 'music' | 'lipsync' | 'motion'
+ model: string
+ prompt: string
+ negativePrompt?: string
+ seed: number
+ steps: number
+ cfgScale: number
+ sampler: string
+ scheduler: string
+ width: number
+ height: number
+ frames: number
+ fps: number
+ /** music: track length in seconds + optional lyrics. */
+ seconds?: number
+ lyrics?: string
+ /** lipsync: speech audio staged in ComfyUI's input dir + the portrait. */
+ audioFile?: string
+ refImage?: string
+ /** motion: driving video staged in ComfyUI's input dir. */
+ drivingVideo?: string
+}
+
+const UPDATE_COMFY_HINT =
+ 'Update ComfyUI (Settings, AI Backends, Update ComfyUI), restart it, then generate again.'
+
+function requireNodes(allNodes: Record<string, any>, needed: string[], lane: string): void {
+ const missing = needed.filter((n) => !allNodes[n])
+ if (missing.length > 0) {
+ throw new WorkflowUnavailableError(
+ `${lane} needs ComfyUI nodes this install does not have yet (${missing.join(', ')}). ${UPDATE_COMFY_HINT}`,
+ 'unavailable',
+ )
+ }
+}
+
+/** UNET loader that understands GGUF quants: .gguf files load through the
+ * city96 GGUF pack's UnetLoaderGGUF, everything else through core UNETLoader. */
+function addUnetLoader(workflow: Record<string, any>, id: string, model: string, allNodes: Record<string, any>): void {
+ if (model.toLowerCase().endsWith('.gguf')) {
+ if (!allNodes['UnetLoaderGGUF']) {
+ throw new WorkflowUnavailableError(
+ 'This model is a GGUF quant, which needs the ComfyUI-GGUF node pack. Install it from the model card, or pick the safetensors variant.',
+ 'unavailable',
+ { pack: 'ComfyUI-GGUF', url: 'https://github.com/city96/ComfyUI-GGUF' },
+ )
+ }
+ workflow[id] = { class_type: 'UnetLoaderGGUF', inputs: { unet_name: model } }
+ } else {
+ workflow[id] = { class_type: 'UNETLoader', inputs: { unet_name: model, weight_dtype: 'default' } }
+ }
+}
+
+/** Sound-carrying video output: core CreateVideo muxes the audio track into
+ * the frames, SaveVideo writes an mp4. The talking-character / motion clips
+ * are pointless without their sound, so this path requires the core video
+ * nodes (same family as the lanes themselves — present on any core new
+ * enough to run them). */
+function addVideoWithAudioOutput(
+ workflow: Record<string, any>,
+ n: number,
+ decodeId: string,
+ fps: number,
+ audioSrc: [string, number] | null,
+ allNodes: Record<string, any>,
+ prompt?: string,
+): number {
+ requireNodes(allNodes, ['CreateVideo', 'SaveVideo'], 'This video output')
+ const createId = String(n++)
+ const inputs: Record<string, any> = { images: [decodeId, 0], fps }
+ if (audioSrc) inputs.audio = audioSrc
+ workflow[createId] = { class_type: 'CreateVideo', inputs }
+ const saveId = String(n++)
+ workflow[saveId] = {
+ class_type: 'SaveVideo',
+ inputs: { video: [createId, 0], filename_prefix: promptFilenamePrefix(prompt, true), format: 'auto', codec: 'auto' },
+ }
+ return n
+}
+
+/**
+ * Music (ACE-Step). All-in-one checkpoint → ACE text encode (tags + lyrics) →
+ * KSampler → VAEDecodeAudio → SaveAudioMP3. ACE-Step 1.5 checkpoints route
+ * through the 1.5 encoder/latent pair (different node ids AND different latent
+ * shape); everything else uses the v1 pair. Negative conditioning: v1 encodes
+ * the negative prompt (cheap), 1.5 zero-outs the positive instead — its
+ * encoder runs an LLM pass that would double the cost for no benefit.
+ */
+export function buildMusicWorkflow(params: LocalOpParams, seed: number, allNodes: Record<string, any>): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+ const isAce15 = /1[._-]?5/.test(params.model.toLowerCase().replace(/\.safetensors$/, '').replace(/^.*ace[_-]?step/, ''))
+ const encodeNode = isAce15 ? 'TextEncodeAceStepAudio1.5' : 'TextEncodeAceStepAudio'
+ const latentNode = isAce15 ? 'EmptyAceStep1.5LatentAudio' : 'EmptyAceStepLatentAudio'
+ requireNodes(allNodes, [encodeNode, latentNode, 'VAEDecodeAudio', 'SaveAudioMP3'], 'Local music')
+
+ const seconds = Math.max(5, Math.min(600, params.seconds || 120))
+ const ckptId = String(n++)
+ workflow[ckptId] = { class_type: 'CheckpointLoaderSimple', inputs: { ckpt_name: params.model } }
+
+ const posId = String(n++)
+ if (isAce15) {
+ workflow[posId] = {
+ class_type: encodeNode,
+ inputs: {
+ clip: [ckptId, 1], tags: params.prompt, lyrics: params.lyrics || '',
+ seed, bpm: 120, duration: seconds, timesignature: '4', language: 'en',
+ keyscale: 'C major', generate_audio_codes: true, cfg_scale: 2.0,
+ temperature: 0.85, top_p: 0.9, top_k: 0, min_p: 0.0,
+ },
+ }
+ } else {
+ workflow[posId] = {
+ class_type: encodeNode,
+ inputs: { clip: [ckptId, 1], tags: params.prompt, lyrics: params.lyrics || '', lyrics_strength: 1.0 },
+ }
+ }
+ const negId = String(n++)
+ if (isAce15) {
+ workflow[negId] = { class_type: 'ConditioningZeroOut', inputs: { conditioning: [posId, 0] } }
+ } else {
+ workflow[negId] = {
+ class_type: encodeNode,
+ inputs: { clip: [ckptId, 1], tags: params.negativePrompt || '', lyrics: '', lyrics_strength: 1.0 },
+ }
+ }
+
+ const shiftId = String(n++)
+ workflow[shiftId] = { class_type: 'ModelSamplingSD3', inputs: { model: [ckptId, 0], shift: 5.0 } }
+ const latentId = String(n++)
+ workflow[latentId] = { class_type: latentNode, inputs: { seconds, batch_size: 1 } }
+ const samplerId = String(n++)
+ workflow[samplerId] = {
+ class_type: 'KSampler',
+ inputs: {
+ model: [shiftId, 0], positive: [posId, 0], negative: [negId, 0], latent_image: [latentId, 0],
+ seed, steps: params.steps, cfg: params.cfgScale, sampler_name: params.sampler, scheduler: params.scheduler, denoise: 1.0,
+ },
+ }
+ const decodeId = String(n++)
+ workflow[decodeId] = { class_type: 'VAEDecodeAudio', inputs: { samples: [samplerId, 0], vae: [ckptId, 2] } }
+ const saveId = String(n++)
+ workflow[saveId] = {
+ class_type: 'SaveAudioMP3',
+ inputs: { audio: [decodeId, 0], filename_prefix: promptFilenamePrefix(params.prompt, false), quality: 'V0' },
+ }
+ return workflow
+}
+
+/**
+ * Talking character (Wan 2.2 S2V, core). Portrait + speech audio → the
+ * character speaks it. wav2vec2 audio embeddings feed WanSoundImageToVideo;
+ * the finished frames are muxed WITH the speech track (CreateVideo), because
+ * a silent talking-head clip is useless. Uses the Wan 2.1 VAE + UMT5 encoder
+ * (the S2V-14B pairing from the official release).
+ */
+export function buildS2VWorkflow(params: LocalOpParams, seed: number, allNodes: Record<string, any>): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+ requireNodes(
+ allNodes,
+ ['WanSoundImageToVideo', 'AudioEncoderLoader', 'AudioEncoderEncode', 'LoadAudio'],
+ 'Talking character',
+ )
+ if (!params.audioFile) throw new Error('Add a voice first. Record, upload or pick an audio track.')
+ if (!params.refImage) throw new Error('Add the portrait the character should speak from.')
+
+ const snap16 = (v: number, def: number) => Math.max(16, Math.round(((v && v > 0) ? v : def) / 16) * 16)
+ const width = snap16(params.width, 832)
+ const height = snap16(params.height, 480)
+ const length = snapWanLength(params.frames || 77)
+
+ const unetId = String(n++)
+ addUnetLoader(workflow, unetId, params.model, allNodes)
+ const clipId = String(n++)
+ workflow[clipId] = { class_type: 'CLIPLoader', inputs: { clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' } }
+ const vaeId = String(n++)
+ workflow[vaeId] = { class_type: 'VAELoader', inputs: { vae_name: 'wan_2.1_vae.safetensors' } }
+ const posId = String(n++)
+ workflow[posId] = { class_type: 'CLIPTextEncode', inputs: { text: params.prompt || 'a person talking naturally, natural expression', clip: [clipId, 0] } }
+ const negId = String(n++)
+ workflow[negId] = { class_type: 'CLIPTextEncode', inputs: { text: params.negativePrompt || '', clip: [clipId, 0] } }
+
+ const audioLoadId = String(n++)
+ workflow[audioLoadId] = { class_type: 'LoadAudio', inputs: { audio: params.audioFile } }
+ const audioEncLoadId = String(n++)
+ workflow[audioEncLoadId] = { class_type: 'AudioEncoderLoader', inputs: { audio_encoder_name: 'wav2vec2_large_english_fp16.safetensors' } }
+ const audioEncId = String(n++)
+ workflow[audioEncId] = { class_type: 'AudioEncoderEncode', inputs: { audio_encoder: [audioEncLoadId, 0], audio: [audioLoadId, 0] } }
+
+ const imageId = String(n++)
+ workflow[imageId] = { class_type: 'LoadImage', inputs: { image: params.refImage } }
+ const scaleId = String(n++)
+ workflow[scaleId] = { class_type: 'ImageScale', inputs: { image: [imageId, 0], upscale_method: 'lanczos', width, height, crop: 'center' } }
+
+ const s2vId = String(n++)
+ workflow[s2vId] = {
+ class_type: 'WanSoundImageToVideo',
+ inputs: {
+ positive: [posId, 0], negative: [negId, 0], vae: [vaeId, 0],
+ width, height, length, batch_size: 1,
+ audio_encoder_output: [audioEncId, 0], ref_image: [scaleId, 0],
+ },
+ }
+
+ const shiftId = String(n++)
+ workflow[shiftId] = { class_type: 'ModelSamplingSD3', inputs: { model: [unetId, 0], shift: 8.0 } }
+ const samplerId = String(n++)
+ workflow[samplerId] = {
+ class_type: 'KSampler',
+ inputs: {
+ model: [shiftId, 0], positive: [s2vId, 0], negative: [s2vId, 1], latent_image: [s2vId, 2],
+ seed, steps: params.steps, cfg: params.cfgScale, sampler_name: params.sampler, scheduler: params.scheduler, denoise: 1.0,
+ },
+ }
+ const decodeId = String(n++)
+ workflow[decodeId] = { class_type: 'VAEDecode', inputs: { samples: [samplerId, 0], vae: [vaeId, 0] } }
+
+ addVideoWithAudioOutput(workflow, n, decodeId, params.fps || 16, [audioLoadId, 0], allNodes, params.prompt)
+ return workflow
+}
+
+/**
+ * Motion control. A character image copies the moves of a driving video.
+ * Wan 2.2 Animate models take a DWPose skeleton video (pose_video); Wan VACE
+ * models take the same skeleton as their control_video — both need the
+ * DWPreprocessor from comfyui_controlnet_aux (one-click install; its CPU
+ * onnxruntime path works on every Windows box, no GPU wheel roulette).
+ * The driving clip's own audio is carried over into the result.
+ */
+export function buildMotionWorkflow(params: LocalOpParams, seed: number, allNodes: Record<string, any>): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+ requireNodes(allNodes, ['LoadVideo', 'GetVideoComponents'], 'Motion control')
+ if (!allNodes['DWPreprocessor']) {
+ throw new WorkflowUnavailableError(
+ 'Motion control needs the pose extractor (DWPose) from the controlnet_aux node pack. Install it from the card above, then generate again.',
+ 'unavailable',
+ { pack: 'comfyui_controlnet_aux', url: 'https://github.com/Fannovel16/comfyui_controlnet_aux' },
+ )
+ }
+ if (!params.drivingVideo) throw new Error('Add the driving video whose motion the character should copy.')
+ if (!params.refImage) throw new Error('Add the character image that should perform the motion.')
+
+ const isVace = classifyModel(params.model) === 'wanvace'
+ requireNodes(allNodes, isVace ? ['WanVaceToVideo', 'TrimVideoLatent'] : ['WanAnimateToVideo', 'TrimVideoLatent'], 'Motion control')
+
+ const snap16 = (v: number, def: number) => Math.max(16, Math.round(((v && v > 0) ? v : def) / 16) * 16)
+ const width = snap16(params.width, 832)
+ const height = snap16(params.height, 480)
+ const length = snapWanLength(params.frames || 77)
+
+ const unetId = String(n++)
+ addUnetLoader(workflow, unetId, params.model, allNodes)
+ const clipId = String(n++)
+ workflow[clipId] = { class_type: 'CLIPLoader', inputs: { clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' } }
+ const vaeId = String(n++)
+ workflow[vaeId] = { class_type: 'VAELoader', inputs: { vae_name: 'wan_2.1_vae.safetensors' } }
+ const posId = String(n++)
+ workflow[posId] = { class_type: 'CLIPTextEncode', inputs: { text: params.prompt || 'a person moving naturally, high quality', clip: [clipId, 0] } }
+ const negId = String(n++)
+ workflow[negId] = { class_type: 'CLIPTextEncode', inputs: { text: params.negativePrompt || '', clip: [clipId, 0] } }
+
+ const videoId = String(n++)
+ workflow[videoId] = { class_type: 'LoadVideo', inputs: { file: params.drivingVideo } }
+ const componentsId = String(n++)
+ workflow[componentsId] = { class_type: 'GetVideoComponents', inputs: { video: [videoId, 0] } }
+ const poseId = String(n++)
+ workflow[poseId] = {
+ class_type: 'DWPreprocessor',
+ inputs: {
+ image: [componentsId, 0], detect_hand: 'enable', detect_body: 'enable', detect_face: 'enable',
+ resolution: Math.min(width, height),
+ bbox_detector: 'yolox_l.onnx', pose_estimator: 'dw-ll_ucoco_384.onnx',
+ },
+ }
+
+ const imageId = String(n++)
+ workflow[imageId] = { class_type: 'LoadImage', inputs: { image: params.refImage } }
+ const scaleId = String(n++)
+ workflow[scaleId] = { class_type: 'ImageScale', inputs: { image: [imageId, 0], upscale_method: 'lanczos', width, height, crop: 'center' } }
+
+ const condId = String(n++)
+ if (isVace) {
+ workflow[condId] = {
+ class_type: 'WanVaceToVideo',
+ inputs: {
+ positive: [posId, 0], negative: [negId, 0], vae: [vaeId, 0],
+ width, height, length, batch_size: 1, strength: 1.0,
+ control_video: [poseId, 0], reference_image: [scaleId, 0],
+ },
+ }
+ } else {
+ workflow[condId] = {
+ class_type: 'WanAnimateToVideo',
+ inputs: {
+ positive: [posId, 0], negative: [negId, 0], vae: [vaeId, 0],
+ width, height, length, batch_size: 1,
+ reference_image: [scaleId, 0], pose_video: [poseId, 0],
+ continue_motion_max_frames: 5, video_frame_offset: 0,
+ },
+ }
+ }
+
+ const shiftId = String(n++)
+ workflow[shiftId] = { class_type: 'ModelSamplingSD3', inputs: { model: [unetId, 0], shift: 8.0 } }
+ const samplerId = String(n++)
+ workflow[samplerId] = {
+ class_type: 'KSampler',
+ inputs: {
+ model: [shiftId, 0], positive: [condId, 0], negative: [condId, 1], latent_image: [condId, 2],
+ seed, steps: params.steps, cfg: params.cfgScale, sampler_name: params.sampler, scheduler: params.scheduler, denoise: 1.0,
+ },
+ }
+ // Both conditioners prepend reference latents — trim them back out so the
+ // decoded clip starts on the motion, not on a frozen reference frame.
+ const trimId = String(n++)
+ workflow[trimId] = { class_type: 'TrimVideoLatent', inputs: { samples: [samplerId, 0], trim_amount: [condId, 3] } }
+ const decodeId = String(n++)
+ workflow[decodeId] = { class_type: 'VAEDecode', inputs: { samples: [trimId, 0], vae: [vaeId, 0] } }
+
+ addVideoWithAudioOutput(workflow, n, decodeId, params.fps || 16, [componentsId, 1], allNodes, params.prompt)
+ return workflow
+}
+
+/** Entry point for the specialized local lanes — fetches the live node
+ * catalogue once and dispatches to the lane's builder. */
+export async function buildLocalOpWorkflow(params: LocalOpParams): Promise<Record<string, any>> {
+ const allNodes = await getAllNodeInfo()
+ const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
+ switch (params.op) {
+ case 'music': return buildMusicWorkflow(params, seed, allNodes)
+ case 'lipsync': return buildS2VWorkflow(params, seed, allNodes)
+ case 'motion': return buildMotionWorkflow(params, seed, allNodes)
+ }
+}
+
function buildFramePackWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
const workflow: Record<string, any> = {}
let n = 1
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsx
index 1d8d8a31..e453316a 100644
--- a/src/components/create/experimental/CreateContext.tsx
+++ b/src/components/create/experimental/CreateContext.tsx
@@ -5,7 +5,7 @@ import { useCloudSession } from '../../../hooks/useCloudSession'
import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
import { getLoraModels, getVAEModels, checkComfyConnection, refreshComfyModels } from '../../../api/comfyui'
import { getAllNodeInfo, clearNodeCache } from '../../../api/comfyui-nodes'
-import { installCustomNodes, getImageBundles, getVideoBundles, startModelDownload, getDownloadProgress } from '../../../api/discover'
+import { installCustomNodes, getImageBundles, getVideoBundles, getAudioBundles, getLipsyncBundles, getMotionBundles, startModelDownload, getDownloadProgress } from '../../../api/discover'
import { backendCall } from '../../../api/backend'
import { ensureLocalFilename } from './loadImage'
import type { CloudQuota } from '../../../lib/render/cloud-jobs'
@@ -48,13 +48,14 @@ interface CreateExpValue {
* and throws on failure. 'rmbg' = the RMBG cutout node; 'inpaint-nodes' =
* ComfyUI's core inpaint nodes (nothing to clone — present on any current
* install once ComfyUI is up). */
- installCapability: (cap: 'rmbg' | 'inpaint-nodes', onProgress?: (msg: string) => void) => Promise<void>
+ installCapability: (cap: 'rmbg' | 'inpaint-nodes' | 'dwpose', onProgress?: (msg: string) => void) => Promise<void>
/** One-click "everything you need" for a fresh PC: ensure ComfyUI runs
* (installing it first if needed), then download the default starter
- * bundle for the intent kind (image → SDXL checkpoint, video → Wan 2.1)
+ * bundle for the intent kind (image → SDXL checkpoint, video → Wan 2.1,
+ * 2.5.8 lanes → ACE / S2V / VACE starters incl. their node packs)
* with streamed progress, refresh ComfyUI's model enums and re-fetch the
* model lists. Throws on failure. */
- installModelBundle: (kind: 'image' | 'video', onProgress?: (msg: string) => void) => Promise<void>
+ installModelBundle: (kind: 'image' | 'video' | 'audio' | 'lipsync' | 'motion', onProgress?: (msg: string) => void) => Promise<void>
/** Runtime backend axis: hosted rendering offered for this session? */
cloudAvailable: boolean
quota: CloudQuota | null
@@ -145,6 +146,7 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
setCaps({
rmbg: names.has('RMBG'),
'inpaint-nodes': names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning'),
+ dwpose: names.has('DWPreprocessor'),
})
} catch { /* node probe is best-effort */ }
})()
@@ -192,24 +194,34 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
// the node cache each round so we don't read the stale pre-install
// catalogue) until the node shows up. The BiRefNet / RMBG-2.0 cutout model
// is fetched by the node itself on the first run.
- const installCapability = useCallback(async (cap: 'rmbg' | 'inpaint-nodes', onProgress?: (msg: string) => void) => {
+ const installCapability = useCallback(async (cap: 'rmbg' | 'inpaint-nodes' | 'dwpose', onProgress?: (msg: string) => void) => {
await ensureComfyRunning(onProgress)
+ const capsFrom = (names: Set<string>) => ({
+ rmbg: names.has('RMBG'),
+ 'inpaint-nodes': names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning'),
+ dwpose: names.has('DWPreprocessor'),
+ })
if (cap === 'inpaint-nodes') {
// Core ComfyUI nodes — nothing to clone. If they're still missing after
// ComfyUI is up, the install is ancient; re-probe and say so honestly.
const nodes = await getAllNodeInfo()
const names = new Set(Object.keys(nodes))
- const ok = names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning')
- setCaps({ rmbg: names.has('RMBG'), 'inpaint-nodes': ok })
- if (!ok) {
+ setCaps(capsFrom(names))
+ if (!names.has('VAEEncodeForInpaint') && !names.has('InpaintModelConditioning')) {
throw new Error(
'This ComfyUI is missing its core inpaint nodes (VAEEncodeForInpaint) — update ComfyUI to a current version.',
)
}
return
}
- onProgress?.('Downloading & installing the background-removal node — this can take a minute…')
- await installCustomNodes(['rmbg'])
+ // Clone-and-pip capabilities share one flow: install the pack, restart
+ // ComfyUI, poll /object_info (cache-cleared) until the node registers.
+ const pack = cap === 'dwpose' ? 'controlnet-aux' : 'rmbg'
+ const nodeClass = cap === 'dwpose' ? 'DWPreprocessor' : 'RMBG'
+ onProgress?.(cap === 'dwpose'
+ ? 'Downloading & installing the pose extractor (controlnet aux). This can take a minute…'
+ : 'Downloading & installing the background removal node. This can take a minute…')
+ await installCustomNodes([pack])
onProgress?.('Restarting ComfyUI to register the node…')
try { await backendCall('stop_comfyui') } catch { /* may already be stopped */ }
await new Promise((r) => setTimeout(r, 2000))
@@ -221,30 +233,48 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
clearNodeCache()
const nodes = await getAllNodeInfo()
const names = new Set(Object.keys(nodes))
- if (names.has('RMBG')) {
- setCaps({
- rmbg: true,
- 'inpaint-nodes': names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning'),
- })
+ if (names.has(nodeClass)) {
+ setCaps(capsFrom(names))
return
}
} catch { /* ComfyUI still restarting — keep polling */ }
}
throw new Error(
- "Installed ComfyUI-RMBG and restarted ComfyUI, but it still isn't listing the RMBG node. " +
+ `Installed ${pack} and restarted ComfyUI, but it still isn't listing the ${nodeClass} node. ` +
'Open the Model Manager to finish the install, or check the ComfyUI console for a pip error.',
)
}, [setCaps, ensureComfyRunning])
// One-click starter models for a fresh PC: ensure ComfyUI, then pull the
// default bundle for the intent kind (image → SDXL checkpoint, video →
- // Wan 2.1 files) through the existing resumable downloader, streaming
- // percent progress into the card, then refresh ComfyUI's model enums so the
- // new files are pickable without a restart.
- const installModelBundle = useCallback(async (kind: 'image' | 'video', onProgress?: (msg: string) => void) => {
+ // Wan 2.1 files, 2.5.8 lanes → their own starter bundles) through the
+ // existing resumable downloader, streaming percent progress into the card,
+ // then refresh ComfyUI's model enums so the new files are pickable without
+ // a restart. Bundles that need a custom node pack (GGUF loader, pose
+ // extractor) install + register it first — one click really means one click.
+ const installModelBundle = useCallback(async (kind: 'image' | 'video' | 'audio' | 'lipsync' | 'motion', onProgress?: (msg: string) => void) => {
await ensureComfyRunning(onProgress)
- const bundle = (kind === 'image' ? getImageBundles() : getVideoBundles())[0]
+ const bundle = (
+ kind === 'image' ? getImageBundles()
+ : kind === 'video' ? getVideoBundles()
+ : kind === 'audio' ? getAudioBundles()
+ : kind === 'lipsync' ? getLipsyncBundles()
+ : getMotionBundles()
+ )[0]
if (!bundle) throw new Error('No starter bundle available for this intent.')
+ if (bundle.customNodes?.length) {
+ onProgress?.('Installing the required node packs…')
+ await installCustomNodes(bundle.customNodes)
+ onProgress?.('Restarting ComfyUI to register the new nodes…')
+ try { await backendCall('stop_comfyui') } catch { /* may already be stopped */ }
+ await new Promise((r) => setTimeout(r, 2000))
+ await backendCall('start_comfyui')
+ for (let i = 0; i < 20; i++) {
+ await new Promise((r) => setTimeout(r, 2000))
+ if (await checkComfyConnection()) break
+ }
+ clearNodeCache()
+ }
for (const file of bundle.files) {
if (!file.downloadUrl || !file.filename || !file.subfolder) continue
const size = file.sizeGB ? ` (${file.sizeGB} GB)` : ''
diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsx
index f10e4dab..35f78a3a 100644
--- a/src/components/create/experimental/SpecialIntentControls.tsx
+++ b/src/components/create/experimental/SpecialIntentControls.tsx
@@ -1,19 +1,28 @@
-// Composer surfaces for the 2.5.8 hosted Create categories (Character-Studio,
-// talking character, music, extend, motion). Each intent owns exactly the
-// inputs its endpoint consumes; everything stages into createStore slots and
-// useCloudCreate submits them. Cloud-only by construction — the IntentBar only
-// offers these intents on the cloud backend.
+// Composer surfaces for the 2.5.8 specialized Create categories
+// (Character-Studio, talking character, music, extend, motion). Each intent
+// owns exactly the inputs its lane consumes; everything stages into
+// createStore slots. On the cloud backend useCloudCreate submits them; since
+// 2.5.8 music / lipsync / extend / motion also run locally (useCreate's
+// specialized lanes), and the surfaces below fork only where the two lanes
+// genuinely differ (extend's source pick, the cloud voice maker).
-import { useEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useRef, useState } from 'react'
import { AnimatePresence, motion } from 'framer-motion'
import {
- AudioLines, Film, ImagePlus, Mic, Music2, Trash2, Upload, Wand2, X,
+ AudioLines, Download, Film, ImagePlus, Mic, Music2, Trash2, Upload, Wand2, X,
} from 'lucide-react'
-import { useCreateStore, type CreateIntent, type MediaRef } from '../../../stores/createStore'
+import { useCreateStore, type CreateIntent, type MediaRef, type GalleryItem } from '../../../stores/createStore'
import { useCloudCatalogStore, cloudModelById, modelForOp } from '../../../stores/cloudCatalogStore'
import { listLoras, deleteLora, type CloudLora } from '../../../api/cloud/loras'
+import {
+ characterTrainerStatus, installCharacterTrainer, parseLocalCharacterLora,
+ TRAINER_BASE_FILES, type TrainerStatus,
+} from '../../../api/trainer'
+import { startModelDownload, getDownloadProgress } from '../../../api/discover'
+import { getLoraModels } from '../../../api/comfyui'
import { useCreateExp } from './CreateContext'
import { loadImageRef } from './loadImage'
+import { fetchGalleryItemBlob } from './galleryUrl'
import { Button } from '../ui/Button'
import { Segmented } from '../ui/Segmented'
import { Slider } from '../ui/Slider'
@@ -129,6 +138,7 @@ const FAMILY_LABEL: Record<string, string> = {
}
function CharacterPanel() {
+ const backend = useCreateStore((s) => s.backend)
const characterTab = useCreateStore((s) => s.characterTab)
const setCharacterTab = useCreateStore((s) => s.setCharacterTab)
const triggerWord = useCreateStore((s) => s.triggerWord)
@@ -137,15 +147,17 @@ function CharacterPanel() {
const selectedCharacter = useCreateStore((s) => s.selectedCharacter)
const setSelectedCharacter = useCreateStore((s) => s.setSelectedCharacter)
const charactersVersion = useCreateStore((s) => s.charactersVersion)
+ const localLane = backend !== 'cloud'
const [shelf, setShelf] = useState<CloudLora[] | null>(null)
useEffect(() => {
+ if (localLane) return
let live = true
listLoras()
.then((l) => { if (live) setShelf(l) })
.catch(() => { if (live) setShelf([]) })
return () => { live = false }
- }, [charactersVersion])
+ }, [charactersVersion, localLane])
return (
<div className="space-y-2">
@@ -161,7 +173,11 @@ function CharacterPanel() {
]}
/>
</div>
- {characterTab === 'train' ? (
+ {characterTab === 'train' && localLane ? (
+ <LocalTrainControls />
+ ) : characterTab === 'use' && localLane ? (
+ <LocalCharacterShelf />
+ ) : characterTab === 'train' ? (
<div className="flex items-center justify-center gap-2 flex-wrap">
<input
value={triggerWord}
@@ -231,6 +247,216 @@ function CharacterPanel() {
)
}
+// Local training readiness + inputs (2.5.8 A5). Three gates render in order:
+// trainer env (one-time musubi setup) -> Z-Image base files -> the actual
+// trigger/steps inputs. The Rust side is the source of truth for readiness.
+function LocalTrainControls() {
+ const triggerWord = useCreateStore((s) => s.triggerWord)
+ const setTriggerWord = useCreateStore((s) => s.setTriggerWord)
+ const trainImages = useCreateStore((s) => s.trainImages)
+ const trainSteps = useCreateStore((s) => s.trainSteps)
+ const setTrainSteps = useCreateStore((s) => s.setTrainSteps)
+ const isGenerating = useCreateStore((s) => s.isGenerating)
+ const [status, setStatus] = useState<TrainerStatus | null>(null)
+ const [busy, setBusy] = useState<'install' | 'bases' | null>(null)
+ const [note, setNote] = useState<string | null>(null)
+
+ const refresh = useCallback(() => {
+ characterTrainerStatus().then(setStatus).catch(() => setStatus(null))
+ }, [])
+ useEffect(() => { refresh() }, [refresh])
+
+ // While an install or a bases download runs, poll its progress into `note`.
+ useEffect(() => {
+ if (!busy) return
+ const t = setInterval(async () => {
+ if (busy === 'install') {
+ const s = await characterTrainerStatus().catch(() => null)
+ if (!s) return
+ setStatus(s)
+ const last = s.install.logs[s.install.logs.length - 1]
+ if (last) setNote(last)
+ if (s.install.status !== 'installing') {
+ setBusy(null)
+ if (s.install.status === 'complete') setNote(null)
+ }
+ } else {
+ const prog = await getDownloadProgress().catch(() => ({} as Record<string, { progress: number; total: number; status: string; filename: string; error?: string }>))
+ const rows = TRAINER_BASE_FILES.map((f) => prog[f.filename]).filter(Boolean)
+ const active = rows.find((r) => r.status === 'downloading' || r.status === 'connecting')
+ if (active) {
+ const pct = active.total > 0 ? Math.round((active.progress / active.total) * 100) : 0
+ setNote(`Downloading ${active.filename} (${pct}%)...`)
+ return
+ }
+ const failed = rows.find((r) => r.status === 'error')
+ const s = await characterTrainerStatus().catch(() => null)
+ if (s) setStatus(s)
+ if (failed) {
+ setNote(failed.error ?? 'Download failed. Check your connection and retry.')
+ setBusy(null)
+ } else if (s?.basesReady) {
+ setNote(null)
+ setBusy(null)
+ }
+ }
+ }, 2000)
+ return () => clearInterval(t)
+ }, [busy])
+
+ const startInstall = async () => {
+ setBusy('install')
+ setNote('Setting up the trainer...')
+ try { await installCharacterTrainer() } catch (e) {
+ setNote(e instanceof Error ? e.message : 'Install could not start.')
+ setBusy(null)
+ }
+ }
+ const startBases = async () => {
+ if (!status) return
+ setBusy('bases')
+ setNote('Starting the downloads...')
+ const missing = TRAINER_BASE_FILES.filter((f) =>
+ (f.subfolder === 'diffusion_models' && !status.dit) ||
+ (f.subfolder === 'text_encoders' && !status.textEncoder) ||
+ (f.subfolder === 'vae' && !status.vae))
+ for (const f of missing) {
+ try { await startModelDownload(f.url, f.subfolder, f.filename) } catch (e) {
+ setNote(e instanceof Error ? e.message : `Could not start ${f.filename}.`)
+ }
+ }
+ }
+
+ if (!status) {
+ return <div className="t-label text-gray-600 text-center">Checking the local trainer…</div>
+ }
+ if (!status.envReady || (busy === 'install' && status.install.status === 'installing')) {
+ return (
+ <div className="flex flex-col items-center gap-1.5">
+ <div className="flex items-center gap-2">
+ <span className="t-label text-gray-500">Trains fully on your GPU. One time setup, about 3 GB.</span>
+ <Button size="sm" variant="secondary" icon={Download} loading={busy === 'install'} disabled={busy === 'install'} onClick={startInstall}>
+ {busy === 'install' ? 'Setting up…' : 'Set up trainer'}
+ </Button>
+ </div>
+ {note && <div className="t-label text-gray-600 max-w-[520px] truncate">{note}</div>}
+ </div>
+ )
+ }
+ if (!status.basesReady) {
+ return (
+ <div className="flex flex-col items-center gap-1.5">
+ <div className="flex items-center gap-2">
+ <span className="t-label text-gray-500">Z Image training base files are missing (about 19 GB, one time).</span>
+ <Button size="sm" variant="secondary" icon={Download} loading={busy === 'bases'} disabled={busy === 'bases'} onClick={startBases}>
+ {busy === 'bases' ? 'Downloading…' : 'Download base files'}
+ </Button>
+ </div>
+ {note && <div className="t-label text-gray-600 max-w-[520px] truncate">{note}</div>}
+ </div>
+ )
+ }
+ return (
+ <div className="flex flex-col items-center gap-1.5">
+ <div className="flex items-center justify-center gap-2 flex-wrap">
+ <input
+ value={triggerWord}
+ onChange={(e) => setTriggerWord(e.target.value)}
+ placeholder="Trigger word, e.g. davechar"
+ className="t-control w-44 px-2.5 h-[var(--control-h-sm)] rounded-md bg-white/[0.03] border border-white/[0.06] text-gray-200 placeholder-gray-600 focus:outline-none focus:border-white/15"
+ />
+ <Segmented
+ size="sm"
+ layoutId="train-steps"
+ value={String(trainSteps)}
+ onChange={(v) => setTrainSteps(Number(v))}
+ options={[
+ { value: '400', label: 'Quick' },
+ { value: '1200', label: 'Standard' },
+ { value: '2400', label: 'Thorough' },
+ ]}
+ />
+ <span className="t-label text-gray-600">
+ {trainImages.length}/30 photos{trainImages.length < 4 ? ', need at least 4' : ''}
+ </span>
+ </div>
+ {!isGenerating && (
+ <div className="t-label text-gray-600">
+ Runs on your GPU and takes a while ({trainSteps} steps). The character lands in your local LoRAs.
+ </div>
+ )}
+ </div>
+ )
+}
+
+// Local Use shelf: characters are the trainer's own `char_<name>_zimage`
+// LoRA files. Picking one activates the LoRA on the normal image chain and
+// surfaces the trigger word; generation itself is the plain local image path.
+function LocalCharacterShelf() {
+ const selectedCharacter = useCreateStore((s) => s.selectedCharacter)
+ const setSelectedCharacter = useCreateStore((s) => s.setSelectedCharacter)
+ const selectedLoras = useCreateStore((s) => s.selectedLoras)
+ const toggleLora = useCreateStore((s) => s.toggleLora)
+ const charactersVersion = useCreateStore((s) => s.charactersVersion)
+ const [files, setFiles] = useState<string[] | null>(null)
+
+ useEffect(() => {
+ let live = true
+ getLoraModels()
+ .then((l) => { if (live) setFiles(l) })
+ .catch(() => { if (live) setFiles([]) })
+ return () => { live = false }
+ }, [charactersVersion])
+
+ const chars = (files ?? []).map(parseLocalCharacterLora)
+ .filter((c): c is NonNullable<ReturnType<typeof parseLocalCharacterLora>> => c !== null)
+
+ return (
+ <div className="flex items-center justify-center gap-1.5 flex-wrap">
+ {files === null && <span className="t-label text-gray-600">Loading your characters…</span>}
+ {files !== null && chars.length === 0 && (
+ <span className="t-label text-gray-600">No local characters yet. Train one first.</span>
+ )}
+ {chars.map((c) => {
+ const active = selectedCharacter?.id === `local:${c.file}`
+ return (
+ <button
+ key={c.file}
+ onClick={() => {
+ if (active) {
+ setSelectedCharacter(null)
+ if (selectedLoras.some((l) => l.name === c.file)) toggleLora(c.file)
+ return
+ }
+ // One character at a time: drop other char LoRAs from the chain.
+ for (const l of selectedLoras) {
+ if (l.name !== c.file && parseLocalCharacterLora(l.name)) toggleLora(l.name)
+ }
+ if (!selectedLoras.some((l) => l.name === c.file)) toggleLora(c.file)
+ setSelectedCharacter({ id: `local:${c.file}`, name: c.trigger, triggerWord: c.trigger, family: 'z-image' })
+ }}
+ className={cn(
+ 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
+ active
+ ? 'bg-white/10 border-white/20 text-white'
+ : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200',
+ )}
+ title={`Trigger word: ${c.trigger}`}
+ >
+ <span className="max-w-[110px] truncate">{c.trigger}</span>
+ <span className="t-label text-gray-500">Z-Image</span>
+ </button>
+ )
+ })}
+ {selectedCharacter && (
+ <span className="t-label text-gray-500 w-full text-center">
+ Put “{selectedCharacter.triggerWord}” in your prompt. Works best with a Z Image base model.
+ </span>
+ )}
+ </div>
+ )
+}
+
// ── Talking character (lipsync) ─────────────────────────────────────────────
function LipsyncControls() {
@@ -293,6 +519,10 @@ function VoiceChip({
useClickAway(ref, () => { setOpen(false); setMakerOpen(false) }, open || makerOpen)
const { makeVoice } = useCreateExp()
const isGenerating = useCreateStore((s) => s.isGenerating)
+ // The AI voice maker + "your generated audio" picks are cloud runs (hosted
+ // tts, jobId-backed re-signing) — on the local lane the speech source is an
+ // upload. Hide the hosted affordances there instead of dead-ending them.
+ const isCloud = useCreateStore((s) => s.backend) === 'cloud'
const audioItems = useCreateStore((s) => s.gallery).filter((g) => g.type === 'audio' && g.jobId)
const value = audioName ?? voiceLabel
@@ -343,13 +573,15 @@ function VoiceChip({
>
<Upload size={12} /> Upload an audio file
</button>
- <button
- onClick={() => setMakerOpen(true)}
- className="w-full flex items-center gap-2 t-control text-gray-300 px-2.5 py-1.5 rounded-md hover:bg-white/[0.06]"
- >
- <Wand2 size={12} /> Generate a voice (AI)
- </button>
- {audioItems.length > 0 && (
+ {isCloud && (
+ <button
+ onClick={() => setMakerOpen(true)}
+ className="w-full flex items-center gap-2 t-control text-gray-300 px-2.5 py-1.5 rounded-md hover:bg-white/[0.06]"
+ >
+ <Wand2 size={12} /> Generate a voice (AI)
+ </button>
+ )}
+ {isCloud && audioItems.length > 0 && (
<div className="pt-1 border-t border-white/[0.06]">
<div className="t-label text-gray-600 px-2.5 py-1">Your generated audio</div>
<div className="max-h-36 overflow-y-auto scrollbar-thin">
@@ -490,7 +722,159 @@ function MusicControls() {
// ── Extend ──────────────────────────────────────────────────────────────────
+/** Grab the LAST frame of a video (blob URL or object URL) as a PNG File —
+ * the local extend lane feeds it to the regular I2V graph as the start
+ * image. Uses a same-origin blob URL so the canvas never taints. */
+async function lastFrameFile(videoUrl: string, name: string): Promise<File> {
+ const video = document.createElement('video')
+ video.muted = true
+ video.preload = 'auto'
+ video.src = videoUrl
+ await new Promise<void>((res, rej) => {
+ video.onloadedmetadata = () => res()
+ video.onerror = () => rej(new Error('could not read the video'))
+ })
+ // Seek close to the end; some containers refuse duration exactly.
+ video.currentTime = Math.max(0, (video.duration || 1) - 0.05)
+ await new Promise<void>((res, rej) => {
+ video.onseeked = () => res()
+ video.onerror = () => rej(new Error('could not seek the video'))
+ })
+ const canvas = document.createElement('canvas')
+ canvas.width = video.videoWidth || 832
+ canvas.height = video.videoHeight || 480
+ canvas.getContext('2d')!.drawImage(video, 0, 0)
+ const blob = await new Promise<Blob>((res, rej) =>
+ canvas.toBlob((b) => (b ? res(b) : rej(new Error('could not capture the frame'))), 'image/png'))
+ return new File([blob], `${name.replace(/\.[^.]+$/, '')}_lastframe.png`, { type: 'image/png' })
+}
+
function ExtendControls() {
+ const backend = useCreateStore((s) => s.backend)
+ return backend === 'local' ? <LocalExtendControls /> : <CloudExtendControls />
+}
+
+/** Local lane: pick one of your local gallery videos (or upload a clip) —
+ * its last frame becomes the Stage source, and the regular I2V flow
+ * continues from there. */
+function LocalExtendControls() {
+ const source = useCreateStore((s) => s.source)
+ const setSource = useCreateStore((s) => s.setSource)
+ const setError = useCreateStore((s) => s.setError)
+ const clips = useCreateStore((s) => s.gallery).filter((g) => g.type === 'video' && !g.jobId)
+ const [open, setOpen] = useState(false)
+ const [busy, setBusy] = useState(false)
+ const [pickedLabel, setPickedLabel] = useState<string | null>(null)
+ const inputRef = useRef<HTMLInputElement>(null)
+ const ref = useRef<HTMLDivElement>(null)
+ useClickAway(ref, () => setOpen(false), open)
+
+ const adopt = async (getUrl: () => Promise<{ url: string; revoke?: () => void }>, label: string) => {
+ setBusy(true)
+ setError(null)
+ try {
+ const { url, revoke } = await getUrl()
+ try {
+ const frame = await lastFrameFile(url, label)
+ setSource(await loadImageRef(frame))
+ setPickedLabel(label)
+ } finally {
+ revoke?.()
+ }
+ } catch (e) {
+ setError(`Could not read the clip: ${e instanceof Error ? e.message : String(e)}`)
+ } finally {
+ setBusy(false)
+ setOpen(false)
+ }
+ }
+
+ const fromGallery = (g: GalleryItem) =>
+ adopt(async () => {
+ const blob = await fetchGalleryItemBlob(g)
+ const url = URL.createObjectURL(blob)
+ return { url, revoke: () => URL.revokeObjectURL(url) }
+ }, g.prompt.slice(0, 40) || 'Local video')
+
+ const fromFile = (f: File) =>
+ adopt(async () => {
+ const url = URL.createObjectURL(f)
+ return { url, revoke: () => URL.revokeObjectURL(url) }
+ }, f.name)
+
+ const value = source && pickedLabel ? pickedLabel : null
+ return (
+ <div className="flex items-center justify-center">
+ <div ref={ref} className="relative flex items-center">
+ <input
+ ref={inputRef}
+ type="file"
+ accept="video/mp4,video/webm,video/quicktime"
+ className="hidden"
+ onChange={(e) => {
+ const f = e.target.files?.[0]
+ if (f) void fromFile(f)
+ e.target.value = ''
+ }}
+ />
+ <button
+ onClick={() => setOpen((o) => !o)}
+ disabled={busy}
+ className={cn(
+ 't-control flex items-center gap-1.5 px-2.5 h-[var(--control-h-sm)] rounded-md border transition-colors',
+ value
+ ? 'bg-white/[0.06] border-white/10 text-gray-200'
+ : 'bg-white/[0.03] border-white/[0.06] text-gray-400 hover:text-gray-200 hover:border-white/15',
+ )}
+ >
+ <Film size={12} />
+ <span className="max-w-[220px] truncate">
+ {busy ? 'Reading last frame…' : value ? `Continues: ${value}` : 'Pick the clip to extend'}
+ </span>
+ </button>
+ {value && (
+ <button
+ onClick={() => { setSource(null); setPickedLabel(null) }}
+ className="p-1 text-gray-500 hover:text-gray-300" title="Clear" aria-label="Clear"
+ >
+ <X size={11} />
+ </button>
+ )}
+ <AnimatePresence>
+ {open && (
+ <motion.div
+ initial={{ opacity: 0, y: 4 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: 4 }}
+ transition={{ duration: 0.12 }}
+ className="lu-elevated absolute bottom-full mb-1.5 left-1/2 -translate-x-1/2 z-50 w-72 rounded-lg p-1 max-h-64 overflow-y-auto scrollbar-thin"
+ >
+ <button
+ onClick={() => inputRef.current?.click()}
+ className="w-full flex items-center gap-2 t-control text-gray-300 px-2.5 py-1.5 rounded-md hover:bg-white/[0.06]"
+ >
+ <Upload size={12} /> Upload a video file
+ </button>
+ {clips.length > 0 && <div className="t-label text-gray-600 px-2.5 py-1 border-t border-white/[0.06] mt-1">Your local videos</div>}
+ {clips.map((g) => (
+ <button
+ key={g.id}
+ onClick={() => { void fromGallery(g) }}
+ className="w-full flex items-center gap-2 t-control text-gray-300 px-2.5 py-1.5 rounded-md hover:bg-white/[0.06]"
+ >
+ <Film size={12} />
+ <span className="truncate">{g.prompt || 'Local video'}</span>
+ </button>
+ ))}
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </div>
+ </div>
+ )
+}
+
+function CloudExtendControls() {
const extendSource = useCreateStore((s) => s.extendSource)
const setExtendSource = useCreateStore((s) => s.setExtendSource)
const clips = useCreateStore((s) => s.gallery).filter((g) => g.type === 'video' && g.jobId)
diff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsx
index 16301cb3..2c6d7ea0 100644
--- a/src/components/create/experimental/Stage.tsx
+++ b/src/components/create/experimental/Stage.tsx
@@ -31,6 +31,9 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onFullscreen
const backend = useCreateStore((s) => s.backend)
const imageModelList = useCreateStore((s) => s.imageModelList)
const videoModelList = useCreateStore((s) => s.videoModelList)
+ const audioModelList = useCreateStore((s) => s.audioModelList)
+ const lipsyncModelList = useCreateStore((s) => s.lipsyncModelList)
+ const motionModelList = useCreateStore((s) => s.motionModelList)
const { connected, modelsLoaded } = useCreateExp()
// On the cloud backend the utility ops (background removal, …) run on
// WaveSpeed's hosted endpoints — there's no local ComfyUI node to install,
@@ -42,10 +45,16 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onFullscreen
// one-click starter-bundle card. connected === false also gates — the same
// button installs ComfyUI itself first. connected === null (still probing)
// gates nothing, so the card never flashes during startup.
+ const listForKind: Record<NonNullable<typeof meta.requiresModels>, unknown[]> = {
+ image: imageModelList,
+ video: videoModelList,
+ audio: audioModelList,
+ lipsync: lipsyncModelList,
+ motion: motionModelList,
+ }
const modelsMissing = backend === 'local' && !!meta.requiresModels && (
connected === false ||
- (connected === true && modelsLoaded &&
- (meta.requiresModels === 'image' ? imageModelList.length === 0 : videoModelList.length === 0))
+ (connected === true && modelsLoaded && listForKind[meta.requiresModels].length === 0)
)
// A result counts for the current source only if it was generated after the
@@ -352,9 +361,14 @@ const CAP_COPY = {
title: 'Image editing needs ComfyUI up and running',
description: 'Local Edit repaints the masked area with ComfyUI’s built-in inpaint nodes. This starts ComfyUI (installing it first if needed) and verifies the nodes.',
},
+ dwpose: {
+ icon: Film,
+ title: 'Motion control needs the pose extractor',
+ description: 'DWPose reads the skeleton out of your driving video so the character can copy it. This installs the controlnet aux node pack; the pose models download automatically on your first run.',
+ },
} as const
-function CapabilityCard({ cap }: { cap: 'rmbg' | 'inpaint-nodes' }) {
+function CapabilityCard({ cap }: { cap: 'rmbg' | 'inpaint-nodes' | 'dwpose' }) {
const { installCapability } = useCreateExp()
const [installing, setInstalling] = useState(false)
const [status, setStatus] = useState('')
@@ -392,9 +406,24 @@ const BUNDLE_COPY = {
title: 'Local video generation needs a one-time download',
description: 'This sets up everything for a fully local run: ComfyUI itself if it’s missing, plus the Wan 2.1 starter model files (~9.2 GB, 480p, light on VRAM).',
},
+ audio: {
+ icon: ImageIcon,
+ title: 'Local music needs a one-time download',
+ description: 'This sets up everything for fully local music: ComfyUI itself if it’s missing, plus the ACE Step 1.5 music model (~9.3 GB, runs from 6 GB VRAM). Local music is never filtered.',
+ },
+ lipsync: {
+ icon: Film,
+ title: 'Local talking characters need a one-time download',
+ description: 'This sets up the Wan 2.2 S2V model plus its audio encoder (~20 GB total). Comfortable on 12 GB VRAM; smaller cards offload and render slower.',
+ },
+ motion: {
+ icon: Film,
+ title: 'Local motion control needs a one-time download',
+ description: 'This sets up the Wan VACE motion model plus its support files (~10.5 GB, runs from 8 GB VRAM). The bigger Wan Animate variant is in the Model Manager.',
+ },
} as const
-function ModelInstallCard({ kind }: { kind: 'image' | 'video' }) {
+function ModelInstallCard({ kind }: { kind: 'image' | 'video' | 'audio' | 'lipsync' | 'motion' }) {
const { installModelBundle } = useCreateExp()
const [installing, setInstalling] = useState(false)
const [status, setStatus] = useState('')
@@ -427,6 +456,7 @@ function TrainSetBoard() {
const trainImages = useCreateStore((s) => s.trainImages)
const addTrainImages = useCreateStore((s) => s.addTrainImages)
const removeTrainImage = useCreateStore((s) => s.removeTrainImage)
+ const backend = useCreateStore((s) => s.backend)
const inputRef = useRef<HTMLInputElement>(null)
const addFiles = (files: FileList | File[]) => {
@@ -489,7 +519,9 @@ function TrainSetBoard() {
</div>
</div>
<div className="t-label text-gray-500 text-center shrink-0">
- {trainImages.length}/30 photos. Training runs in the cloud and lands the character on your shelf.
+ {trainImages.length}/30 photos. {backend === 'cloud'
+ ? 'Training runs in the cloud and lands the character on your shelf.'
+ : 'Training runs on your GPU and lands the character in your local LoRAs.'}
</div>
</>
)}
diff --git a/src/components/create/experimental/badges.ts b/src/components/create/experimental/badges.ts
index 14c35b68..1de68cb0 100644
--- a/src/components/create/experimental/badges.ts
+++ b/src/components/create/experimental/badges.ts
@@ -20,6 +20,11 @@ export const TYPE_BADGE: Record<ModelType, { label: string; color: string }> = {
framepack: { label: 'FramePack', color: 'bg-teal-500/15 text-teal-300' },
pyramidflow: { label: 'PyramidFlow', color: 'bg-violet-500/15 text-violet-300' },
allegro: { label: 'Allegro', color: 'bg-rose-500/15 text-rose-300' },
+ // 2.5.8 specialized local lanes
+ ace: { label: 'ACE Step', color: 'bg-fuchsia-500/15 text-fuchsia-300' },
+ wans2v: { label: 'Wan S2V', color: 'bg-orange-500/15 text-orange-300' },
+ wananimate: { label: 'Wan Animate', color: 'bg-orange-500/15 text-orange-300' },
+ wanvace: { label: 'VACE', color: 'bg-lime-500/15 text-lime-300' },
unknown: { label: 'Model', color: 'bg-white/10 text-gray-400' },
}
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 177e3747..650f276f 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -5,17 +5,26 @@ import {
refreshComfyModels,
getImageModels,
getVideoModels,
+ getAudioModels,
+ getLipsyncModels,
+ getMotionModels,
+ resolveLocalOpPick,
+ uploadMediaFile,
getSamplers,
getSchedulers,
detectVideoBackend,
cancelGeneration,
submitWorkflow,
getHistory,
+ isPromptQueued,
buildTxt2ImgWorkflow,
buildTxt2VidWorkflow,
classifyModel,
isI2VModel,
+ isT2VCapable,
extractComfyOutputFiles,
+ galleryTypeForFile,
+ MODEL_TYPE_DEFAULTS as COMFY_MODEL_DEFAULTS,
type ClassifiedModel,
type ComfyUIOutput,
type VideoBackend,
@@ -26,11 +35,15 @@ import {
LOADER_NODES, CLIP_LOADER_NODES, VAE_LOADER_NODES, SAMPLER_NODES, DECODE_NODES,
type ComfyWSEvent,
} from '../api/comfyui-ws'
-import { buildDynamicWorkflow, checkVideoOutputCapability } from '../api/dynamic-workflow'
+import { buildDynamicWorkflow, buildLocalOpWorkflow, checkVideoOutputCapability } from '../api/dynamic-workflow'
import { getAllNodeInfo, clearNodeCache } from '../api/comfyui-nodes'
import { installCustomNodes } from '../api/discover'
import { backendCall } from '../api/backend'
import { checkPromptSafety, SAFETY_BLOCK_MESSAGE } from '../lib/render/safety'
+import {
+ clearTrainingSet, stageTrainingImage, startCharacterTraining,
+ characterTrainingStatus, cancelCharacterTraining,
+} from '../api/trainer'
import { useCreateStore } from '../stores/createStore'
import { useWorkflowStore } from '../stores/workflowStore'
import { injectParameters } from '../api/workflows'
@@ -47,6 +60,9 @@ export function useCreate() {
const [modelLoadError, setModelLoadError] = useState<string | null>(null)
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)
const abortRef = useRef<AbortController | null>(null)
+ // A local character-training run is a Rust child process, not a ComfyUI
+ // prompt — cancel() must reach it through its own command.
+ const trainingActive = useRef(false)
// Cleanup on unmount
useEffect(() => {
@@ -89,8 +105,15 @@ export function useCreate() {
setModelLoadError(null)
try {
- // Check connection first — if ComfyUI is down, don't waste time on model queries
+ // Check connection first — if ComfyUI is down, don't waste time on model queries.
+ // Sync the connected state on EVERY fetch: the mount-time checkConnection can
+ // race ComfyUI's autostart (exe boots faster than the engine), and nothing
+ // else ever flipped `connected` back to true — the Stage then kept showing
+ // the Download & install card while the model chip was happily populated
+ // (live-caught on the 2.5.8 extend lane E2E).
const comfyOk = await checkComfyConnection()
+ setConnected(comfyOk)
+ useCreateStore.getState().setComfyRunning(comfyOk)
if (!comfyOk) {
setModelLoadError('ComfyUI is not running. Start it from Settings or wait for auto-start.')
return
@@ -101,13 +124,18 @@ export function useCreate() {
// and its internal cache hasn't updated yet.
await refreshComfyModels()
- const [comfyImgModels, vidModels, samplers, schedulers, vBackend, _nodeInfo] = await Promise.all([
+ const [comfyImgModels, vidModels, samplers, schedulers, vBackend, _nodeInfo, audModels, lipModels, motModels] = await Promise.all([
getImageModels(),
getVideoModels(),
getSamplers(),
getSchedulers(),
detectVideoBackend(),
getAllNodeInfo().catch(() => null),
+ // 2.5.8 specialized lane lists — best-effort so a probe failure never
+ // blocks the classic image/video surfaces.
+ getAudioModels().catch(() => [] as ClassifiedModel[]),
+ getLipsyncModels().catch(() => [] as ClassifiedModel[]),
+ getMotionModels().catch(() => [] as ClassifiedModel[]),
])
const imgModels = comfyImgModels
setImageModels(imgModels)
@@ -123,6 +151,9 @@ export function useCreate() {
const st = useCreateStore.getState()
st.setImageModelList(imgModels)
st.setVideoModelList(vidModels)
+ st.setAudioModelList(audModels)
+ st.setLipsyncModelList(lipModels)
+ st.setMotionModelList(motModels)
// If ComfyUI is connected but returns 0 models, do NOT set modelsLoaded — keep retrying.
// ComfyUI may still be scanning directories (race condition on startup).
@@ -239,6 +270,80 @@ export function useCreate() {
return () => clearInterval(retryInterval)
}, [modelLoadError, modelsLoaded, fetchModels])
+ // ── 2.5.8 A5: local character training. Not a ComfyUI render — the Rust
+ // trainer (musubi-tuner in its own venv) owns stage -> cache -> train ->
+ // convert -> loras/; this just streams its status into the normal
+ // generating UI and lands the user on the Use tab when the LoRA is in.
+ const runCharacterTraining = useCallback(async () => {
+ const state = useCreateStore.getState()
+ const { setIsGenerating, setProgress, setError } = state
+ const trigger = state.triggerWord.trim()
+ if (!trigger) {
+ setError('Pick a trigger word first, e.g. davechar. It becomes the token that summons your character.')
+ return
+ }
+ // Blobs are runtime-only — after an app restart the thumbnails would
+ // still render (object URLs die too, but names persist) with no bytes.
+ const staged = state.trainImages.filter((i) => i.blob instanceof Blob)
+ if (staged.length < 4) {
+ setError(staged.length < state.trainImages.length
+ ? 'Your photos did not survive the app restart. Re-add them, then train.'
+ : 'Add at least 4 photos of your character first (up to 30).')
+ return
+ }
+ setError(null)
+ setIsGenerating(true)
+ trainingActive.current = true
+ try {
+ const setId = trigger
+ await clearTrainingSet(setId)
+ let n = 0
+ for (const img of staged) {
+ const bytes = Array.from(new Uint8Array(await img.blob.arrayBuffer()))
+ // Musubi has no trigger flag — the token must lead every caption.
+ await stageTrainingImage(setId, img.name, bytes, `${trigger}, a photo of ${trigger}`)
+ n += 1
+ setProgress(2 + Math.round((n / staged.length) * 5), `Staging photos (${n}/${staged.length})...`)
+ }
+ setProgress(8, 'Starting the training run...')
+ await startCharacterTraining(setId, trigger, trigger, state.trainSteps)
+ for (;;) {
+ await new Promise((r) => setTimeout(r, 3000))
+ // cancel() already reset the UI; the Rust child got its kill there.
+ if (!useCreateStore.getState().isGenerating) return
+ const s = await characterTrainingStatus().catch(() => null)
+ if (!s) continue
+ if (s.status === 'running') {
+ if (s.totalSteps > 0) {
+ setProgress(Math.min(95, 10 + Math.round((s.step / s.totalSteps) * 85)), `Training ${s.step}/${s.totalSteps}...`)
+ } else {
+ const last = s.logs[s.logs.length - 1] ?? ''
+ setProgress(10, /Step \d\/4/.test(last) ? last : 'Preparing training data...')
+ }
+ } else if (s.status === 'complete') {
+ setProgress(100, 'Character ready!')
+ // The LoRA file just landed in models/loras — drop the node cache so
+ // the Use shelf and the LoRA picker list it without a restart.
+ clearNodeCache()
+ useCreateStore.getState().bumpCharactersVersion()
+ useCreateStore.getState().setCharacterTab('use')
+ return
+ } else if (s.status === 'cancelled') {
+ return
+ } else {
+ setError(`Training failed. ${s.logs.slice(-3).join(' ')}`.slice(0, 420))
+ return
+ }
+ }
+ } catch (e) {
+ setError(e instanceof Error ? e.message : 'Training could not start.')
+ } finally {
+ trainingActive.current = false
+ useCreateStore.getState().setIsGenerating(false)
+ useCreateStore.getState().setProgress(0)
+ }
+ }, [])
+
const generateInner = useCallback(async () => {
const state = useCreateStore.getState()
// AI-CSAM gate — applies before any backend is touched.
@@ -249,6 +354,13 @@ export function useCreate() {
return
}
}
+ // Character-Studio train surface books the local trainer instead of a
+ // render; the use surface falls through to the plain image path (the
+ // selected character LoRA rides the normal selectedLoras chain).
+ if (state.cloudOp === 'character' && state.characterTab === 'train') {
+ await runCharacterTraining()
+ return
+ }
const {
mode, prompt, negativePrompt, imageModel, videoModel,
sampler, scheduler, steps, cfgScale, width, height, seed, batchSize, frames, fps, denoise, i2iImage, i2vImage,
@@ -267,24 +379,56 @@ export function useCreate() {
const maskFilename = mask?.filename
const isRemoveBg = mode === 'image' && removebg
+ // ── 2.5.8 specialized local lanes. music / lipsync / motion build their
+ // own core-node graphs (buildLocalOpWorkflow); extend rides the regular
+ // I2V flow below — its source IS the extracted last frame. character
+ // trained already branched off above (Rust musubi trainer); its use
+ // surface is a plain image generate with the LoRA active. ──
+ const localOp =
+ state.cloudOp === 'music' || state.cloudOp === 'lipsync' || state.cloudOp === 'motion'
+ ? state.cloudOp
+ : null
+ const localOpList =
+ localOp === 'music' ? state.audioModelList
+ : localOp === 'lipsync' ? state.lipsyncModelList
+ : localOp === 'motion' ? state.motionModelList
+ : []
+ const localOpModel = localOp ? resolveLocalOpPick(state.localOpModel, localOpList) : ''
+
// Desktop port: the MLX video/image pipelines (Apple Silicon) are not
// part of this build — ComfyUI is the only local backend.
setError(null)
- const activeModel = mode === 'image' ? imageModel : videoModel
+ let activeModel = localOp ? localOpModel : (mode === 'image' ? imageModel : videoModel)
+ // Chip↔run agreement (live-caught on the extend E2E): the picker DISPLAYS
+ // the first capable model when the stored pick can't run the current
+ // intent, but submit read the raw store — the run then used a model the
+ // user never saw. Apply the picker's coercion here too (same one-rule
+ // philosophy as the cloud op resolver after take-01).
+ if (!localOp && mode === 'video' && state.videoModelList.length > 0) {
+ const capable = intent === 'animate' || intent === 'extend'
+ ? state.videoModelList.filter((m) => isI2VModel(m.name))
+ : state.videoModelList.filter((m) => isT2VCapable(m.name))
+ if (capable.length > 0 && !capable.some((m) => m.name === activeModel)) {
+ activeModel = capable[0].name
+ }
+ }
// Always re-classify from model name to avoid stale type
const imageModelType = classifyModel(activeModel)
- // Background removal is prompt-free and model-independent (RMBG node).
- if (!isRemoveBg && !prompt.trim()) {
- setError('Please enter a prompt.')
+ // Background removal is prompt-free and model-independent (RMBG node);
+ // lipsync/motion drive off their media inputs (the builder supplies a
+ // neutral scene prompt when the field is empty).
+ const promptOptional = isRemoveBg || localOp === 'lipsync' || localOp === 'motion'
+ if (!promptOptional && !prompt.trim()) {
+ setError(localOp === 'music' ? 'Describe the track first. Genre, mood, tempo…' : 'Please enter a prompt.')
return
}
if (isRemoveBg && !effInputImage) {
setError('Please add an image to remove its background.')
return
}
- if (isI2I && !isRemoveBg && !effInputImage) {
+ if (!localOp && isI2I && !isRemoveBg && !effInputImage) {
setError('Please add a source image first.')
return
}
@@ -295,22 +439,54 @@ export function useCreate() {
return
}
if (!isRemoveBg && !activeModel) {
- setError(mode === 'image'
- ? 'No image model selected. Add checkpoints or FLUX models to ComfyUI.'
- : 'No video model selected. Install Wan 2.1 or AnimateDiff models.')
+ if (localOp === 'music') {
+ setError('No music model installed. Use Download & install above to get ACE Step, then generate.')
+ } else if (localOp === 'lipsync') {
+ setError('No talking character model installed. Use Download & install above to get Wan 2.2 S2V.')
+ } else if (localOp === 'motion') {
+ setError('No motion model installed. Use Download & install above to get Wan Animate or VACE.')
+ } else {
+ setError(mode === 'image'
+ ? 'No image model selected. Add checkpoints or FLUX models to ComfyUI.'
+ : 'No video model selected. Install Wan 2.1 or AnimateDiff models.')
+ }
return
}
- // Animate (local I2V, restored 2026-07-17): reject-and-report instead of
+ // Lane input guards — reject-and-report before anything uploads.
+ if (localOp === 'lipsync') {
+ if (!source?.filename) {
+ setError('Add the portrait the character should speak from.')
+ return
+ }
+ if (!state.audioInput) {
+ setError('Add a voice first. Upload or record the speech audio.')
+ return
+ }
+ }
+ if (localOp === 'motion') {
+ if (!source?.filename) {
+ setError('Add the character image that should perform the motion.')
+ return
+ }
+ if (!state.videoInput) {
+ setError('Add the driving video whose motion the character should copy.')
+ return
+ }
+ }
+ // Animate (local I2V, restored 2026-07-17) + extend (2.5.8 — continues a
+ // clip from its extracted last frame): reject-and-report instead of
// feeding a start image to a t2v-only checkpoint — that either errors in
// ComfyUI or silently ignores the source. The ModelChip already filters
// the picker; this guards a stale store selection reaching submit.
- if (intent === 'animate') {
+ if (intent === 'animate' || intent === 'extend') {
if (!effI2vImage) {
- setError('Add the image you want to animate first.')
+ setError(intent === 'extend'
+ ? 'Pick the clip to extend first. Its last frame becomes the starting point.'
+ : 'Add the image you want to animate first.')
return
}
if (!isI2VModel(activeModel)) {
- setError(`${activeModel} is text-to-video only. Pick an i2v-capable model (WAN i2v / WAN 2.2 ti2v / SVD / LTX) to animate an image.`)
+ setError(`${activeModel} is text-to-video only. Pick an i2v-capable model (WAN i2v / WAN 2.2 ti2v / SVD / LTX) to ${intent === 'extend' ? 'extend a clip' : 'animate an image'}.`)
return
}
}
@@ -325,6 +501,19 @@ export function useCreate() {
setProgress(0, 'Preparing workflow...')
abortRef.current = new AbortController()
+ // Make VRAM room for the render. On a single local GPU a resident chat LLM
+ // (Ollama / LM Studio / the bundled engine) squats the card, which forces
+ // ComfyUI into heavy CPU offload — or a CUDA OOM on the 14B video lanes
+ // (S2V / Animate). Free the chat backends first (they reload lazily on the
+ // next message) but keep ComfyUI's own checkpoint cached across runs
+ // (includeComfyui:false). Best-effort — never block a render on housekeeping.
+ try {
+ await Promise.all([
+ backendCall('offload_local_models', { includeComfyui: false }).catch(() => {}),
+ backendCall('lmstudio_unload_model', { model: '--all' }).catch(() => {}),
+ ])
+ } catch { /* ignore — VRAM housekeeping is best-effort */ }
+
try {
const baseParams = {
prompt, negativePrompt, model: activeModel, sampler, scheduler, steps, cfgScale, width, height, seed, batchSize,
@@ -342,11 +531,66 @@ export function useCreate() {
...(clipSkip > 0 ? { clipSkip } : {}),
}
- let workflow: Record<string, any>
+ let workflow: Record<string, any> = {}
let builderUsed: 'dynamic' | 'legacy' | 'custom' = 'dynamic'
+ // ── Specialized-lane graphs: stage the media inputs in ComfyUI's input
+ // dir, then build the lane's core-node workflow. No custom-workflow or
+ // legacy fallback here — REJECT-AND-REPORT via WorkflowUnavailableError
+ // is the whole point (an "Update ComfyUI" message instead of a broken
+ // graph). ──
+ if (localOp) {
+ let audioFile: string | undefined
+ let drivingVideo: string | undefined
+ let laneFrames = mode === 'video' ? frames : 0
+ if (localOp === 'lipsync' && state.audioInput) {
+ setProgress(3, 'Uploading the voice audio...')
+ audioFile = await uploadMediaFile(state.audioInput.blob, state.audioInput.name)
+ // Size the clip to the speech: a fixed 77 frames would cut a longer
+ // voice mid-sentence. Cap at ~7.5s (121 frames @16fps) so a long
+ // narration doesn't quietly queue a 10-minute render on 12 GB.
+ const audioSeconds = await new Promise<number>((resolve) => {
+ const probe = new Audio()
+ const objUrl = URL.createObjectURL(state.audioInput!.blob)
+ probe.preload = 'metadata'
+ probe.onloadedmetadata = () => { URL.revokeObjectURL(objUrl); resolve(probe.duration || 0) }
+ probe.onerror = () => { URL.revokeObjectURL(objUrl); resolve(0) }
+ probe.src = objUrl
+ })
+ if (audioSeconds > 0 && Number.isFinite(audioSeconds)) {
+ laneFrames = Math.min(121, Math.max(25, Math.round(audioSeconds * (fps || 16)) + 1))
+ }
+ }
+ if (localOp === 'motion' && state.videoInput) {
+ setProgress(3, 'Uploading the driving video...')
+ drivingVideo = await uploadMediaFile(state.videoInput.blob, state.videoInput.name)
+ }
+ setProgress(5, 'Building workflow...')
+ const laneDefaults = COMFY_MODEL_DEFAULTS[imageModelType] ?? COMFY_MODEL_DEFAULTS.unknown
+ workflow = await buildLocalOpWorkflow({
+ op: localOp,
+ model: activeModel,
+ prompt,
+ negativePrompt,
+ seed, steps, cfgScale, sampler, scheduler,
+ // The shared width/height/frames sliders follow the picked model via
+ // setLocalOpModel; fall back to the architecture defaults when a
+ // stale persisted value would be off-grid for the lane.
+ width: width || laneDefaults.width,
+ height: height || laneDefaults.height,
+ frames: laneFrames || laneDefaults.frames,
+ fps: mode === 'video' ? fps : laneDefaults.fps,
+ seconds: state.musicDuration,
+ lyrics: state.musicLyrics,
+ audioFile,
+ refImage: source?.filename || undefined,
+ drivingVideo,
+ })
+ builderUsed = 'dynamic'
+ }
+
// Check for custom workflow assignment — but verify it's compatible with the model
- let customWf = useWorkflowStore.getState().getWorkflowForModel(activeModel, imageModelType)
+ let customWf = localOp ? null : 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 === 'zimage' || imageModelType === 'wan' || imageModelType === 'hunyuan'
@@ -367,7 +611,7 @@ export function useCreate() {
setProgress(5, `Using workflow: ${customWf.name}...`)
const params = mode === 'video' ? { ...baseParams, frames, fps, ...(effI2vImage ? { inputImage: effI2vImage } : {}) } : baseParams
workflow = await injectParameters(customWf.workflow, customWf.parameterMap, params, imageModelType)
- } else {
+ } else if (!localOp) {
// Dynamic workflow builder — auto-detects nodes and builds the right pipeline
setProgress(5, 'Building workflow...')
try {
@@ -507,17 +751,35 @@ export function useCreate() {
store.setProgressPhase('queued')
setProgress(10, 'Queued...')
- const timeoutTimer = setTimeout(() => {
- cleanup()
- reject(new Error(`Generation timed out after ${Math.round(maxTime / 60000)} minutes`))
- }, maxTime)
+ // Activity watchdog (2.5.8): the old hard wall-clock cap killed a
+ // REAL render at exactly 60 minutes while ComfyUI was still
+ // sampling (live-caught on the extend lane: 3060 + TI2V-5B, file
+ // landed on disk seconds after the app gave up). maxTime now bounds
+ // the SILENT gap — every WS event for our prompt, and a still-queued
+ // prompt on the periodic check, count as life signs.
+ let lastActivity = Date.now()
+ const timeoutTimer = setInterval(() => {
+ if (Date.now() - lastActivity > maxTime) {
+ cleanup()
+ reject(new Error(`Generation stalled: no progress from ComfyUI for ${Math.round(maxTime / 60000)} minutes`))
+ }
+ }, 15000)
// Heartbeat: check ComfyUI every 10s + poll for completion (catches missed WS events)
let completionHandled = false
+ let queueCheckCounter = 0
const heartbeat = setInterval(async () => {
if (completionHandled) return
const alive = await checkComfyConnection()
if (!alive) { cleanup(); reject(new Error('ComfyUI stopped responding during generation')); return }
+ // A prompt still in ComfyUI's queue is alive even when the socket
+ // goes quiet (long model loads emit no events) — refresh the
+ // watchdog once a minute from the queue itself.
+ queueCheckCounter += 1
+ if (queueCheckCounter >= 6) {
+ queueCheckCounter = 0
+ if (await isPromptQueued(promptId).catch(() => false)) lastActivity = Date.now()
+ }
// Poll history to catch completion if WebSocket event was missed
try {
const history = await getHistory(promptId)
@@ -547,7 +809,7 @@ export function useCreate() {
for (const file of files) {
found = true
addToGallery({
- id: uuid(), type: mode,
+ id: uuid(), type: galleryTypeForFile(file.filename, mode),
filename: file.filename, subfolder: file.subfolder ?? '',
prompt, negativePrompt, model: activeModel,
modelType: mode === 'image' ? imageModelType : (videoModelsList.find(m => m.name === activeModel)?.type ?? 'wan'),
@@ -574,7 +836,7 @@ export function useCreate() {
let abortCheck: ReturnType<typeof setInterval> | null = null
const cleanup = () => {
- clearTimeout(timeoutTimer)
+ clearInterval(timeoutTimer)
clearInterval(heartbeat)
if (abortCheck) clearInterval(abortCheck)
removeListener()
@@ -583,6 +845,7 @@ export function useCreate() {
const removeListener = comfyWS.on((event: ComfyWSEvent) => {
// Only handle events for our prompt
if ('prompt_id' in event.data && event.data.prompt_id !== promptId) return
+ lastActivity = Date.now()
const elapsed = Math.round((Date.now() - startTime) / 1000)
const st = useCreateStore.getState()
@@ -644,7 +907,7 @@ export function useCreate() {
for (const file of files) {
found = true
addToGallery({
- id: uuid(), type: mode,
+ id: uuid(), type: galleryTypeForFile(file.filename, mode),
filename: file.filename, subfolder: file.subfolder ?? '',
prompt, negativePrompt, model: activeModel,
modelType: mode === 'image' ? imageModelType : (videoModelsList.find(m => m.name === activeModel)?.type ?? 'wan'),
@@ -684,6 +947,10 @@ export function useCreate() {
let attempts = 0
let comfyCheckCounter = 0
const startTime = Date.now()
+ // Same activity watchdog as the WS branch: the deadline only fires
+ // when the prompt has also LEFT ComfyUI's queue — a slow render
+ // that is still queued extends its own window.
+ let lastActivity = Date.now()
pollRef.current = setInterval(async () => {
if (abortRef.current?.signal.aborted) {
@@ -693,10 +960,14 @@ export function useCreate() {
}
const elapsed = Date.now() - startTime
- if (elapsed > maxTime) {
- if (pollRef.current) clearInterval(pollRef.current)
- reject(new Error(`Generation timed out after ${Math.round(maxTime / 60000)} minutes`))
- return
+ if (Date.now() - lastActivity > maxTime) {
+ if (await isPromptQueued(promptId).catch(() => false)) {
+ lastActivity = Date.now()
+ } else {
+ if (pollRef.current) clearInterval(pollRef.current)
+ reject(new Error(`Generation stalled: no progress from ComfyUI for ${Math.round(maxTime / 60000)} minutes`))
+ return
+ }
}
attempts++
@@ -741,7 +1012,7 @@ export function useCreate() {
for (const file of files) {
found = true
addToGallery({
- id: uuid(), type: mode,
+ id: uuid(), type: galleryTypeForFile(file.filename, mode),
filename: file.filename, subfolder: file.subfolder ?? '',
prompt, negativePrompt, model: activeModel,
modelType: mode === 'image' ? imageModelType : (videoModelsList.find(m => m.name === activeModel)?.type ?? 'wan'),
@@ -786,7 +1057,7 @@ export function useCreate() {
if (pollRef.current) { clearInterval(pollRef.current); pollRef.current = null }
abortRef.current = null
}
- }, [videoBackend])
+ }, [videoBackend, runCharacterTraining])
// Double-click idempotence: isGenerating only flips after the first await,
// so a second click racing the first must be blocked SYNCHRONOUSLY — two
@@ -804,6 +1075,9 @@ export function useCreate() {
const cancel = useCallback(async () => {
abortRef.current?.abort()
+ if (trainingActive.current) {
+ try { await cancelCharacterTraining() } catch {}
+ }
try { await cancelGeneration() } catch {}
if (pollRef.current) { clearInterval(pollRef.current); pollRef.current = null }
useCreateStore.getState().setIsGenerating(false)
diff --git a/src/stores/__tests__/createStore.test.ts b/src/stores/__tests__/createStore.test.ts
index e6e93c7a..10331435 100644
--- a/src/stores/__tests__/createStore.test.ts
+++ b/src/stores/__tests__/createStore.test.ts
@@ -774,6 +774,16 @@ describe('createStore', () => {
expect(after.source).not.toBeNull()
})
+ it('keeps character — its local training lane arrived in 2.5.8 (musubi)', () => {
+ const s = useCreateStore.getState()
+ s.setBackend('cloud')
+ s.setIntent('character')
+ useCreateStore.getState().setBackend('local')
+ const after = useCreateStore.getState()
+ expect(after.cloudOp).toBe('character')
+ expect(after.intent()).toBe('character')
+ })
+
it('flipping to cloud never resets anything', () => {
const s = useCreateStore.getState()
s.setBackend('local')
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 3e5e3e42..00e9c91a 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -29,12 +29,20 @@ export type CreateIntent =
* IntentBar only offers these while the cloud backend is active. */
export type UtilityOp = 'upscale' | 'eraser'
-/** 2.5.8 cloud-only Create categories (WaveSpeed, 2026-07-17 David):
+/** 2.5.8 specialized Create categories (2026-07-17 David):
* Character-Studio (LoRA training + generation), talking character (lipsync),
* music, video extend and motion control. Like `utilityOp`, an escape hatch
* over the image/video mode axis: when set it wins the intent derivation. */
export type CloudOp = 'character' | 'lipsync' | 'music' | 'extend' | 'motion'
+/** Which of the specialized categories ALSO run on the local ComfyUI backend
+ * (2.5.8 local lanes: ACE music, Wan S2V talking character, last-frame-chain
+ * extend, Wan Animate/VACE motion, musubi character training). Single source
+ * of truth for the intent metadata, the IntentBar lock state and the
+ * backend-flip cleanup below — lives here (lowest layer) so intents.ts can
+ * derive from it without a component→store import cycle. */
+export const LOCAL_LANE_OPS: ReadonlySet<CloudOp> = new Set(['music', 'lipsync', 'extend', 'motion', 'character'])
+
/** An audio/video file (or training image) staged in the composer before
* upload. `blob` carries the bytes for the cloud upload; `url` is a local
* object URL for preview. Runtime-only — blobs can never persist. */
@@ -104,6 +112,12 @@ export const MODEL_TYPE_DEFAULTS: Record<ModelType, {
framepack: { steps: 30, cfgScale: 5.0, sampler: 'euler', scheduler: 'normal', width: 832, height: 480, frames: 33, fps: 16 },
pyramidflow: { steps: 20, cfgScale: 7.0, sampler: 'euler', scheduler: 'normal', width: 1280, height: 768, frames: 121, fps: 24 },
allegro: { steps: 100, cfgScale: 7.5, sampler: 'euler', scheduler: 'normal', width: 1280, height: 720, frames: 88, fps: 15 },
+ // 2.5.8 specialized local lanes (see comfyui.ts MODEL_TYPE_DEFAULTS for the
+ // node-default provenance). ACE width/height are unused by the audio graph.
+ ace: { steps: 50, cfgScale: 5.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
+ wans2v: { steps: 20, cfgScale: 6.0, sampler: 'euler', scheduler: 'simple', width: 832, height: 480, frames: 77, fps: 16 },
+ wananimate: { steps: 20, cfgScale: 5.0, sampler: 'euler', scheduler: 'simple', width: 832, height: 480, frames: 77, fps: 16 },
+ wanvace: { steps: 25, cfgScale: 5.0, sampler: 'euler', scheduler: 'simple', width: 832, height: 480, frames: 81, fps: 16 },
unknown: { steps: 20, cfgScale: 7.0, sampler: 'euler', scheduler: 'normal', width: 1024, height: 1024 },
}
@@ -189,6 +203,8 @@ interface CreateState {
trainImages: MediaRef[]
/** Character-Studio trigger word — the token that summons the character. */
triggerWord: string
+ /** Local training length (musubi steps). Quality/time tradeoff, persisted. */
+ trainSteps: number
/** The shelf character selected for use-mode generation. Runtime-only. */
selectedCharacter: CharacterRef | null
/** Lipsync speech / voice-clone reference audio. Runtime-only (blob). */
@@ -227,11 +243,16 @@ interface CreateState {
* (trainer/lipsync/music/extend/motion). One slot for all — modelForOp
* coerces a stale cross-intent pick onto the op's own list. */
cloudOpModel: string
+ /** Runtime-only: the LOCAL model picked inside a specialized lane (ACE
+ * checkpoint / S2V UNet / Animate-VACE UNet). One slot for all lanes —
+ * resolveLocalOpPick coerces a stale cross-lane pick onto the lane's list
+ * (the same one-rule guard the cloud picker got after take-01). */
+ localOpModel: string
/** Bumped when the character shelf changed (training delivered / deleted)
* so the Character-Studio surface refetches /api/loras. */
charactersVersion: number
/** Runtime-only: which local custom-node capabilities are installed. */
- caps: Record<'rmbg' | 'inpaint-nodes', boolean>
+ caps: Record<'rmbg' | 'inpaint-nodes' | 'dwpose', boolean>
isGenerating: boolean
/** Runtime-only: the user-managed ComfyUI (0.19+) blocked the WebView's
@@ -255,6 +276,12 @@ interface CreateState {
* without hosting its own ComfyUI fetching. */
imageModelList: ClassifiedModel[]
videoModelList: ClassifiedModel[]
+ /** 2.5.8 local lanes: installed specialized models, mirrored by fetchModels
+ * like the image/video lists (music ACE checkpoints, S2V UNets,
+ * Animate/VACE UNets). Runtime-only. */
+ audioModelList: ClassifiedModel[]
+ lipsyncModelList: ClassifiedModel[]
+ motionModelList: ClassifiedModel[]
comfyRunning: boolean
/** Bug A (v2.4.5) + #72 (bob): resolver for the VHS_VideoCombine install
* prompt. Runtime-only — useCreate sets it when a video gen would fall
@@ -298,12 +325,17 @@ interface CreateState {
removeTrainImage: (name: string) => void
clearTrainImages: () => void
setTriggerWord: (w: string) => void
+ setTrainSteps: (n: number) => void
setSelectedCharacter: (c: CharacterRef | null) => void
setAudioInput: (m: MediaRef | null) => void
setVoiceFromJob: (v: { jobId: string; label: string } | null) => void
setVideoInput: (m: MediaRef | null) => void
bumpCharactersVersion: () => void
setCloudOpModel: (id: string) => void
+ setLocalOpModel: (name: string) => void
+ setAudioModelList: (list: ClassifiedModel[]) => void
+ setLipsyncModelList: (list: ClassifiedModel[]) => void
+ setMotionModelList: (list: ClassifiedModel[]) => void
setExtendSource: (s: { jobId: string; url: string; label: string } | null) => void
setMusicDuration: (s: number) => void
setMusicLyrics: (l: string) => void
@@ -312,7 +344,7 @@ interface CreateState {
setBackend: (backend: CreateBackend) => void
setCloudImageModel: (id: string) => void
setCloudVideoModel: (id: string) => void
- setCaps: (caps: Record<'rmbg' | 'inpaint-nodes', boolean>) => void
+ setCaps: (caps: Record<'rmbg' | 'inpaint-nodes' | 'dwpose', boolean>) => void
resetParamsToModelDefaults: () => void
setIsGenerating: (generating: boolean) => void
@@ -378,6 +410,7 @@ export const useCreateStore = create<CreateState>()(
characterTab: 'train' as 'train' | 'use',
trainImages: [] as MediaRef[],
triggerWord: '',
+ trainSteps: 1200,
selectedCharacter: null as CharacterRef | null,
audioInput: null as MediaRef | null,
voiceFromJob: null as { jobId: string; label: string } | null,
@@ -398,8 +431,9 @@ export const useCreateStore = create<CreateState>()(
cloudImageModel: '',
cloudVideoModel: '',
cloudOpModel: '',
+ localOpModel: '',
charactersVersion: 0,
- caps: { rmbg: false, 'inpaint-nodes': false } as Record<'rmbg' | 'inpaint-nodes', boolean>,
+ caps: { rmbg: false, 'inpaint-nodes': false, dwpose: false } as Record<'rmbg' | 'inpaint-nodes' | 'dwpose', boolean>,
isGenerating: false,
comfyCorsBlocked: false,
@@ -416,6 +450,9 @@ export const useCreateStore = create<CreateState>()(
promptHistory: [],
imageModelList: [],
videoModelList: [],
+ audioModelList: [],
+ lipsyncModelList: [],
+ motionModelList: [],
comfyRunning: false,
vhsInstallPrompt: null,
@@ -462,9 +499,12 @@ export const useCreateStore = create<CreateState>()(
setVideoModel: (model) => {
const type = classifyModel(model)
const defaults = MODEL_TYPE_DEFAULTS[type] || MODEL_TYPE_DEFAULTS.unknown
+ // Lightning/rapid merges are distilled to few steps at cfg 1 — the
+ // architecture defaults (30 steps, cfg 5+) render them to mush.
+ const lightning = /rapid|lightning|lightx2v/i.test(model)
set({
videoModel: model,
- steps: defaults.steps, cfgScale: defaults.cfgScale,
+ steps: lightning ? 6 : defaults.steps, cfgScale: lightning ? 1.0 : defaults.cfgScale,
sampler: defaults.sampler, scheduler: defaults.scheduler,
width: defaults.width, height: defaults.height,
...(defaults.frames ? { frames: defaults.frames } : {}),
@@ -502,16 +542,37 @@ export const useCreateStore = create<CreateState>()(
// only read by their own intent — no cross-intent bleed to clear.
case 'character':
return { ...base, cloudOp: 'character' as const, mode: 'image' as const, imageSubMode: 'text2img' as const, ...dropAll }
- case 'lipsync':
+ case 'lipsync': {
// Keeps the source slot (the portrait a photo-avatar model speaks).
- return { ...base, cloudOp: 'lipsync' as const, mode: 'video' as const, videoSubMode: 'i2v' as const, mask: null }
- case 'music':
- return { ...base, cloudOp: 'music' as const, ...dropAll }
- case 'extend':
- return { ...base, cloudOp: 'extend' as const, mode: 'video' as const, videoSubMode: 't2v' as const, ...dropAll }
- case 'motion':
+ // Adopts the S2V architecture defaults so the local lane never
+ // inherits an Image-tab 1024×1024 into a 14B video graph.
+ const d = MODEL_TYPE_DEFAULTS.wans2v
+ return { ...base, cloudOp: 'lipsync' as const, mode: 'video' as const, videoSubMode: 'i2v' as const, mask: null,
+ steps: d.steps, cfgScale: d.cfgScale, sampler: d.sampler, scheduler: d.scheduler,
+ width: d.width, height: d.height, ...(d.frames ? { frames: d.frames } : {}), ...(d.fps ? { fps: d.fps } : {}) }
+ }
+ case 'music': {
+ // Pin the underlying mode: an inherited img2img mode would trip
+ // the local flow's "add a source image" guard for a prompt-only op.
+ const d = MODEL_TYPE_DEFAULTS.ace
+ return { ...base, cloudOp: 'music' as const, mode: 'image' as const, imageSubMode: 'text2img' as const, ...dropAll,
+ steps: d.steps, cfgScale: d.cfgScale, sampler: d.sampler, scheduler: d.scheduler }
+ }
+ case 'extend': {
+ // The local lane continues from the picked clip's last frame —
+ // regular I2V models, regular video defaults.
+ const d = MODEL_TYPE_DEFAULTS[classifyModel(s.videoModel)] || MODEL_TYPE_DEFAULTS.unknown
+ return { ...base, cloudOp: 'extend' as const, mode: 'video' as const, videoSubMode: 't2v' as const, ...dropAll,
+ steps: d.steps, cfgScale: d.cfgScale, sampler: d.sampler, scheduler: d.scheduler,
+ width: d.width, height: d.height, ...(d.frames ? { frames: d.frames } : {}), ...(d.fps ? { fps: d.fps } : {}) }
+ }
+ case 'motion': {
// Keeps the source slot (the character image the video drives).
- return { ...base, cloudOp: 'motion' as const, mode: 'video' as const, videoSubMode: 'i2v' as const, mask: null }
+ const d = MODEL_TYPE_DEFAULTS.wananimate
+ return { ...base, cloudOp: 'motion' as const, mode: 'video' as const, videoSubMode: 'i2v' as const, mask: null,
+ steps: d.steps, cfgScale: d.cfgScale, sampler: d.sampler, scheduler: d.scheduler,
+ width: d.width, height: d.height, ...(d.frames ? { frames: d.frames } : {}), ...(d.fps ? { fps: d.fps } : {}) }
+ }
case 'image': return { ...base, mode: 'image' as const, imageSubMode: 'text2img' as const, ...dropAll }
case 'edit': return { ...base, mode: 'image' as const, imageSubMode: 'img2img' as const }
case 'removebg': return { ...base, removebg: true, mode: 'image' as const, imageSubMode: 'img2img' as const, mask: null }
@@ -551,6 +612,8 @@ export const useCreateStore = create<CreateState>()(
removeTrainImage: (name) => set((s) => ({ trainImages: s.trainImages.filter((i) => i.name !== name) })),
clearTrainImages: () => set({ trainImages: [] }),
setTriggerWord: (w) => set({ triggerWord: w.replace(/\s+/g, '').slice(0, 30) }),
+ // Same clamp as the Rust command so the UI can never book a rejected run.
+ setTrainSteps: (n) => set({ trainSteps: Math.max(100, Math.min(4000, Math.floor(n))) }),
setSelectedCharacter: (selectedCharacter) => set({ selectedCharacter }),
// Upload and voice-pick are mutually exclusive speech sources.
setAudioInput: (audioInput) => set({ audioInput, ...(audioInput ? { voiceFromJob: null } : {}) }),
@@ -558,6 +621,23 @@ export const useCreateStore = create<CreateState>()(
setVideoInput: (videoInput) => set({ videoInput }),
bumpCharactersVersion: () => set((s) => ({ charactersVersion: s.charactersVersion + 1 })),
setCloudOpModel: (cloudOpModel) => set({ cloudOpModel }),
+ // Picking a lane model adopts its architecture defaults (like
+ // setVideoModel does) — an inherited 1024×1024 from the Image tab would
+ // OOM a 14B S2V run on consumer VRAM.
+ setLocalOpModel: (localOpModel) => {
+ const d = MODEL_TYPE_DEFAULTS[classifyModel(localOpModel)]
+ set(d
+ ? {
+ localOpModel,
+ steps: d.steps, cfgScale: d.cfgScale, sampler: d.sampler, scheduler: d.scheduler,
+ width: d.width, height: d.height,
+ ...(d.frames ? { frames: d.frames } : {}), ...(d.fps ? { fps: d.fps } : {}),
+ }
+ : { localOpModel })
+ },
+ setAudioModelList: (audioModelList) => set({ audioModelList }),
+ setLipsyncModelList: (lipsyncModelList) => set({ lipsyncModelList }),
+ setMotionModelList: (motionModelList) => set({ motionModelList }),
setExtendSource: (extendSource) => set({ extendSource }),
setMusicDuration: (s2) => set({ musicDuration: Math.max(5, Math.min(240, Math.floor(s2))) }),
setMusicLyrics: (musicLyrics) => set({ musicLyrics: musicLyrics.slice(0, 2000) }),
@@ -574,8 +654,12 @@ export const useCreateStore = create<CreateState>()(
if (backend !== 'local') return { backend }
const patch: Record<string, unknown> = { backend }
if (s.utilityOp) Object.assign(patch, { utilityOp: null, mask: null, error: null })
- // The 2.5.8 categories are hosted-only too — never strand on one.
- if (s.cloudOp) Object.assign(patch, { cloudOp: null, error: null })
+ // 2.5.8: every specialized category runs locally now, so a backend
+ // flip keeps the selection. The guard stays for future cloud-only
+ // ops (LOCAL_LANE_OPS is the single source of truth).
+ if (s.cloudOp && !LOCAL_LANE_OPS.has(s.cloudOp)) {
+ Object.assign(patch, { cloudOp: null, error: null })
+ }
return patch
}),
setCloudImageModel: (cloudImageModel) => set({ cloudImageModel }),
@@ -647,6 +731,7 @@ export const useCreateStore = create<CreateState>()(
// staged media (blobs / object URLs) and cloudOp are runtime-only.
musicDuration: state.musicDuration,
triggerWord: state.triggerWord,
+ trainSteps: state.trainSteps,
}),
// Future schema bumps hook into migrate. NOTE: zustand only invokes it
// when the stored blob carries a NUMERIC version that differs — legacy