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.

Add full video generation support (Wan 2.1/2.2 + AnimateDiff)

PurpleDoubleD25886acad5e5
diff --git a/README.md b/README.md
index 949004da..c614e84a 100644
--- a/README.md
+++ b/README.md
@@ -93,6 +93,20 @@ start.bat
| FLUX.1 Schnell | 10-12 GB | State-of-the-art |
| Pony Diffusion V6 XL | 8 GB | Anime/stylized |
+### Video (ComfyUI)
+
+The app auto-detects your video backend (Wan 2.1/2.2 or AnimateDiff).
+
+| Model | VRAM | Output | Notes |
+|-------|------|--------|-------|
+| Wan 2.1 T2V 1.3B | 8-10 GB | 480p WEBP | Built-in nodes, no extras needed |
+| Wan 2.2 T2V 14B (FP8) | 10-12 GB | 480-720p | Higher quality, quantized |
+| AnimateDiff v3 + SD1.5 | 6-8 GB | MP4 | Requires AnimateDiff custom nodes |
+
+**Wan setup:** Place models in ComfyUI's `models/diffusion_models/`, `models/text_encoders/`, and `models/vae/` folders.
+
+**AnimateDiff setup:** Install [ComfyUI-AnimateDiff-Evolved](https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved) and [ComfyUI-VideoHelperSuite](https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite) via ComfyUI Manager.
+
## Configuration
### Environment Variables
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 41fbe5e3..fa18ea62 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -27,6 +27,10 @@ export interface ComfyUIOutput {
type: string
}
+export type VideoBackend = 'wan' | 'animatediff' | 'none'
+
+// ─── Connection & Info ───
+
export async function checkComfyConnection(): Promise<boolean> {
try {
const res = await fetch('/comfyui/system_stats')
@@ -46,13 +50,43 @@ export async function getCheckpoints(): Promise<string[]> {
}
}
+export async function getDiffusionModels(): Promise<string[]> {
+ try {
+ const res = await fetch('/comfyui/object_info/UNETLoader')
+ const data = await res.json()
+ return data?.UNETLoader?.input?.required?.unet_name?.[0] || []
+ } catch {
+ return []
+ }
+}
+
+export async function getVAEModels(): Promise<string[]> {
+ try {
+ const res = await fetch('/comfyui/object_info/VAELoader')
+ const data = await res.json()
+ return data?.VAELoader?.input?.required?.vae_name?.[0] || []
+ } catch {
+ return []
+ }
+}
+
+export async function getCLIPModels(): Promise<string[]> {
+ try {
+ const res = await fetch('/comfyui/object_info/CLIPLoader')
+ const data = await res.json()
+ return data?.CLIPLoader?.input?.required?.clip_name?.[0] || []
+ } catch {
+ return []
+ }
+}
+
export async function getSamplers(): Promise<string[]> {
try {
const res = await fetch('/comfyui/object_info/KSampler')
const data = await res.json()
return data?.KSampler?.input?.required?.sampler_name?.[0] || []
} catch {
- return ['euler', 'euler_ancestral', 'dpmpp_2m', 'dpmpp_sde', 'ddim']
+ return ['euler', 'euler_ancestral', 'dpmpp_2m', 'dpmpp_sde', 'uni_pc', 'ddim']
}
}
@@ -62,17 +96,40 @@ export async function getSchedulers(): Promise<string[]> {
const data = await res.json()
return data?.KSampler?.input?.required?.scheduler?.[0] || []
} catch {
- return ['normal', 'karras', 'exponential', 'sgm_uniform']
+ return ['normal', 'karras', 'simple', 'exponential', 'sgm_uniform']
}
}
+// ─── Detect available video backend ───
+
+export async function detectVideoBackend(): Promise<VideoBackend> {
+ try {
+ const res = await fetch('/comfyui/object_info')
+ const data = await res.json()
+ // Check for Wan nodes (built-in, preferred)
+ if (data['EmptyHunyuanLatentVideo'] && data['UNETLoader'] && data['CLIPLoader'] && data['VAELoader']) {
+ return 'wan'
+ }
+ // Check for AnimateDiff nodes (custom, fallback)
+ if (data['ADE_LoadAnimateDiffModel'] && data['ADE_UseEvolvedSampling']) {
+ return 'animatediff'
+ }
+ } catch { /* ignore */ }
+ return 'none'
+}
+
+// ─── Workflow Submission ───
+
export async function submitWorkflow(workflow: Record<string, any>): Promise<string> {
const res = await fetch('/comfyui/prompt', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prompt: workflow }),
})
- if (!res.ok) throw new Error('Failed to submit workflow')
+ if (!res.ok) {
+ const err = await res.text()
+ throw new Error(`Failed to submit workflow: ${err}`)
+ }
const data = await res.json()
return data.prompt_id
}
@@ -88,7 +145,10 @@ export function getImageUrl(filename: string, subfolder: string = '', type: stri
return `/comfyui/view?filename=${encodeURIComponent(filename)}&subfolder=${encodeURIComponent(subfolder)}&type=${type}`
}
+// ─── Image Workflow (Standard SDXL/SD) ───
+
export function buildTxt2ImgWorkflow(params: GenerateParams): Record<string, any> {
+ const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
return {
'1': {
class_type: 'CheckpointLoaderSimple',
@@ -113,7 +173,7 @@ export function buildTxt2ImgWorkflow(params: GenerateParams): Record<string, any
positive: ['2', 0],
negative: ['3', 0],
latent_image: ['4', 0],
- seed: params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed,
+ seed,
steps: params.steps,
cfg: params.cfgScale,
sampler_name: params.sampler,
@@ -132,33 +192,131 @@ export function buildTxt2ImgWorkflow(params: GenerateParams): Record<string, any
}
}
-export function buildTxt2VidWorkflow(params: VideoParams): Record<string, any> {
- // Wan2.1 Text-to-Video workflow
+// ─── Video Workflow: Wan 2.1/2.2 (built-in nodes) ───
+
+export function buildWanVideoWorkflow(params: VideoParams): Record<string, any> {
+ const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
+
+ // Auto-detect model files from the selected model name
+ // Users select a diffusion model; we try to find matching CLIP and VAE
+ return {
+ '1': {
+ class_type: 'CLIPLoader',
+ inputs: {
+ clip_name: params.model.includes('clip') ? params.model : 'umt5_xxl_fp8_e4m3fn_scaled.safetensors',
+ type: 'wan',
+ device: 'default',
+ },
+ },
+ '2': {
+ class_type: 'UNETLoader',
+ inputs: {
+ unet_name: params.model,
+ weight_dtype: 'default',
+ },
+ },
+ '3': {
+ class_type: 'VAELoader',
+ inputs: {
+ vae_name: 'wan_2.1_vae.safetensors',
+ },
+ },
+ '4': {
+ class_type: 'CLIPTextEncode',
+ inputs: { text: params.prompt, clip: ['1', 0] },
+ },
+ '5': {
+ class_type: 'CLIPTextEncode',
+ inputs: { text: params.negativePrompt || 'static, blurred, low quality, worst quality, deformed', clip: ['1', 0] },
+ },
+ '6': {
+ class_type: 'EmptyHunyuanLatentVideo',
+ inputs: {
+ width: params.width,
+ height: params.height,
+ length: params.frames,
+ batch_size: 1,
+ },
+ },
+ '7': {
+ class_type: 'KSampler',
+ inputs: {
+ model: ['2', 0],
+ positive: ['4', 0],
+ negative: ['5', 0],
+ latent_image: ['6', 0],
+ seed,
+ steps: params.steps,
+ cfg: params.cfgScale,
+ sampler_name: params.sampler || 'uni_pc',
+ scheduler: 'simple',
+ denoise: 1.0,
+ },
+ },
+ '8': {
+ class_type: 'VAEDecode',
+ inputs: { samples: ['7', 0], vae: ['3', 0] },
+ },
+ '9': {
+ class_type: 'SaveAnimatedWEBP',
+ inputs: {
+ images: ['8', 0],
+ filename_prefix: 'locally_uncensored_vid',
+ fps: params.fps,
+ lossless: false,
+ quality: 90,
+ method: 'default',
+ },
+ },
+ }
+}
+
+// ─── Video Workflow: AnimateDiff (requires custom nodes) ───
+
+export function buildAnimateDiffWorkflow(params: VideoParams): Record<string, any> {
+ const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
+
return {
'1': {
class_type: 'CheckpointLoaderSimple',
inputs: { ckpt_name: params.model },
},
'2': {
+ class_type: 'ADE_LoadAnimateDiffModel',
+ inputs: { model_name: 'mm_sd15_v3.safetensors' },
+ },
+ '3': {
+ class_type: 'ADE_ApplyAnimateDiffModelSimple',
+ inputs: { motion_model: ['2', 0] },
+ },
+ '4': {
+ class_type: 'ADE_UseEvolvedSampling',
+ inputs: {
+ model: ['1', 0],
+ m_models: ['3', 0],
+ beta_schedule: 'autoselect',
+ },
+ },
+ '5': {
class_type: 'CLIPTextEncode',
inputs: { text: params.prompt, clip: ['1', 1] },
},
- '3': {
+ '6': {
class_type: 'CLIPTextEncode',
- inputs: { text: params.negativePrompt || '', clip: ['1', 1] },
+ inputs: { text: params.negativePrompt || 'low quality, blurry, static', clip: ['1', 1] },
},
- '4': {
+ '7': {
class_type: 'EmptyLatentImage',
inputs: { width: params.width, height: params.height, batch_size: params.frames },
},
- '5': {
+ '8': {
class_type: 'KSampler',
inputs: {
- model: ['1', 0],
- positive: ['2', 0],
- negative: ['3', 0],
- latent_image: ['4', 0],
- seed: params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed,
+ model: ['4', 0],
+ positive: ['5', 0],
+ negative: ['6', 0],
+ latent_image: ['7', 0],
+ seed,
steps: params.steps,
cfg: params.cfgScale,
sampler_name: params.sampler,
@@ -166,13 +324,34 @@ export function buildTxt2VidWorkflow(params: VideoParams): Record<string, any> {
denoise: 1.0,
},
},
- '6': {
+ '9': {
class_type: 'VAEDecode',
- inputs: { samples: ['5', 0], vae: ['1', 2] },
+ inputs: { samples: ['8', 0], vae: ['1', 2] },
},
- '7': {
- class_type: 'SaveImage',
- inputs: { images: ['6', 0], filename_prefix: 'locally_uncensored_vid' },
+ '10': {
+ class_type: 'VHS_VideoCombine',
+ inputs: {
+ images: ['9', 0],
+ frame_rate: params.fps,
+ loop_count: 0,
+ filename_prefix: 'locally_uncensored_vid',
+ format: 'video/h264-mp4',
+ pingpong: false,
+ save_output: true,
+ },
},
}
}
+
+// ─── Auto-select the right video workflow ───
+
+export function buildTxt2VidWorkflow(params: VideoParams, backend: VideoBackend): Record<string, any> {
+ switch (backend) {
+ case 'wan':
+ return buildWanVideoWorkflow(params)
+ case 'animatediff':
+ return buildAnimateDiffWorkflow(params)
+ default:
+ throw new Error('No video generation backend available. Install Wan 2.1 models or AnimateDiff nodes in ComfyUI.')
+ }
+}
diff --git a/src/components/create/CreateView.tsx b/src/components/create/CreateView.tsx
index 02806ea8..e0770ccd 100644
--- a/src/components/create/CreateView.tsx
+++ b/src/components/create/CreateView.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState, useCallback, useRef } from 'react'
-import { Image, Video, WifiOff, Play, Loader2, CheckCircle } from 'lucide-react'
+import { Image, Video, WifiOff, Play, Loader2, CheckCircle, AlertTriangle } from 'lucide-react'
import { useCreate } from '../../hooks/useCreate'
import { useCreateStore } from '../../stores/createStore'
import { PromptInput } from './PromptInput'
@@ -8,7 +8,7 @@ import { OutputDisplay } from './OutputDisplay'
import { Gallery } from './Gallery'
export function CreateView() {
- const { connected, checkpoints, samplerList, checkConnection, fetchModels, generate, cancel } = useCreate()
+ const { connected, checkpoints, videoModels, samplerList, videoBackend, checkConnection, fetchModels, generate, cancel } = useCreate()
const { mode, setMode } = useCreateStore()
const [starting, setStarting] = useState(false)
@@ -108,6 +108,19 @@ export function CreateView() {
</button>
</div>
+ {mode === 'video' && videoBackend === 'none' && connected === true && (
+ <div className="flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-50 dark:bg-yellow-500/10 border border-yellow-200 dark:border-yellow-500/20 text-yellow-700 dark:text-yellow-400 text-xs">
+ <AlertTriangle size={14} />
+ <span>No video nodes detected. Install Wan 2.1 models or AnimateDiff in ComfyUI for video generation.</span>
+ </div>
+ )}
+
+ {mode === 'video' && videoBackend !== 'none' && connected === true && (
+ <div className="text-xs text-gray-400">
+ Video backend: <span className="text-gray-300 font-medium">{videoBackend === 'wan' ? 'Wan 2.1/2.2' : 'AnimateDiff'}</span>
+ </div>
+ )}
+
<PromptInput onGenerate={generate} onCancel={cancel} />
</div>
@@ -121,7 +134,7 @@ export function CreateView() {
{/* Parameter sidebar */}
<div className="w-64 border-l border-gray-200 dark:border-white/5 bg-gray-50 dark:bg-[#1a1a1a] p-4 overflow-y-auto scrollbar-thin hidden lg:block">
<h3 className="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-4">Parameters</h3>
- <ParamPanel checkpoints={checkpoints} samplerList={samplerList} />
+ <ParamPanel checkpoints={checkpoints} videoModels={videoModels} samplerList={samplerList} />
</div>
</div>
</div>
diff --git a/src/components/create/ParamPanel.tsx b/src/components/create/ParamPanel.tsx
index 9b4dffbd..1d899013 100644
--- a/src/components/create/ParamPanel.tsx
+++ b/src/components/create/ParamPanel.tsx
@@ -4,10 +4,11 @@ import { Dice5 } from 'lucide-react'
interface Props {
checkpoints: string[]
+ videoModels: string[]
samplerList: string[]
}
-const SIZE_PRESETS = [
+const IMG_SIZE_PRESETS = [
{ label: '512', w: 512, h: 512 },
{ label: '768', w: 768, h: 768 },
{ label: '1024', w: 1024, h: 1024 },
@@ -15,8 +16,18 @@ const SIZE_PRESETS = [
{ label: '1344x768', w: 1344, h: 768 },
]
-export function ParamPanel({ checkpoints, samplerList }: Props) {
+const VID_SIZE_PRESETS = [
+ { label: '480p', w: 832, h: 480 },
+ { label: '512', w: 512, h: 512 },
+ { label: '768x480', w: 768, h: 480 },
+ { label: '480x768', w: 480, h: 768 },
+]
+
+export function ParamPanel({ checkpoints, videoModels, samplerList }: Props) {
const store = useCreateStore()
+ const isVideo = store.mode === 'video'
+ const sizePresets = isVideo ? VID_SIZE_PRESETS : IMG_SIZE_PRESETS
+ const modelList = isVideo ? videoModels : checkpoints
const selectClass = 'w-full px-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-300 dark:border-white/10 text-gray-900 dark:text-white text-sm focus:outline-none focus:border-gray-400 dark:focus:border-white/20 appearance-none cursor-pointer'
@@ -24,10 +35,12 @@ export function ParamPanel({ checkpoints, samplerList }: Props) {
<div className="space-y-4">
{/* Model */}
<div>
- <label className="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-1.5 block">Model</label>
+ <label className="text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-1.5 block">
+ {isVideo ? 'Video Model' : 'Image Model'}
+ </label>
<select value={store.model} onChange={(e) => store.setModel(e.target.value)} className={selectClass}>
- {checkpoints.length === 0 && <option value="">No models found</option>}
- {checkpoints.map((c) => (
+ {modelList.length === 0 && <option value="">No models found</option>}
+ {modelList.map((c) => (
<option key={c} value={c}>{c.replace(/\.[^.]+$/, '')}</option>
))}
</select>
@@ -55,7 +68,7 @@ export function ParamPanel({ checkpoints, samplerList }: Props) {
Size ({store.width}x{store.height})
</label>
<div className="flex flex-wrap gap-1.5">
- {SIZE_PRESETS.map((preset) => (
+ {sizePresets.map((preset) => (
<button
key={preset.label}
onClick={() => { store.setWidth(preset.w); store.setHeight(preset.h) }}
@@ -92,10 +105,10 @@ export function ParamPanel({ checkpoints, samplerList }: Props) {
</div>
</div>
- {/* Video params */}
- {store.mode === 'video' && (
+ {/* Video-specific params */}
+ {isVideo && (
<>
- <SliderControl label="Frames" value={store.frames} min={8} max={120} step={1} onChange={store.setFrames} />
+ <SliderControl label="Frames" value={store.frames} min={8} max={81} step={1} onChange={store.setFrames} />
<SliderControl label="FPS" value={store.fps} min={4} max={30} step={1} onChange={store.setFps} />
</>
)}
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 10a7ba55..126ab6f9 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -3,12 +3,15 @@ import { v4 as uuid } from 'uuid'
import {
checkComfyConnection,
getCheckpoints,
+ getDiffusionModels,
getSamplers,
+ detectVideoBackend,
submitWorkflow,
getHistory,
buildTxt2ImgWorkflow,
buildTxt2VidWorkflow,
type ComfyUIOutput,
+ type VideoBackend,
} from '../api/comfyui'
import { useCreateStore, type GalleryItem } from '../stores/createStore'
@@ -16,7 +19,9 @@ export function useCreate() {
const store = useCreateStore()
const [connected, setConnected] = useState<boolean | null>(null)
const [checkpoints, setCheckpoints] = useState<string[]>([])
+ const [videoModels, setVideoModels] = useState<string[]>([])
const [samplerList, setSamplerList] = useState<string[]>([])
+ const [videoBackend, setVideoBackend] = useState<VideoBackend>('none')
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)
const checkConnection = useCallback(async () => {
@@ -26,9 +31,17 @@ export function useCreate() {
}, [])
const fetchModels = useCallback(async () => {
- const [ckpts, samplers] = await Promise.all([getCheckpoints(), getSamplers()])
+ const [ckpts, diffModels, samplers, vBackend] = await Promise.all([
+ getCheckpoints(),
+ getDiffusionModels(),
+ getSamplers(),
+ detectVideoBackend(),
+ ])
setCheckpoints(ckpts)
+ setVideoModels(diffModels)
setSamplerList(samplers)
+ setVideoBackend(vBackend)
+
if (ckpts.length > 0 && !store.model) {
store.setModel(ckpts[0])
}
@@ -48,7 +61,7 @@ export function useCreate() {
try {
const workflow = mode === 'video'
- ? buildTxt2VidWorkflow({ prompt, negativePrompt, model, sampler, steps, cfgScale, width, height, seed, frames, fps })
+ ? buildTxt2VidWorkflow({ prompt, negativePrompt, model, sampler, steps, cfgScale, width, height, seed, frames, fps }, videoBackend)
: buildTxt2ImgWorkflow({ prompt, negativePrompt, model, sampler, steps, cfgScale, width, height, seed })
const promptId = await submitWorkflow(workflow)
@@ -57,7 +70,7 @@ export function useCreate() {
// Poll for completion
await new Promise<void>((resolve, reject) => {
let attempts = 0
- const maxAttempts = 600 // 10 minutes at 1s intervals
+ const maxAttempts = 1200 // 20 minutes for video (can be slow)
pollRef.current = setInterval(async () => {
attempts++
@@ -78,17 +91,21 @@ export function useCreate() {
clearInterval(pollRef.current!)
setProgress(100)
- // Extract outputs
+ // Extract outputs — check images, gifs, and videos
const outputs = history.outputs || {}
for (const nodeId of Object.keys(outputs)) {
const nodeOutput = outputs[nodeId]
- const images: ComfyUIOutput[] = nodeOutput.images || nodeOutput.gifs || []
- for (const img of images) {
+ const files: ComfyUIOutput[] = [
+ ...(nodeOutput.images || []),
+ ...(nodeOutput.gifs || []),
+ ...(nodeOutput.videos || []),
+ ]
+ for (const file of files) {
const galleryItem: GalleryItem = {
id: uuid(),
type: mode,
- filename: img.filename,
- subfolder: img.subfolder || '',
+ filename: file.filename,
+ subfolder: file.subfolder || '',
prompt,
negativePrompt,
model,
@@ -120,7 +137,7 @@ export function useCreate() {
setCurrentPromptId(null)
if (pollRef.current) clearInterval(pollRef.current)
}
- }, [])
+ }, [videoBackend])
const cancel = useCallback(() => {
if (pollRef.current) {
@@ -134,7 +151,9 @@ export function useCreate() {
return {
connected,
checkpoints,
+ videoModels,
samplerList,
+ videoBackend,
checkConnection,
fetchModels,
generate,