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: v2.3.0 — ComfyUI Plug & Play, 14 video models, unified downloads

PurpleDoubleDc27d20c87022
diff --git a/src-tauri/src/commands/download.rs b/src-tauri/src/commands/download.rs
index 77f6876f..6f6c3ca1 100644
--- a/src-tauri/src/commands/download.rs
+++ b/src-tauri/src/commands/download.rs
@@ -425,3 +425,121 @@ pub fn download_progress(state: State<'_, AppState>) -> Result<serde_json::Value
let map: HashMap<String, DownloadProgress> = downloads.clone();
Ok(serde_json::to_value(map).unwrap_or_default())
}
+
+// ─── HuggingFace GGUF Downloads (to provider model dirs) ───
+
+#[tauri::command]
+pub fn detect_model_path(provider: String) -> Result<serde_json::Value, String> {
+ let home = dirs::home_dir().ok_or("Cannot find home directory")?;
+ let provider_lower = provider.to_lowercase();
+
+ let candidates: Vec<PathBuf> = match provider_lower.as_str() {
+ "lm studio" | "lmstudio" => vec![
+ home.join(".cache").join("lm-studio").join("models"),
+ ],
+ "jan" => vec![
+ dirs::data_dir().unwrap_or_else(|| home.clone()).join("Jan").join("data").join("models"),
+ home.join("jan").join("models"),
+ ],
+ "gpt4all" => vec![
+ dirs::data_local_dir().unwrap_or_else(|| home.clone()).join("nomic.ai").join("GPT4All"),
+ ],
+ "localai" => vec![
+ home.join(".localai").join("models"),
+ ],
+ _ => vec![], // vLLM, llama.cpp, etc. — no standard path
+ };
+
+ for path in &candidates {
+ if path.exists() {
+ return Ok(serde_json::json!(path.to_string_lossy()));
+ }
+ }
+
+ // Fallback: create LU models directory
+ let fallback = home.join("locally-uncensored").join("models");
+ fs::create_dir_all(&fallback).map_err(|e| format!("Create fallback dir: {}", e))?;
+ Ok(serde_json::json!(fallback.to_string_lossy()))
+}
+
+#[tauri::command]
+pub async fn download_model_to_path(
+ url: String,
+ dest_dir: String,
+ filename: String,
+ state: State<'_, AppState>,
+) -> Result<serde_json::Value, String> {
+ let dir = PathBuf::from(&dest_dir);
+ fs::create_dir_all(&dir).map_err(|e| format!("Create dest dir: {}", e))?;
+ let dest_file = dir.join(&filename);
+
+ if dest_file.exists() {
+ return Ok(serde_json::json!({"status": "exists", "path": dest_file.to_string_lossy()}));
+ }
+
+ let id = filename.clone();
+ let tmp_path = dest_file.with_extension("download");
+ let resume_offset = if tmp_path.exists() {
+ tmp_path.metadata().map(|m| m.len()).unwrap_or(0)
+ } else {
+ 0
+ };
+
+ let token = CancellationToken::new();
+ {
+ let mut tokens = state.download_tokens.lock().unwrap();
+ tokens.insert(id.clone(), token.clone());
+ }
+ {
+ let mut downloads = state.downloads.lock().unwrap();
+ downloads.insert(id.clone(), DownloadProgress {
+ progress: resume_offset,
+ total: 0,
+ speed: 0.0,
+ filename: filename.clone(),
+ status: "connecting".to_string(),
+ error: None,
+ });
+ }
+
+ let downloads_arc = Arc::clone(&state.downloads);
+ let tokens_arc = Arc::clone(&state.download_tokens);
+ let id_clone = id.clone();
+ let filename_clone = filename.clone();
+
+ tokio::spawn(async move {
+ match do_download(&url, &dest_file, &downloads_arc, &id_clone, token, resume_offset).await {
+ Ok(_) => {
+ if let Ok(mut dl) = downloads_arc.lock() {
+ if let Some(p) = dl.get_mut(&id_clone) {
+ p.status = "complete".to_string();
+ }
+ }
+ println!("[Download] Complete: {} -> {}", filename_clone, dest_dir);
+ }
+ Err(e) => {
+ if e == "paused" {
+ println!("[Download] Paused: {}", filename_clone);
+ } else if e == "cancelled" {
+ let tmp = dest_file.with_extension("download");
+ let _ = std::fs::remove_file(&tmp);
+ if let Ok(mut dl) = downloads_arc.lock() {
+ dl.remove(&id_clone);
+ }
+ } else {
+ if let Ok(mut dl) = downloads_arc.lock() {
+ if let Some(p) = dl.get_mut(&id_clone) {
+ p.status = "error".to_string();
+ p.error = Some(e.clone());
+ }
+ }
+ }
+ }
+ }
+ if let Ok(mut tokens) = tokens_arc.lock() {
+ tokens.remove(&id_clone);
+ }
+ });
+
+ Ok(serde_json::json!({"status": "started", "id": id}))
+}
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index d381c0af..5533b1e6 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -115,3 +115,87 @@ pub fn install_comfyui_status(state: State<'_, AppState>) -> Result<serde_json::
"logs": install.logs,
}))
}
+
+#[tauri::command]
+pub fn install_custom_node(
+ state: State<'_, AppState>,
+ repo_url: String,
+ node_name: String,
+) -> Result<serde_json::Value, String> {
+ // Find ComfyUI path from state
+ let comfy_path = {
+ let path = state.comfy_path.lock().unwrap();
+ path.clone()
+ };
+
+ let comfy_dir = match comfy_path {
+ Some(p) => PathBuf::from(p),
+ None => {
+ // Try to find it
+ match crate::commands::process::find_comfyui_path() {
+ Some(p) => PathBuf::from(p),
+ None => return Err("ComfyUI not found. Install ComfyUI first.".to_string()),
+ }
+ }
+ };
+
+ let custom_nodes_dir = comfy_dir.join("custom_nodes");
+ let target_dir = custom_nodes_dir.join(&node_name);
+
+ // Create custom_nodes dir if it doesn't exist
+ if !custom_nodes_dir.exists() {
+ fs::create_dir_all(&custom_nodes_dir)
+ .map_err(|e| format!("Failed to create custom_nodes directory: {}", e))?;
+ }
+
+ if target_dir.exists() {
+ // Already exists — git pull to update
+ println!("[Install] Custom node {} already exists, updating...", node_name);
+ let output = Command::new("git")
+ .args(["pull"])
+ .current_dir(&target_dir)
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .output()
+ .map_err(|e| format!("Git pull failed: {}", e))?;
+
+ let status = if output.status.success() { "updated" } else { "update_failed" };
+ Ok(serde_json::json!({
+ "status": status,
+ "path": target_dir.to_string_lossy(),
+ }))
+ } else {
+ // Clone the repo
+ println!("[Install] Cloning custom node {} from {}", node_name, repo_url);
+ let output = Command::new("git")
+ .args(["clone", &repo_url])
+ .arg(&target_dir)
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .output()
+ .map_err(|e| format!("Git clone failed: {}", e))?;
+
+ if output.status.success() {
+ // Install requirements.txt if it exists
+ let reqs = target_dir.join("requirements.txt");
+ if reqs.exists() {
+ let python_bin = state.python_bin.clone();
+ println!("[Install] Installing requirements for {}...", node_name);
+ let _ = Command::new(&python_bin)
+ .args(["-m", "pip", "install", "-r"])
+ .arg(&reqs)
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .output();
+ }
+
+ Ok(serde_json::json!({
+ "status": "installed",
+ "path": target_dir.to_string_lossy(),
+ }))
+ } else {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ Err(format!("Failed to clone {}: {}", node_name, stderr))
+ }
+ }
+}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 9a3f6490..a72c0e5e 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -30,6 +30,7 @@ fn main() {
// Installation
commands::install::install_comfyui,
commands::install::install_comfyui_status,
+ commands::install::install_custom_node,
// Whisper STT
commands::whisper::whisper_status,
commands::whisper::transcribe,
@@ -52,10 +53,12 @@ fn main() {
commands::system::pick_folder,
// Downloads
commands::download::download_model,
+ commands::download::download_model_to_path,
commands::download::download_progress,
commands::download::pause_download,
commands::download::cancel_download,
commands::download::resume_download,
+ commands::download::detect_model_path,
// Web search
commands::search::web_search,
commands::search::search_status,
diff --git a/src/api/__tests__/comfyui-bundles.test.ts b/src/api/__tests__/comfyui-bundles.test.ts
new file mode 100644
index 00000000..d884c8c5
--- /dev/null
+++ b/src/api/__tests__/comfyui-bundles.test.ts
@@ -0,0 +1,141 @@
+import { getVideoBundles, CUSTOM_NODE_REGISTRY, type ModelBundle } from '../discover'
+
+describe('Video Bundle Definitions', () => {
+ let bundles: ModelBundle[]
+
+ beforeAll(() => {
+ bundles = getVideoBundles()
+ })
+
+ it('has 14 video bundles', () => {
+ expect(bundles.length).toBe(14)
+ })
+
+ it('every bundle has required fields', () => {
+ for (const b of bundles) {
+ expect(b.name).toBeTruthy()
+ expect(b.description).toBeTruthy()
+ expect(b.totalSizeGB).toBeGreaterThan(0)
+ expect(b.vramRequired).toBeTruthy()
+ expect(b.workflow).toBeTruthy()
+ expect(b.tags.length).toBeGreaterThan(0)
+ }
+ })
+
+ it('every bundle has at least 1 file with download info', () => {
+ for (const b of bundles) {
+ expect(b.files.length).toBeGreaterThan(0)
+ for (const f of b.files) {
+ expect(f.downloadUrl).toBeTruthy()
+ expect(f.filename).toBeTruthy()
+ expect(f.subfolder).toBeTruthy()
+ }
+ }
+ })
+
+ it('every file URL is https', () => {
+ for (const b of bundles) {
+ for (const f of b.files) {
+ expect(f.downloadUrl).toMatch(/^https:\/\//)
+ }
+ }
+ })
+
+ it('every file has valid subfolder', () => {
+ const validSubfolders = ['diffusion_models', 'vae', 'text_encoders', 'checkpoints', 'clip_vision',
+ 'custom_nodes/ComfyUI-AnimateDiff-Evolved/models']
+ for (const b of bundles) {
+ for (const f of b.files) {
+ expect(validSubfolders).toContain(f.subfolder)
+ }
+ }
+ })
+
+ it('bundles with customNodes reference valid registry keys', () => {
+ for (const b of bundles) {
+ if (b.customNodes) {
+ for (const key of b.customNodes) {
+ expect(CUSTOM_NODE_REGISTRY[key]).toBeDefined()
+ }
+ }
+ }
+ })
+
+ it('I2V bundles have i2v: true', () => {
+ const i2vBundles = bundles.filter(b => b.i2v)
+ expect(i2vBundles.length).toBe(2) // SVD + FramePack
+ 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)
+ })
+
+ it('LTX bundle has workflow "ltx" not "wan"', () => {
+ const ltx = bundles.find(b => b.name.includes('LTX'))
+ expect(ltx).toBeDefined()
+ expect(ltx!.workflow).toBe('ltx')
+ })
+
+ it('every workflow type is a known strategy', () => {
+ const knownWorkflows = ['wan', 'hunyuan', 'ltx', 'animatediff', 'cogvideo', 'framepack',
+ 'svd', 'mochi', 'cosmos', 'pyramidflow', 'allegro']
+ for (const b of bundles) {
+ expect(knownWorkflows).toContain(b.workflow)
+ }
+ })
+})
+
+describe('Custom Node Registry', () => {
+ it('all entries have valid GitHub repo URL', () => {
+ for (const [key, entry] of Object.entries(CUSTOM_NODE_REGISTRY)) {
+ expect(entry.repo).toMatch(/^https:\/\/github\.com\//)
+ expect(entry.name).toBeTruthy()
+ }
+ })
+
+ it('all entries have non-empty requiredNodes', () => {
+ for (const [key, entry] of Object.entries(CUSTOM_NODE_REGISTRY)) {
+ expect(entry.requiredNodes.length).toBeGreaterThan(0)
+ }
+ })
+
+ it('no duplicate repo URLs', () => {
+ const repos = Object.values(CUSTOM_NODE_REGISTRY).map(e => e.repo)
+ expect(new Set(repos).size).toBe(repos.length)
+ })
+
+ it('has 5 custom node entries', () => {
+ expect(Object.keys(CUSTOM_NODE_REGISTRY).length).toBe(5)
+ })
+})
+
+describe('Shared File Deduplication', () => {
+ let bundles: ModelBundle[]
+
+ beforeAll(() => {
+ bundles = getVideoBundles()
+ })
+
+ it('shared files use same URL across bundles', () => {
+ // clip_l.safetensors is used by HunyuanVideo and FramePack
+ const clipLBundles = bundles.filter(b =>
+ b.files.some(f => f.filename === 'clip_l.safetensors')
+ )
+ expect(clipLBundles.length).toBeGreaterThanOrEqual(2)
+
+ const urls = clipLBundles.flatMap(b =>
+ b.files.filter(f => f.filename === 'clip_l.safetensors').map(f => f.downloadUrl)
+ )
+ // All URLs for the same file should be identical
+ expect(new Set(urls).size).toBe(1)
+ })
+
+ it('cogvideox_vae.safetensors is shared between CogVideoX bundles', () => {
+ const cogBundles = bundles.filter(b => b.workflow === 'cogvideo')
+ expect(cogBundles.length).toBe(2) // 2B + 1.5 5B
+
+ for (const b of cogBundles) {
+ const vae = b.files.find(f => f.filename === 'cogvideox_vae.safetensors')
+ expect(vae).toBeDefined()
+ }
+ })
+})
diff --git a/src/api/__tests__/comfyui-integration.test.ts b/src/api/__tests__/comfyui-integration.test.ts
new file mode 100644
index 00000000..17bca75d
--- /dev/null
+++ b/src/api/__tests__/comfyui-integration.test.ts
@@ -0,0 +1,185 @@
+/**
+ * Integration tests: Full pipeline verification for all 14 video models.
+ * Tests that Bundle → Strategy → Workflow is a valid end-to-end chain
+ * WITHOUT requiring any real ComfyUI instance or model downloads.
+ */
+
+import { getVideoBundles, CUSTOM_NODE_REGISTRY, type ModelBundle } from '../discover'
+import { classifyModel, MODEL_TYPE_DEFAULTS, COMPONENT_REGISTRY as COMFYUI_REGISTRY, isVideoModelType } from '../comfyui'
+import { determineStrategy } from '../dynamic-workflow'
+import type { CategorizedNodes, AvailableModels } from '../comfyui-nodes'
+
+// Full node availability mock — all nodes installed
+function allNodesAvailable(): CategorizedNodes {
+ return {
+ loaders: [
+ 'UNETLoader', 'CheckpointLoaderSimple', 'CLIPLoader', 'VAELoader',
+ 'ImageOnlyCheckpointLoader', 'CLIPVisionLoader', 'LoadImage',
+ 'CogVideoXModelLoader', 'CogVideoXCLIPLoader',
+ 'FramePackModelLoader', 'FramePackEncode',
+ 'PyramidFlowModelLoader', 'PyramidFlowVAELoader',
+ 'AllegroModelLoader',
+ ],
+ samplers: [
+ 'KSampler', 'KSamplerAdvanced',
+ 'CogVideoXSampler', 'FramePackSampler', 'PyramidFlowSampler', 'AllegroSampler',
+ ],
+ latentInit: [
+ 'EmptyLatentImage', 'EmptySD3LatentImage', 'EmptyFlux2LatentImage',
+ 'EmptyHunyuanLatentVideo', 'EmptyLTXVLatentVideo',
+ 'EmptyMochiLatentVideo', 'EmptyCosmosLatentVideo',
+ 'CogVideoXEmptyLatents',
+ ],
+ textEncoders: ['CLIPTextEncode', 'CogVideoXTextEncode', 'PyramidFlowTextEncode', 'AllegroTextEncode'],
+ decoders: ['VAEDecode', 'CogVideoXVAEDecode', 'PyramidFlowDecode', 'AllegroDecoder'],
+ savers: ['SaveImage'],
+ videoSavers: ['VHS_VideoCombine', 'SaveAnimatedWEBP'],
+ motion: ['ADE_LoadAnimateDiffModel', 'ADE_ApplyAnimateDiffModelSimple', 'ADE_UseEvolvedSampling', 'SVD_img2vid_Conditioning', 'VideoLinearCFGGuidance'],
+ }
+}
+
+const defaultModels: AvailableModels = {
+ checkpoints: ['test_checkpoint.safetensors'],
+ unets: ['test_model.safetensors'],
+ vaes: ['test_vae.safetensors'],
+ clips: ['test_clip.safetensors'],
+ motionModels: ['animatediff_lightning_4step.safetensors'],
+}
+
+describe('Full Pipeline: Bundle → Strategy for all 14 video bundles', () => {
+ const bundles = getVideoBundles()
+
+ for (const bundle of bundles) {
+ it(`"${bundle.name}" has a valid strategy when all nodes available`, () => {
+ // 1. Find the main model file
+ const mainFile = bundle.files[0]
+ expect(mainFile).toBeDefined()
+
+ // 2. Classify the model (or use the bundle workflow directly)
+ const workflow = bundle.workflow
+
+ // 3. Map workflow to ModelType for strategy detection
+ const workflowToModelType: Record<string, string> = {
+ wan: 'wan', hunyuan: 'hunyuan', ltx: 'ltx', animatediff: 'sd15',
+ cogvideo: 'cogvideo', framepack: 'framepack', svd: 'svd',
+ mochi: 'mochi', cosmos: 'cosmos', pyramidflow: 'pyramidflow', allegro: 'allegro',
+ }
+ const modelType = workflowToModelType[workflow]
+ expect(modelType).toBeDefined()
+
+ // 4. Verify strategy is available
+ const result = determineStrategy(modelType as any, true, allNodesAvailable(), defaultModels)
+ expect(result.strategy).not.toBe('unavailable')
+ })
+ }
+})
+
+describe('Bundle consistency checks', () => {
+ const bundles = getVideoBundles()
+
+ it('all video bundle workflows map to video model types', () => {
+ const videoWorkflows = ['wan', 'hunyuan', 'ltx', 'animatediff', 'cogvideo', 'framepack', 'svd', 'mochi', 'cosmos', 'pyramidflow', 'allegro']
+ for (const b of bundles) {
+ expect(videoWorkflows).toContain(b.workflow)
+ }
+ })
+
+ it('bundles with customNodes have matching registry entries', () => {
+ for (const b of bundles) {
+ if (b.customNodes) {
+ for (const key of b.customNodes) {
+ const entry = CUSTOM_NODE_REGISTRY[key]
+ expect(entry).toBeDefined()
+ expect(entry.repo).toMatch(/^https:\/\/github\.com\//)
+ }
+ }
+ }
+ })
+
+ it('native bundles (no customNodes) use native ComfyUI strategies', () => {
+ const nativeBundles = bundles.filter(b => !b.customNodes || b.customNodes.length === 0)
+ const nativeWorkflows = ['wan', 'hunyuan', 'ltx', 'svd', 'mochi', 'cosmos']
+ for (const b of nativeBundles) {
+ expect(nativeWorkflows).toContain(b.workflow)
+ }
+ })
+
+ it('every model type with defaults has positive parameter values', () => {
+ const videoTypes = Object.keys(MODEL_TYPE_DEFAULTS)
+ for (const type of videoTypes) {
+ const d = MODEL_TYPE_DEFAULTS[type]
+ expect(d.steps).toBeGreaterThan(0)
+ expect(d.cfg).toBeGreaterThan(0)
+ expect(d.width).toBeGreaterThan(0)
+ expect(d.height).toBeGreaterThan(0)
+ expect(d.frames).toBeGreaterThan(0)
+ expect(d.fps).toBeGreaterThan(0)
+ }
+ })
+})
+
+describe('Model filename classification consistency', () => {
+ const bundles = getVideoBundles()
+
+ // For each bundle, the main model file should classify to the right type
+ const workflowToExpectedClassification: Record<string, string[]> = {
+ wan: ['wan'],
+ hunyuan: ['hunyuan'],
+ ltx: ['ltx'],
+ mochi: ['mochi'],
+ cosmos: ['cosmos'],
+ cogvideo: ['cogvideo'],
+ svd: ['svd'],
+ framepack: ['framepack'],
+ pyramidflow: ['pyramidflow'],
+ allegro: ['allegro'],
+ // AnimateDiff uses SD1.5 checkpoints — they classify as sd15 or unknown
+ animatediff: ['sd15', 'unknown'],
+ }
+
+ for (const bundle of bundles) {
+ const mainFile = bundle.files[0]
+ if (!mainFile?.filename) continue
+
+ it(`"${bundle.name}" main file classifies correctly for workflow "${bundle.workflow}"`, () => {
+ const classified = classifyModel(mainFile.filename!)
+ const expected = workflowToExpectedClassification[bundle.workflow]
+ expect(expected).toBeDefined()
+ // AnimateDiff motion models won't classify as sd15 (they're "animatediff_lightning...")
+ // and Allegro model_index.json won't classify either — that's fine
+ if (bundle.workflow === 'animatediff') {
+ // AnimateDiff motion models contain "animatediff" — but the checkpoint should be sd15
+ // Skip the motion model check, it's expected
+ return
+ }
+ if (bundle.workflow === 'allegro' && mainFile.filename?.includes('model_index')) {
+ // Allegro uses diffusers format, not safetensors — special case
+ return
+ }
+ expect(expected).toContain(classified)
+ })
+ }
+})
+
+describe('COMPONENT_REGISTRY coverage', () => {
+ it('every new video model type has a comfyui.ts registry entry', () => {
+ const videoTypes = ['wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro']
+ for (const type of videoTypes) {
+ expect(COMFYUI_REGISTRY[type]).toBeDefined()
+ }
+ })
+
+ it('Cosmos uses oldt5 not t5xxl', () => {
+ const cosmosClip = COMFYUI_REGISTRY.cosmos.clip!
+ expect(cosmosClip.matchPatterns).toContain('oldt5')
+ })
+
+ it('SVD uses ImageOnlyCheckpointLoader', () => {
+ expect(COMFYUI_REGISTRY.svd.loader).toBe('ImageOnlyCheckpointLoader')
+ })
+
+ it('FramePack shares HunyuanVideo VAE', () => {
+ const fpVae = COMFYUI_REGISTRY.framepack.vae!
+ expect(fpVae.matchPatterns).toContain('hunyuan')
+ })
+})
diff --git a/src/api/__tests__/comfyui-models.test.ts b/src/api/__tests__/comfyui-models.test.ts
new file mode 100644
index 00000000..3f3f0b18
--- /dev/null
+++ b/src/api/__tests__/comfyui-models.test.ts
@@ -0,0 +1,303 @@
+import {
+ classifyModel,
+ isVideoModelType,
+ isImageModelType,
+ MODEL_TYPE_DEFAULTS,
+ COMPONENT_REGISTRY,
+} from '../comfyui'
+import { determineStrategy, type WorkflowStrategy } from '../dynamic-workflow'
+import type { CategorizedNodes, AvailableModels } from '../comfyui-nodes'
+
+// ─── classifyModel ───
+
+describe('classifyModel', () => {
+ // Existing model types
+ it('classifies Wan models', () => {
+ expect(classifyModel('wan2.1_t2v_1.3B_bf16.safetensors')).toBe('wan')
+ expect(classifyModel('wan2.1_t2v_14B_fp8.safetensors')).toBe('wan')
+ })
+
+ it('classifies HunyuanVideo models', () => {
+ expect(classifyModel('hunyuanvideo1.5_480p_t2v_fp8.safetensors')).toBe('hunyuan')
+ })
+
+ it('classifies LTX models', () => {
+ expect(classifyModel('ltx-2.3-22b-distilled-fp8.safetensors')).toBe('ltx')
+ })
+
+ it('classifies FLUX models', () => {
+ expect(classifyModel('flux1-dev-fp8.safetensors')).toBe('flux')
+ expect(classifyModel('flux2-schnell.safetensors')).toBe('flux2')
+ expect(classifyModel('flux-2-dev.safetensors')).toBe('flux2')
+ })
+
+ it('classifies SDXL models', () => {
+ expect(classifyModel('juggernautXL_v9.safetensors')).toBe('sdxl')
+ expect(classifyModel('realvisxl_v5.safetensors')).toBe('sdxl')
+ expect(classifyModel('sd_xl_base_1.0.safetensors')).toBe('sdxl')
+ })
+
+ it('classifies SD 1.5 models', () => {
+ expect(classifyModel('realisticVisionV60_v51.safetensors')).toBe('sd15')
+ expect(classifyModel('v1-5-pruned.safetensors')).toBe('sd15')
+ })
+
+ // New model types
+ it('classifies Mochi models', () => {
+ expect(classifyModel('mochi_preview_bf16.safetensors')).toBe('mochi')
+ expect(classifyModel('mochi_preview_fp8_scaled.safetensors')).toBe('mochi')
+ })
+
+ it('classifies Cosmos models', () => {
+ expect(classifyModel('Cosmos-1_0-Diffusion-7B-Text2World.safetensors')).toBe('cosmos')
+ })
+
+ it('classifies CogVideoX models', () => {
+ expect(classifyModel('CogVideoX_2b_bf16.safetensors')).toBe('cogvideo')
+ expect(classifyModel('CogVideoX1.5_5b_bf16.safetensors')).toBe('cogvideo')
+ })
+
+ it('classifies SVD models', () => {
+ expect(classifyModel('svd_xt_1_1.safetensors')).toBe('svd')
+ expect(classifyModel('stable-video-diffusion-img2vid-xt.safetensors')).toBe('svd')
+ })
+
+ it('classifies FramePack models', () => {
+ expect(classifyModel('FramePackI2V_HY_fp8_e4m3fn.safetensors')).toBe('framepack')
+ })
+
+ it('classifies Pyramid Flow models', () => {
+ expect(classifyModel('pyramid_flow_model.safetensors')).toBe('pyramidflow')
+ expect(classifyModel('pyramid-dit-sd3.safetensors')).toBe('pyramidflow')
+ })
+
+ it('classifies Allegro models', () => {
+ expect(classifyModel('allegro_model.safetensors')).toBe('allegro')
+ })
+
+ it('returns unknown for unrecognized models', () => {
+ expect(classifyModel('totally_custom_model.safetensors')).toBe('unknown')
+ })
+})
+
+// ─── isVideoModelType / isImageModelType ───
+
+describe('isVideoModelType', () => {
+ const videoTypes = ['wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro'] as const
+ const imageTypes = ['flux', 'flux2', 'sdxl', 'sd15', 'unknown'] as const
+
+ for (const t of videoTypes) {
+ it(`${t} is a video model type`, () => {
+ expect(isVideoModelType(t)).toBe(true)
+ expect(isImageModelType(t)).toBe(false)
+ })
+ }
+
+ for (const t of imageTypes) {
+ it(`${t} is an image model type`, () => {
+ expect(isImageModelType(t)).toBe(true)
+ expect(isVideoModelType(t)).toBe(false)
+ })
+ }
+})
+
+// ─── MODEL_TYPE_DEFAULTS ───
+
+describe('MODEL_TYPE_DEFAULTS', () => {
+ const videoTypes = ['wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro', 'animatediff']
+
+ for (const t of videoTypes) {
+ it(`${t} has valid defaults`, () => {
+ const d = MODEL_TYPE_DEFAULTS[t]
+ expect(d).toBeDefined()
+ expect(d.steps).toBeGreaterThan(0)
+ expect(d.cfg).toBeGreaterThan(0)
+ expect(d.sampler).toBeTruthy()
+ expect(d.scheduler).toBeTruthy()
+ expect(d.width).toBeGreaterThan(0)
+ expect(d.height).toBeGreaterThan(0)
+ expect(d.frames).toBeGreaterThan(0)
+ expect(d.fps).toBeGreaterThan(0)
+ })
+ }
+
+ it('AnimateDiff Lightning has 4 steps and low CFG', () => {
+ const d = MODEL_TYPE_DEFAULTS.animatediff_lightning
+ expect(d.steps).toBe(4)
+ expect(d.cfg).toBe(1.0)
+ expect(d.scheduler).toBe('sgm_uniform')
+ })
+})
+
+// ─── COMPONENT_REGISTRY ───
+
+describe('COMPONENT_REGISTRY', () => {
+ const allTypes = ['sd15', 'sdxl', 'flux', 'flux2', 'wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro', 'unknown']
+
+ for (const t of allTypes) {
+ it(`${t} has a registry entry`, () => {
+ const entry = COMPONENT_REGISTRY[t]
+ expect(entry).toBeDefined()
+ expect(['UNETLoader', 'CheckpointLoaderSimple', 'ImageOnlyCheckpointLoader']).toContain(entry.loader)
+ expect(typeof entry.needsSeparateVAE).toBe('boolean')
+ expect(typeof entry.needsSeparateCLIP).toBe('boolean')
+ })
+ }
+
+ it('SVD uses ImageOnlyCheckpointLoader', () => {
+ expect(COMPONENT_REGISTRY.svd.loader).toBe('ImageOnlyCheckpointLoader')
+ })
+
+ it('types needing separate VAE have vae spec', () => {
+ for (const [type, entry] of Object.entries(COMPONENT_REGISTRY)) {
+ if (entry.needsSeparateVAE) {
+ expect(entry.vae).toBeDefined()
+ expect(entry.vae!.matchPatterns.length).toBeGreaterThan(0)
+ expect(entry.vae!.downloadFilename).toBeTruthy()
+ }
+ }
+ })
+
+ it('types needing separate CLIP have clip spec', () => {
+ for (const [type, entry] of Object.entries(COMPONENT_REGISTRY)) {
+ if (entry.needsSeparateCLIP) {
+ expect(entry.clip).toBeDefined()
+ expect(entry.clip!.matchPatterns.length).toBeGreaterThan(0)
+ expect(entry.clip!.downloadFilename).toBeTruthy()
+ }
+ }
+ })
+
+ it('Cosmos clip matches oldt5 not t5xxl', () => {
+ const cosmosClip = COMPONENT_REGISTRY.cosmos.clip!
+ expect(cosmosClip.matchPatterns).toContain('oldt5')
+ expect(cosmosClip.downloadFilename).toContain('oldt5')
+ })
+
+ it('Mochi VAE matches mochi', () => {
+ const mochiVae = COMPONENT_REGISTRY.mochi.vae!
+ expect(mochiVae.matchPatterns).toContain('mochi')
+ })
+
+ it('CogVideo VAE matches cogvideox', () => {
+ const cogVae = COMPONENT_REGISTRY.cogvideo.vae!
+ expect(cogVae.matchPatterns).toContain('cogvideox')
+ })
+})
+
+// ─── determineStrategy ───
+
+describe('determineStrategy', () => {
+ function makeNodes(extras: Partial<CategorizedNodes> = {}): CategorizedNodes {
+ return {
+ loaders: ['UNETLoader', 'CheckpointLoaderSimple', 'CLIPLoader', 'VAELoader'],
+ samplers: ['KSampler'],
+ latentInit: ['EmptyLatentImage', 'EmptySD3LatentImage', 'EmptyHunyuanLatentVideo', 'EmptyLTXVLatentVideo'],
+ textEncoders: ['CLIPTextEncode'],
+ decoders: ['VAEDecode'],
+ savers: ['SaveImage'],
+ videoSavers: ['VHS_VideoCombine'],
+ motion: [],
+ ...extras,
+ }
+ }
+
+ const emptyModels: AvailableModels = {
+ checkpoints: [], unets: ['test_model.safetensors'], vaes: ['test_vae.safetensors'],
+ clips: ['test_clip.safetensors'], motionModels: [],
+ }
+
+ it('wan → unet_video', () => {
+ const r = determineStrategy('wan', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_video')
+ })
+
+ it('hunyuan → unet_video', () => {
+ const r = determineStrategy('hunyuan', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_video')
+ })
+
+ it('ltx → unet_ltx', () => {
+ const r = determineStrategy('ltx', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_ltx')
+ })
+
+ it('mochi → unet_mochi', () => {
+ const r = determineStrategy('mochi', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_mochi')
+ })
+
+ it('cosmos → unet_cosmos', () => {
+ const r = determineStrategy('cosmos', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_cosmos')
+ })
+
+ it('svd → svd (with ImageOnlyCheckpointLoader)', () => {
+ const nodes = makeNodes({ loaders: ['UNETLoader', 'CheckpointLoaderSimple', 'CLIPLoader', 'VAELoader', 'ImageOnlyCheckpointLoader'] })
+ const r = determineStrategy('svd', true, nodes, emptyModels)
+ expect(r.strategy).toBe('svd')
+ })
+
+ it('svd → unavailable without ImageOnlyCheckpointLoader', () => {
+ const r = determineStrategy('svd', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unavailable')
+ })
+
+ it('cogvideo → cogvideo (with wrapper nodes)', () => {
+ const nodes = makeNodes({ samplers: ['KSampler', 'CogVideoXSampler'] })
+ const r = determineStrategy('cogvideo', true, nodes, emptyModels)
+ expect(r.strategy).toBe('cogvideo')
+ })
+
+ it('cogvideo → unavailable without wrapper nodes', () => {
+ const r = determineStrategy('cogvideo', true, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unavailable')
+ expect(r.reason).toContain('CogVideoXWrapper')
+ })
+
+ it('framepack → framepack (with wrapper nodes)', () => {
+ const nodes = makeNodes({ samplers: ['KSampler', 'FramePackSampler'] })
+ const r = determineStrategy('framepack', true, nodes, emptyModels)
+ expect(r.strategy).toBe('framepack')
+ })
+
+ it('pyramidflow → pyramidflow (with wrapper nodes)', () => {
+ const nodes = makeNodes({ samplers: ['KSampler', 'PyramidFlowSampler'] })
+ const r = determineStrategy('pyramidflow', true, nodes, emptyModels)
+ expect(r.strategy).toBe('pyramidflow')
+ })
+
+ it('allegro → allegro (with wrapper nodes)', () => {
+ const nodes = makeNodes({ samplers: ['KSampler', 'AllegroSampler'] })
+ const r = determineStrategy('allegro', true, nodes, emptyModels)
+ expect(r.strategy).toBe('allegro')
+ })
+
+ it('sd15 + animatediff + motion models → animatediff', () => {
+ const nodes = makeNodes({ motion: ['ADE_LoadAnimateDiffModel', 'ADE_ApplyAnimateDiffModelSimple', 'ADE_UseEvolvedSampling'] })
+ const models = { ...emptyModels, motionModels: ['animatediff_lightning_4step.safetensors'] }
+ const r = determineStrategy('sd15', true, nodes, models)
+ expect(r.strategy).toBe('animatediff')
+ })
+
+ it('flux → unet_flux', () => {
+ const r = determineStrategy('flux', false, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_flux')
+ })
+
+ it('flux2 → unet_flux2', () => {
+ const r = determineStrategy('flux2', false, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('unet_flux2')
+ })
+
+ it('sdxl → checkpoint', () => {
+ const r = determineStrategy('sdxl', false, makeNodes(), emptyModels)
+ expect(r.strategy).toBe('checkpoint')
+ })
+
+ it('missing all loaders → unavailable', () => {
+ const nodes = makeNodes({ loaders: [] })
+ const r = determineStrategy('flux', false, nodes, emptyModels)
+ expect(r.strategy).toBe('unavailable')
+ })
+})
diff --git a/src/api/__tests__/comfyui-workflows.test.ts b/src/api/__tests__/comfyui-workflows.test.ts
new file mode 100644
index 00000000..cf6e450e
--- /dev/null
+++ b/src/api/__tests__/comfyui-workflows.test.ts
@@ -0,0 +1,149 @@
+import { determineStrategy, type WorkflowStrategy } from '../dynamic-workflow'
+import type { CategorizedNodes, AvailableModels } from '../comfyui-nodes'
+import type { ModelType } from '../comfyui'
+
+// ─── Helper: build mock CategorizedNodes with all nodes available ───
+
+function makeFullNodes(extras: Partial<CategorizedNodes> = {}): CategorizedNodes {
+ return {
+ loaders: [
+ 'UNETLoader', 'CheckpointLoaderSimple', 'CLIPLoader', 'VAELoader',
+ 'ImageOnlyCheckpointLoader', 'CLIPVisionLoader', 'LoadImage',
+ 'CogVideoXModelLoader', 'CogVideoXCLIPLoader',
+ 'FramePackModelLoader', 'FramePackEncode',
+ 'PyramidFlowModelLoader', 'PyramidFlowVAELoader',
+ 'AllegroModelLoader',
+ ],
+ samplers: [
+ 'KSampler', 'KSamplerAdvanced',
+ 'CogVideoXSampler', 'FramePackSampler', 'PyramidFlowSampler', 'AllegroSampler',
+ ],
+ latentInit: [
+ 'EmptyLatentImage', 'EmptySD3LatentImage', 'EmptyFlux2LatentImage',
+ 'EmptyHunyuanLatentVideo', 'EmptyLTXVLatentVideo',
+ 'EmptyMochiLatentVideo', 'EmptyCosmosLatentVideo',
+ 'CogVideoXEmptyLatents',
+ ],
+ textEncoders: ['CLIPTextEncode', 'CogVideoXTextEncode', 'PyramidFlowTextEncode', 'AllegroTextEncode'],
+ decoders: ['VAEDecode', 'CogVideoXVAEDecode', 'PyramidFlowDecode', 'AllegroDecoder'],
+ savers: ['SaveImage'],
+ videoSavers: ['VHS_VideoCombine', 'SaveAnimatedWEBP'],
+ motion: ['ADE_LoadAnimateDiffModel', 'ADE_ApplyAnimateDiffModelSimple', 'ADE_UseEvolvedSampling', 'SVD_img2vid_Conditioning', 'VideoLinearCFGGuidance'],
+ ...extras,
+ }
+}
+
+const defaultModels: AvailableModels = {
+ checkpoints: ['test_checkpoint.safetensors'],
+ unets: ['test_model.safetensors'],
+ vaes: ['test_vae.safetensors'],
+ clips: ['test_clip.safetensors'],
+ motionModels: ['animatediff_lightning_4step.safetensors'],
+}
+
+// ─── Strategy mapping tests ───
+
+describe('determineStrategy — all 14 model types', () => {
+ const strategyMap: [ModelType, WorkflowStrategy][] = [
+ ['wan', 'unet_video'],
+ ['hunyuan', 'unet_video'],
+ ['ltx', 'unet_ltx'],
+ ['mochi', 'unet_mochi'],
+ ['cosmos', 'unet_cosmos'],
+ ['svd', 'svd'],
+ ['cogvideo', 'cogvideo'],
+ ['framepack', 'framepack'],
+ ['pyramidflow', 'pyramidflow'],
+ ['allegro', 'allegro'],
+ ['flux', 'unet_flux'],
+ ['flux2', 'unet_flux2'],
+ ]
+
+ for (const [modelType, expectedStrategy] of strategyMap) {
+ it(`${modelType} → ${expectedStrategy}`, () => {
+ const r = determineStrategy(modelType, true, makeFullNodes(), defaultModels)
+ expect(r.strategy).toBe(expectedStrategy)
+ })
+ }
+
+ it('sd15 video + animatediff → animatediff', () => {
+ const r = determineStrategy('sd15', true, makeFullNodes(), defaultModels)
+ expect(r.strategy).toBe('animatediff')
+ })
+
+ it('sdxl image → checkpoint', () => {
+ const r = determineStrategy('sdxl', false, makeFullNodes(), defaultModels)
+ expect(r.strategy).toBe('checkpoint')
+ })
+})
+
+// ─── Strategy unavailability tests ───
+
+describe('determineStrategy — missing nodes', () => {
+ const minimalNodes: CategorizedNodes = {
+ loaders: ['UNETLoader', 'CLIPLoader', 'VAELoader', 'CheckpointLoaderSimple'],
+ samplers: ['KSampler'],
+ latentInit: ['EmptyLatentImage'],
+ textEncoders: ['CLIPTextEncode'],
+ decoders: ['VAEDecode'],
+ savers: ['SaveImage'],
+ videoSavers: [],
+ motion: [],
+ }
+
+ it('cogvideo without CogVideoXSampler → unavailable', () => {
+ const r = determineStrategy('cogvideo', true, minimalNodes, defaultModels)
+ expect(r.strategy).toBe('unavailable')
+ expect(r.reason).toContain('CogVideoXWrapper')
+ })
+
+ it('framepack without FramePackSampler → unavailable', () => {
+ const r = determineStrategy('framepack', true, minimalNodes, defaultModels)
+ expect(r.strategy).toBe('unavailable')
+ expect(r.reason).toContain('FramePackWrapper')
+ })
+
+ it('svd without ImageOnlyCheckpointLoader → unavailable', () => {
+ const r = determineStrategy('svd', true, minimalNodes, defaultModels)
+ expect(r.strategy).toBe('unavailable')
+ expect(r.reason).toContain('ImageOnlyCheckpointLoader')
+ })
+
+ it('allegro without AllegroSampler → unavailable', () => {
+ const r = determineStrategy('allegro', true, minimalNodes, defaultModels)
+ expect(r.strategy).toBe('unavailable')
+ expect(r.reason).toContain('ComfyUI-Allegro')
+ })
+
+ it('pyramidflow without PyramidFlowSampler → unavailable', () => {
+ const r = determineStrategy('pyramidflow', true, minimalNodes, defaultModels)
+ expect(r.strategy).toBe('unavailable')
+ expect(r.reason).toContain('PyramidFlowWrapper')
+ })
+})
+
+// ─── Workflow type coverage ───
+
+describe('Every video bundle workflow type has a strategy', () => {
+ // These are all the workflow types used in getVideoBundles()
+ const workflowTypes: [string, ModelType][] = [
+ ['wan', 'wan'],
+ ['hunyuan', 'hunyuan'],
+ ['ltx', 'ltx'],
+ ['animatediff', 'sd15'],
+ ['cogvideo', 'cogvideo'],
+ ['framepack', 'framepack'],
+ ['svd', 'svd'],
+ ['mochi', 'mochi'],
+ ['pyramidflow', 'pyramidflow'],
+ ['allegro', 'allegro'],
+ ['cosmos', 'cosmos'],
+ ]
+
+ for (const [workflow, modelType] of workflowTypes) {
+ it(`workflow "${workflow}" maps to a valid strategy for ${modelType}`, () => {
+ const r = determineStrategy(modelType, true, makeFullNodes(), defaultModels)
+ expect(r.strategy).not.toBe('unavailable')
+ })
+ }
+})
diff --git a/src/api/backend.ts b/src/api/backend.ts
index 789f0d12..a5df7262 100644
--- a/src/api/backend.ts
+++ b/src/api/backend.ts
@@ -113,6 +113,7 @@ export async function backendCall<T = any>(
set_comfyui_path: { path: "/local-api/set-comfyui-path", method: "POST" },
install_comfyui: { path: "/local-api/install-comfyui", method: "POST" },
install_comfyui_status: { path: "/local-api/install-comfyui" },
+ install_custom_node: { path: "/local-api/install-custom-node", method: "POST" },
whisper_status: { path: "/local-api/transcribe-status" },
transcribe: { path: "/local-api/transcribe", method: "POST" },
execute_code: { path: "/local-api/execute-code", method: "POST" },
diff --git a/src/api/comfyui-nodes.ts b/src/api/comfyui-nodes.ts
index 449762b1..33fb4861 100644
--- a/src/api/comfyui-nodes.ts
+++ b/src/api/comfyui-nodes.ts
@@ -91,22 +91,39 @@ export function categorizeNodes(allNodes: Record<string, NodeMetadata>): Categor
CLIPLoader: 'loaders',
DualCLIPLoader: 'loaders',
TripleCLIPLoader: 'loaders',
+ ImageOnlyCheckpointLoader: 'loaders',
+ CLIPVisionLoader: 'loaders',
+ LoadImage: 'loaders',
// Samplers
KSampler: 'samplers',
KSamplerAdvanced: 'samplers',
SamplerCustom: 'samplers',
+ // Wrapper samplers (custom nodes)
+ CogVideoXSampler: 'samplers',
+ FramePackSampler: 'samplers',
+ PyramidFlowSampler: 'samplers',
+ AllegroSampler: 'samplers',
// Latent init
EmptyLatentImage: 'latentInit',
EmptySD3LatentImage: 'latentInit',
EmptyFlux2LatentImage: 'latentInit',
EmptyHunyuanLatentVideo: 'latentInit',
EmptyLTXVLatentVideo: 'latentInit',
+ EmptyMochiLatentVideo: 'latentInit',
+ EmptyCosmosLatentVideo: 'latentInit',
+ CogVideoXEmptyLatents: 'latentInit',
// Text encoding
CLIPTextEncode: 'textEncoders',
CLIPTextEncodeSDXL: 'textEncoders',
+ CogVideoXTextEncode: 'textEncoders',
+ PyramidFlowTextEncode: 'textEncoders',
+ AllegroTextEncode: 'textEncoders',
// Decoders
VAEDecode: 'decoders',
VAEDecodeTiled: 'decoders',
+ CogVideoXVAEDecode: 'decoders',
+ PyramidFlowDecode: 'decoders',
+ AllegroDecoder: 'decoders',
// Image savers
SaveImage: 'savers',
PreviewImage: 'savers',
@@ -117,6 +134,17 @@ export function categorizeNodes(allNodes: Record<string, NodeMetadata>): Categor
ADE_LoadAnimateDiffModel: 'motion',
ADE_ApplyAnimateDiffModelSimple: 'motion',
ADE_UseEvolvedSampling: 'motion',
+ // SVD-specific
+ SVD_img2vid_Conditioning: 'motion',
+ VideoLinearCFGGuidance: 'motion',
+ // Wrapper loaders (custom nodes)
+ CogVideoXModelLoader: 'loaders',
+ CogVideoXCLIPLoader: 'loaders',
+ FramePackModelLoader: 'loaders',
+ FramePackEncode: 'loaders',
+ PyramidFlowModelLoader: 'loaders',
+ PyramidFlowVAELoader: 'loaders',
+ AllegroModelLoader: 'loaders',
}
for (const nodeName of Object.keys(allNodes)) {
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 93c79c1b..51eeb9a7 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -19,6 +19,7 @@ export interface GenerateParams {
export interface VideoParams extends GenerateParams {
frames: number
fps: number
+ inputImage?: string // Uploaded image filename for I2V models (SVD, FramePack)
}
export interface ComfyUIOutput {
@@ -27,7 +28,7 @@ export interface ComfyUIOutput {
type: string
}
-export type ModelType = 'flux' | 'flux2' | 'sdxl' | 'sd15' | 'wan' | 'hunyuan' | 'ltx' | 'unknown'
+export type ModelType = 'flux' | 'flux2' | 'sdxl' | 'sd15' | 'wan' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'unknown'
export type VideoBackend = 'wan' | 'animatediff' | 'none'
export interface ClassifiedModel {
@@ -60,7 +61,14 @@ const KNOWN_MODELS: Record<string, ModelType> = {
export function classifyModel(name: string): ModelType {
const lower = name.toLowerCase()
- // Video models — most specific first
+ // Video models — most specific first (order matters: specific before generic)
+ if (lower.includes('cogvideo')) return 'cogvideo'
+ if (lower.includes('framepack')) return 'framepack'
+ if (lower.includes('mochi')) return 'mochi'
+ if (lower.includes('cosmos')) return 'cosmos'
+ if (lower.includes('allegro')) return 'allegro'
+ if (lower.includes('svd') || lower.includes('stable-video-diffusion')) return 'svd'
+ if (lower.includes('pyramid') && (lower.includes('flow') || lower.includes('dit'))) return 'pyramidflow'
if (lower.includes('wan')) return 'wan'
if (lower.includes('hunyuan')) return 'hunyuan'
if (lower.includes('ltx')) return 'ltx'
@@ -87,12 +95,119 @@ export function classifyModel(name: string): ModelType {
return 'unknown'
}
-function isImageModelType(type: ModelType): boolean {
+export function isImageModelType(type: ModelType): boolean {
return type === 'flux' || type === 'flux2' || type === 'sdxl' || type === 'sd15' || type === 'unknown'
}
-function isVideoModelType(type: ModelType): boolean {
- return type === 'wan' || type === 'hunyuan' || type === 'ltx'
+export function isVideoModelType(type: ModelType): boolean {
+ return type === 'wan' || type === 'hunyuan' || type === 'ltx' || type === 'mochi' || type === 'cosmos'
+ || type === 'cogvideo' || type === 'svd' || type === 'framepack' || type === 'pyramidflow' || type === 'allegro'
+}
+
+// ─── Default generation parameters per model type ───
+
+export interface ModelTypeDefaults {
+ steps: number
+ cfg: number
+ sampler: string
+ scheduler: string
+ width: number
+ height: number
+ frames: number
+ fps: number
+}
+
+export const MODEL_TYPE_DEFAULTS: Record<string, ModelTypeDefaults> = {
+ wan: { steps: 30, cfg: 6.0, sampler: 'euler', scheduler: 'normal', width: 832, height: 480, frames: 81, fps: 16 },
+ hunyuan: { steps: 30, cfg: 6.0, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 45, fps: 24 },
+ ltx: { steps: 20, cfg: 3.0, sampler: 'euler', scheduler: 'normal', width: 768, height: 512, frames: 97, fps: 24 },
+ mochi: { steps: 30, cfg: 4.5, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 84, fps: 24 },
+ cosmos: { steps: 35, cfg: 7.0, sampler: 'euler', scheduler: 'normal', width: 1024, height: 1024, frames: 121, fps: 24 },
+ cogvideo: { steps: 50, cfg: 6.0, sampler: 'euler_ancestral', scheduler: 'normal', width: 480, height: 480, frames: 49, fps: 8 },
+ svd: { steps: 20, cfg: 2.5, sampler: 'euler', scheduler: 'karras', width: 576, height: 1024, frames: 25, fps: 6 },
+ framepack: { steps: 25, cfg: 7.0, sampler: 'euler', scheduler: 'normal', width: 640, height: 480, frames: 49, fps: 24 },
+ pyramidflow: { steps: 20, cfg: 7.0, sampler: 'euler', scheduler: 'normal', width: 768, height: 1280, frames: 16, fps: 8 },
+ allegro: { steps: 100, cfg: 7.5, sampler: 'euler', scheduler: 'normal', width: 720, height: 1280, frames: 88, fps: 15 },
+ animatediff: { steps: 20, cfg: 7.5, sampler: 'euler_ancestral', scheduler: 'normal', width: 512, height: 512, frames: 16, fps: 8 },
+ // AnimateDiff Lightning override (4 steps only)
+ animatediff_lightning: { steps: 4, cfg: 1.0, sampler: 'euler', scheduler: 'sgm_uniform', width: 512, height: 512, frames: 16, fps: 8 },
+}
+
+// ─── Component Requirements per model type ───
+
+export interface ComponentSpec {
+ matchPatterns: string[]
+ downloadFilename: string
+ downloadUrl?: string
+}
+
+export interface ComponentRequirements {
+ loader: 'UNETLoader' | 'CheckpointLoaderSimple' | 'ImageOnlyCheckpointLoader'
+ needsSeparateVAE: boolean
+ needsSeparateCLIP: boolean
+ vae?: ComponentSpec
+ clip?: ComponentSpec
+ clipType?: string
+}
+
+export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
+ sd15: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+ sdxl: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+ flux: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux',
+ vae: { matchPatterns: ['flux2', 'flux', 'ae'], downloadFilename: 'flux2-vae.safetensors' },
+ clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp8_e4m3fn.safetensors' },
+ },
+ flux2: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux2',
+ vae: { matchPatterns: ['flux2', 'flux'], downloadFilename: 'flux2-vae.safetensors' },
+ clip: { matchPatterns: ['qwen', 'mistral'], downloadFilename: 'qwen_3_4b_fp4_flux2.safetensors' },
+ },
+ wan: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ vae: { matchPatterns: ['wan', 'hunyuan'], downloadFilename: 'wan_2.1_vae.safetensors' },
+ clip: { matchPatterns: ['umt5', 'wan'], downloadFilename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors' },
+ },
+ hunyuan: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ vae: { matchPatterns: ['hunyuanvideo', 'hunyuan', 'wan'], downloadFilename: 'hunyuanvideo15_vae_fp16.safetensors' },
+ clip: { matchPatterns: ['qwen', 'llava', 'umt5'], downloadFilename: 'qwen_2.5_vl_7b_fp8_scaled.safetensors' },
+ },
+ ltx: {
+ loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: true, clipType: 'ltxv',
+ clip: { matchPatterns: ['gemma'], downloadFilename: 'gemma_3_12B_it_fp8_scaled.safetensors' },
+ },
+ mochi: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'mochi',
+ vae: { matchPatterns: ['mochi'], downloadFilename: 'mochi_vae.safetensors' },
+ clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp16.safetensors' },
+ },
+ cosmos: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'cosmos',
+ vae: { matchPatterns: ['cosmos'], downloadFilename: 'cosmos_cv8x8x8_1.0.safetensors' },
+ clip: { matchPatterns: ['oldt5'], downloadFilename: 'oldt5_xxl_fp8_e4m3fn_scaled.safetensors' },
+ },
+ cogvideo: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'cogvideo',
+ vae: { matchPatterns: ['cogvideox', 'cogvideo'], downloadFilename: 'cogvideox_vae.safetensors' },
+ clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp16.safetensors' },
+ },
+ svd: {
+ loader: 'ImageOnlyCheckpointLoader', needsSeparateVAE: false, needsSeparateCLIP: false,
+ },
+ framepack: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ vae: { matchPatterns: ['hunyuan', 'wan'], downloadFilename: 'hunyuan_video_vae_bf16.safetensors' },
+ clip: { matchPatterns: ['llava', 'qwen', 'umt5'], downloadFilename: 'llava_llama3_fp8_scaled.safetensors' },
+ },
+ pyramidflow: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: false, clipType: 'pyramidflow',
+ vae: { matchPatterns: ['pyramid'], downloadFilename: 'pyramid_flow_vae.safetensors' },
+ },
+ allegro: {
+ loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: false, clipType: 'allegro',
+ },
+ unknown: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
}
// ─── Connection & Info ───
@@ -312,13 +427,36 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {
throw new Error(`No Wan VAE found. Download "wan_2.1_vae.safetensors" from the Model Manager.`)
}
if (modelType === 'ltx') {
- // LTX Video uses its own VAE embedded in the model — any available VAE as fallback
const match = vaes.find(v => lower(v).includes('ltx'))
if (match) return match
- // LTX models often have built-in VAE, return first available
return vaes[0]
}
- // SDXL/SD1.5 checkpoints include VAE — any VAE works as fallback
+ if (modelType === 'mochi') {
+ const match = vaes.find(v => lower(v).includes('mochi'))
+ if (match) return match
+ throw new Error(`No Mochi VAE found. Download "mochi_vae.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'cosmos') {
+ const match = vaes.find(v => lower(v).includes('cosmos'))
+ if (match) return match
+ throw new Error(`No Cosmos VAE found. Download "cosmos_cv8x8x8_1.0.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'cogvideo') {
+ const match = vaes.find(v => lower(v).includes('cogvideox') || lower(v).includes('cogvideo'))
+ if (match) return match
+ throw new Error(`No CogVideoX VAE found. Download "cogvideox_vae.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'framepack') {
+ const match = vaes.find(v => lower(v).includes('hunyuan') || lower(v).includes('wan'))
+ if (match) return match
+ throw new Error(`No FramePack VAE found. Download "hunyuan_video_vae_bf16.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'pyramidflow') {
+ const match = vaes.find(v => lower(v).includes('pyramid'))
+ if (match) return match
+ throw new Error(`No Pyramid Flow VAE found. Download from the Model Manager.`)
+ }
+ // SVD / Allegro use checkpoint-embedded VAE, SDXL/SD1.5 too — any VAE works as fallback
return vaes[0]
}
@@ -355,12 +493,33 @@ export async function findMatchingCLIP(modelType: ModelType): Promise<string> {
throw new Error(`No Wan text encoder found. Download "umt5_xxl_fp8_e4m3fn_scaled.safetensors" from the Model Manager.`)
}
if (modelType === 'ltx') {
- // LTX Video 2.x uses Gemma 3 as text encoder
const match = clips.find(c => lower(c).includes('gemma'))
if (match) return match
throw new Error(`No LTX Video text encoder found. Download "gemma_3_12B_it_fp8_scaled.safetensors" from the Model Manager.`)
}
- // SDXL/SD1.5 checkpoints include CLIP — any works
+ if (modelType === 'mochi') {
+ const match = clips.find(c => lower(c).includes('t5') && !lower(c).includes('umt5') && !lower(c).includes('oldt5'))
+ if (match) return match
+ throw new Error(`No Mochi text encoder found. Download "t5xxl_fp16.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'cosmos') {
+ // Cosmos uses oldt5, NOT regular t5xxl
+ const match = clips.find(c => lower(c).includes('oldt5'))
+ if (match) return match
+ throw new Error(`No Cosmos text encoder found. Download "oldt5_xxl_fp8_e4m3fn_scaled.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'cogvideo') {
+ const match = clips.find(c => lower(c).includes('t5') && !lower(c).includes('umt5') && !lower(c).includes('oldt5'))
+ if (match) return match
+ throw new Error(`No CogVideoX text encoder found. Download "t5xxl_fp16.safetensors" from the Model Manager.`)
+ }
+ if (modelType === 'framepack') {
+ const match = clips.find(c => lower(c).includes('llava') || lower(c).includes('qwen'))
+ || clips.find(c => lower(c).includes('umt5'))
+ if (match) return match
+ throw new Error(`No FramePack text encoder found. Download "llava_llama3_fp8_scaled.safetensors" from the Model Manager.`)
+ }
+ // SDXL/SD1.5/SVD/Allegro/PyramidFlow checkpoints include CLIP — any works
return clips[0]
}
@@ -430,6 +589,22 @@ export async function getHistory(promptId: string): Promise<any> {
}
}
+// ─── Upload image to ComfyUI (for I2V models like SVD, FramePack) ───
+
+export async function uploadImage(file: File): Promise<string> {
+ const formData = new FormData()
+ formData.append('image', file)
+ formData.append('overwrite', 'true')
+
+ const res = await localFetch(comfyuiUrl('/upload/image'), {
+ method: 'POST',
+ body: formData,
+ })
+ if (!res.ok) throw new Error(`Failed to upload image: HTTP ${res.status}`)
+ const data = await res.json()
+ return data.name // ComfyUI returns { name, subfolder, type }
+}
+
export function getImageUrl(filename: string, subfolder: string = '', type: string = 'output'): string {
return comfyuiUrl(`/view?filename=${encodeURIComponent(filename)}&subfolder=${encodeURIComponent(subfolder)}&type=${type}&t=${Date.now()}`)
}
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 5a3d277e..bced48a6 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1,4 +1,5 @@
import { backendCall, fetchExternal } from "./backend"
+import type { ProviderId } from "./providers/types"
export interface DiscoverModel {
name: string
@@ -15,6 +16,11 @@ export interface DiscoverModel {
// Discovery flags
hot?: boolean // Featured/trending model
agent?: boolean // Supports Agent Mode tool calling
+ released?: string // Release date YYYY-MM for sorting (newest first)
+ // Multi-provider
+ provider?: ProviderId // Which provider this model belongs to
+ providerName?: string // Display name of the provider
+ canPull?: boolean // false = no download/pull capability (cloud/external)
}
export interface DownloadProgress {
@@ -52,6 +58,51 @@ export async function resumeDownload(id: string, url: string, subfolder: string)
await backendCall("resume_download", { id, url, subfolder })
}
+// ─── Custom Node Installation ───
+
+export async function installCustomNodes(nodeKeys: string[]): Promise<void> {
+ for (const key of nodeKeys) {
+ const entry = CUSTOM_NODE_REGISTRY[key]
+ if (!entry) {
+ console.warn(`[discover] Unknown custom node key: ${key}`)
+ continue
+ }
+ try {
+ await backendCall('install_custom_node', { repo_url: entry.repo, node_name: entry.name })
+ console.log(`[discover] Installed custom node: ${entry.name}`)
+ } catch (err) {
+ console.error(`[discover] Failed to install ${entry.name}:`, err)
+ throw new Error(`Failed to install ${entry.name}: ${err}`)
+ }
+ }
+}
+
+export async function installBundleComplete(bundle: ModelBundle): Promise<void> {
+ // Step 1: Install custom nodes if needed
+ if (bundle.customNodes && bundle.customNodes.length > 0) {
+ await installCustomNodes(bundle.customNodes)
+ }
+
+ // Step 2: Download all model files
+ for (const file of bundle.files) {
+ if (file.downloadUrl && file.filename && file.subfolder) {
+ await startModelDownload(file.downloadUrl, file.subfolder, file.filename)
+ }
+ }
+
+ // Step 3: Restart ComfyUI if custom nodes were installed (needed for node registration)
+ if (bundle.customNodes && bundle.customNodes.length > 0) {
+ try {
+ await backendCall('stop_comfyui')
+ // Small delay before restart
+ await new Promise(resolve => setTimeout(resolve, 2000))
+ await backendCall('start_comfyui')
+ } catch (err) {
+ console.warn('[discover] ComfyUI restart after custom node install failed:', err)
+ }
+ }
+}
+
// ─── Component Registry: What each model type needs to work ───
import type { ModelType } from './comfyui'
@@ -72,58 +123,71 @@ export interface ComponentRequirements {
needsSeparateCLIP: boolean
}
-export const COMPONENT_REGISTRY: Record<ModelType, ComponentRequirements> = {
- sd15: {
- loader: 'CheckpointLoaderSimple',
- needsSeparateVAE: false,
- needsSeparateCLIP: false,
- },
- sdxl: {
- loader: 'CheckpointLoaderSimple',
- needsSeparateVAE: false,
- needsSeparateCLIP: false,
- },
+export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
+ sd15: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+ sdxl: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
flux: {
loader: 'UNETLoader',
vae: { patterns: ['ae', 'flux'], downloadName: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/vae/flux2-vae.safetensors', subfolder: 'vae' },
clip: { patterns: ['t5xxl', 't5-xxl', 't5_xxl'], downloadName: 't5xxl_fp8_e4m3fn.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors', subfolder: 'text_encoders' },
clipSecondary: { patterns: ['clip_l'], downloadName: 'clip_l.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true,
- needsSeparateCLIP: true,
+ needsSeparateVAE: true, needsSeparateCLIP: true,
},
flux2: {
loader: 'UNETLoader',
vae: { patterns: ['flux2', 'flux'], downloadName: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/vae/flux2-vae.safetensors', subfolder: 'vae' },
clip: { patterns: ['qwen', 'mistral'], downloadName: 'qwen_3_4b_fp4_flux2.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/text_encoders/qwen_3_4b_fp4_flux2.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true,
- needsSeparateCLIP: true,
+ needsSeparateVAE: true, needsSeparateCLIP: true,
},
wan: {
loader: 'UNETLoader',
vae: { patterns: ['wan'], downloadName: 'wan_2.1_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors', subfolder: 'vae' },
clip: { patterns: ['umt5', 'wan'], downloadName: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true,
- needsSeparateCLIP: true,
+ needsSeparateVAE: true, needsSeparateCLIP: true,
},
hunyuan: {
loader: 'UNETLoader',
vae: { patterns: ['hunyuanvideo', 'hunyuan'], downloadName: 'hunyuanvideo15_vae_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae' },
clip: { patterns: ['qwen', 'llava'], downloadName: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true,
- needsSeparateCLIP: true,
+ needsSeparateVAE: true, needsSeparateCLIP: true,
},
ltx: {
loader: 'UNETLoader',
- vae: { patterns: ['ltx'], downloadName: 'ltx_vae.safetensors', downloadUrl: '', subfolder: 'vae' },
clip: { patterns: ['gemma'], downloadName: 'gemma_3_12B_it_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ltx-2/resolve/main/split_files/text_encoders/gemma_3_12B_it_fp8_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: false, // LTX has VAE built into the model pipeline
- needsSeparateCLIP: true,
+ needsSeparateVAE: false, needsSeparateCLIP: true,
},
- unknown: {
- loader: 'CheckpointLoaderSimple',
- needsSeparateVAE: false,
- needsSeparateCLIP: false,
+ mochi: {
+ loader: 'UNETLoader',
+ vae: { patterns: ['mochi'], downloadName: 'mochi_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/vae/mochi_vae.safetensors', subfolder: 'vae' },
+ clip: { patterns: ['t5'], downloadName: 't5xxl_fp16.safetensors', downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/t5xxl_fp16.safetensors', subfolder: 'text_encoders' },
+ needsSeparateVAE: true, needsSeparateCLIP: true,
+ },
+ cosmos: {
+ loader: 'UNETLoader',
+ vae: { patterns: ['cosmos'], downloadName: 'cosmos_cv8x8x8_1.0.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text2world_safetensors/resolve/main/cosmos_cv8x8x8_1.0.safetensors', subfolder: 'vae' },
+ clip: { patterns: ['oldt5'], downloadName: 'oldt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text2world_safetensors/resolve/main/oldt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
+ needsSeparateVAE: true, needsSeparateCLIP: true,
+ },
+ cogvideo: {
+ loader: 'UNETLoader',
+ vae: { patterns: ['cogvideox', 'cogvideo'], downloadName: 'cogvideox_vae.safetensors', downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/cogvideox_vae.safetensors', subfolder: 'vae' },
+ clip: { patterns: ['t5'], downloadName: 't5xxl_fp16.safetensors', downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/t5xxl_fp16.safetensors', subfolder: 'text_encoders' },
+ needsSeparateVAE: true, needsSeparateCLIP: true,
+ },
+ svd: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+ framepack: {
+ loader: 'UNETLoader',
+ vae: { patterns: ['hunyuan', 'wan'], downloadName: 'hunyuanvideo15_vae_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae' },
+ clip: { patterns: ['llava', 'qwen'], downloadName: 'llava_llama3_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/text_encoders/llava_llama3_fp8_scaled.safetensors', subfolder: 'text_encoders' },
+ needsSeparateVAE: true, needsSeparateCLIP: true,
+ },
+ pyramidflow: {
+ loader: 'UNETLoader',
+ vae: { patterns: ['pyramid'], downloadName: 'pyramid_flow_vae.safetensors', downloadUrl: 'https://huggingface.co/Kijai/pyramid-flow-comfy/resolve/main/pyramid_flow_vae.safetensors', subfolder: 'vae' },
+ needsSeparateVAE: true, needsSeparateCLIP: false,
},
+ allegro: { loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: false },
+ unknown: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
}
// ─── Ollama Text Models ───
@@ -205,42 +269,52 @@ function parseOllamaSearchHTML(html: string): DiscoverModel[] {
return models
}
+/** Sort models by release date, newest first */
+function sortByRelease(models: DiscoverModel[]): DiscoverModel[] {
+ return models.sort((a, b) => (b.released ?? '').localeCompare(a.released ?? ''))
+}
+
/** Uncensored / abliterated models — the core of LU */
export function getUncensoredTextModels(): DiscoverModel[] {
- return [
+ return sortByRelease([
// ── HOT: Agent Mode + Uncensored ──
- { name: 'hermes3', description: 'NousResearch Hermes 3 — uncensored + native tool calling. THE agent model.', pulls: '500K+', tags: ['3B', '8B', '70B', '405B'], updated: 'Hot', hot: true, agent: true },
- { name: 'dolphin3', description: 'Dolphin 3 — uncensored from training. Coding, math, general purpose.', pulls: '3.7M', tags: ['8B'], updated: 'Hot', hot: true },
- { name: 'huihui_ai/qwen3.5-abliterated', description: 'Qwen 3.5 abliterated — newest, strongest reasoning + coding.', pulls: '10K+', tags: ['9B', '27B', '35B'], updated: 'Hot', hot: true },
- { name: 'huihui_ai/gpt-oss-abliterated', description: 'OpenAI GPT-OSS — abliterated open-source GPT model.', pulls: '15K+', tags: ['20B', '120B'], updated: 'Hot', hot: true },
- { name: 'huihui_ai/qwen3-coder-abliterated', description: 'Qwen3-Coder abliterated — 30B MoE (3B active), built for code agents. 256K context.', pulls: '5K+', tags: ['30B', '480B'], updated: 'Hot', hot: true, agent: true },
+ { name: 'hermes3', description: 'NousResearch Hermes 3 — uncensored + native tool calling. THE agent model.', pulls: '500K+', tags: ['3B', '8B', '70B', '405B'], updated: 'Hot', hot: true, agent: true, released: '2024-08' },
+ { name: 'dolphin3', description: 'Dolphin 3 — uncensored from training. Coding, math, general purpose.', pulls: '3.7M', tags: ['8B'], updated: 'Hot', hot: true, released: '2024-12' },
+ { name: 'huihui_ai/qwen3.5-abliterated', description: 'Qwen 3.5 abliterated — newest, strongest reasoning + coding.', pulls: '10K+', tags: ['9B', '27B', '35B'], updated: 'Hot', hot: true, released: '2026-03' },
+ { name: 'huihui_ai/gpt-oss-abliterated', description: 'OpenAI GPT-OSS — abliterated open-source GPT model.', pulls: '15K+', tags: ['20B', '120B'], updated: 'Hot', hot: true, released: '2026-03' },
+ { name: 'huihui_ai/qwen3-coder-abliterated', description: 'Qwen3-Coder abliterated — 30B MoE (3B active), built for code agents. 256K context.', pulls: '5K+', tags: ['30B', '480B'], updated: 'Hot', hot: true, agent: true, released: '2026-02' },
+ { name: 'aratan/gemma-4-31B-it-uncensores', description: 'Gemma 4 31B uncensored — frontier dense model, native tool calling + vision. 256K context.', pulls: '400+', tags: ['31B'], updated: 'Hot', hot: true, agent: true, released: '2026-04' },
+ { name: 'juilpark/gemma-4-26B-A4B-it-heretic', description: 'Gemma 4 26B MoE HERETIC — 26B brain, 4B active. Uncensored + tools + vision.', pulls: '30+', tags: ['26B'], updated: 'Hot', hot: true, agent: true, released: '2026-04' },
+ { name: 'juilpark/gemma-4-31B-it-uncensored-heretic', description: 'Gemma 4 31B HERETIC — full uncensor, native tool calling, 256K context.', pulls: '80+', tags: ['31B'], updated: 'Hot', hot: true, agent: true, released: '2026-04' },
+ { name: 'charaf/gemma4-31b-claude-opus-abliterated', description: 'Gemma 4 31B abliterated — Claude Opus-style tuning, strong reasoning.', pulls: '360+', tags: ['31B'], updated: 'New', hot: true, agent: true, released: '2026-04' },
// ── Popular Uncensored ──
- { name: 'huihui_ai/qwen3-abliterated', description: 'Qwen3 abliterated — best overall. Exceptional reasoning, coding, multilingual.', pulls: '30K+', tags: ['8B', '30B'], updated: 'Popular' },
- { name: 'mannix/llama3.1-8b-abliterated', description: 'Llama 3.1 8B — fast, reliable, great entry point.', pulls: '200K+', tags: ['Q5_K_M', 'Q4_K_M'], updated: 'Popular' },
- { name: 'huihui_ai/deepseek-r1-abliterated', description: 'DeepSeek R1 — chain-of-thought reasoning. Scales to your hardware.', pulls: '40K+', tags: ['8B', '14B', '32B', '70B'], updated: 'Popular' },
- { name: 'huihui_ai/glm4.6-abliterated', description: 'GLM 4.6 abliterated — newest model, strong coding and reasoning.', pulls: '5K+', tags: ['357B'], updated: 'New' },
- { name: 'huihui_ai/gemma3-abliterated', description: 'Google Gemma 3 — vision support, great quality.', pulls: '20K+', tags: ['4B', '12B', '27B'], updated: 'Popular' },
- { name: 'richardyoung/qwen3-14b-abliterated', description: 'Qwen3 14B — sweet spot of speed and intelligence.', pulls: '4K+', tags: ['Q4_K_M', 'Q5_K_M'], updated: 'Recent' },
- { name: 'huihui_ai/qwen2.5-abliterate', description: 'Qwen 2.5 abliterated series — proven and reliable.', pulls: '50K+', tags: ['7B', '14B', '32B'], updated: 'Popular' },
- { name: 'huihui_ai/llama3.3-abliterated', description: 'Llama 3.3 70B — maximum intelligence for high-VRAM setups.', pulls: '15K+', tags: ['70B'], updated: 'Popular' },
- { name: 'huihui_ai/mistral-small-abliterated', description: 'Mistral Small 24B — powerful, strong multilingual.', pulls: '10K+', tags: ['24B'], updated: 'Recent' },
- { name: 'huihui_ai/phi4-abliterated', description: 'Microsoft Phi-4 — excellent at math, logic, structured tasks.', pulls: '8K+', tags: ['14B'], updated: 'Recent' },
- { name: 'krith/mistral-nemo-instruct-2407-abliterated', description: 'Mistral Nemo 12B — multilingual powerhouse.', pulls: '5K+', tags: ['IQ4_XS', 'IQ3_M'], updated: 'Popular' },
- ]
+ { name: 'huihui_ai/qwen3-abliterated', description: 'Qwen3 abliterated — best overall. Exceptional reasoning, coding, multilingual.', pulls: '30K+', tags: ['8B', '30B'], updated: 'Popular', released: '2025-05' },
+ { name: 'mannix/llama3.1-8b-abliterated', description: 'Llama 3.1 8B — fast, reliable, great entry point.', pulls: '200K+', tags: ['Q5_K_M', 'Q4_K_M'], updated: 'Popular', released: '2024-07' },
+ { name: 'huihui_ai/deepseek-r1-abliterated', description: 'DeepSeek R1 — chain-of-thought reasoning. Scales to your hardware.', pulls: '40K+', tags: ['8B', '14B', '32B', '70B'], updated: 'Popular', released: '2025-01' },
+ { name: 'huihui_ai/glm4.6-abliterated', description: 'GLM 4.6 abliterated — newest model, strong coding and reasoning.', pulls: '5K+', tags: ['357B'], updated: 'New', released: '2026-03' },
+ { name: 'kiwi_kiwi/gemma-4-uncensores', description: 'Gemma 4 31B uncensored — strong all-rounder, vision + tool calling.', pulls: '400+', tags: ['31B'], updated: 'New', agent: true, released: '2026-04' },
+ { name: 'huihui_ai/gemma3-abliterated', description: 'Google Gemma 3 — vision support, great quality.', pulls: '20K+', tags: ['4B', '12B', '27B'], updated: 'Popular', released: '2025-03' },
+ { name: 'richardyoung/qwen3-14b-abliterated', description: 'Qwen3 14B — sweet spot of speed and intelligence.', pulls: '4K+', tags: ['Q4_K_M', 'Q5_K_M'], updated: 'Recent', released: '2025-05' },
+ { name: 'huihui_ai/qwen2.5-abliterate', description: 'Qwen 2.5 abliterated series — proven and reliable.', pulls: '50K+', tags: ['7B', '14B', '32B'], updated: 'Popular', released: '2024-09' },
+ { name: 'huihui_ai/llama3.3-abliterated', description: 'Llama 3.3 70B — maximum intelligence for high-VRAM setups.', pulls: '15K+', tags: ['70B'], updated: 'Popular', released: '2024-12' },
+ { name: 'huihui_ai/mistral-small-abliterated', description: 'Mistral Small 24B — powerful, strong multilingual.', pulls: '10K+', tags: ['24B'], updated: 'Recent', released: '2024-09' },
+ { name: 'huihui_ai/phi4-abliterated', description: 'Microsoft Phi-4 — excellent at math, logic, structured tasks.', pulls: '8K+', tags: ['14B'], updated: 'Recent', released: '2024-12' },
+ { name: 'krith/mistral-nemo-instruct-2407-abliterated', description: 'Mistral Nemo 12B — multilingual powerhouse.', pulls: '5K+', tags: ['IQ4_XS', 'IQ3_M'], updated: 'Popular', released: '2024-07' },
+ ])
}
/** Mainstream models — not uncensored but excellent for specific tasks */
export function getMainstreamTextModels(): DiscoverModel[] {
- return [
- { name: 'gemma4', description: 'Google Gemma 4 — native tool calling + vision. 128-256K context. Apache 2.0.', pulls: '100K+', tags: ['e2b', 'e4b', '26B', '31B'], updated: 'New', hot: true, agent: true },
- { name: 'qwen3-coder', description: 'Qwen3-Coder — 30B MoE coding agent (3B active). Native tool calling, 256K context.', pulls: '100K+', tags: ['30B', '480B'], updated: 'New', hot: true, agent: true },
- { name: 'qwen3-coder-next', description: 'Qwen3-Coder-Next — 80B MoE (3B active). Optimized for agentic coding workflows.', pulls: '10K+', tags: ['Q4_K_M', 'Q8_0'], updated: 'New', hot: true, agent: true },
- { name: 'qwen3', description: 'Qwen 3 — top-tier reasoning and coding. Thinking mode support.', pulls: '5M+', tags: ['8B', '14B', '32B'], updated: 'Popular', agent: true },
- { name: 'llama4', description: 'Meta Llama 4 — latest generation MoE. Needs 64GB+ RAM.', pulls: '1M+', tags: ['scout', 'maverick'], updated: 'New', agent: true },
- { name: 'deepseek-r1', description: 'DeepSeek R1 — chain-of-thought reasoning model. Shows its thinking.', pulls: '2M+', tags: ['8B', '14B', '32B', '70B'], updated: 'Popular' },
- { name: 'phi4', description: 'Microsoft Phi 4 — excellent math, logic, structured tasks.', pulls: '500K+', tags: ['14B'], updated: 'Popular', agent: true },
- { name: 'mistral-small', description: 'Mistral Small — fast, multilingual, native tool calling.', pulls: '300K+', tags: ['24B'], updated: 'Popular', agent: true },
- ]
+ return sortByRelease([
+ { name: 'gemma4', description: 'Google Gemma 4 — native tool calling + vision. 128-256K context. Apache 2.0.', pulls: '100K+', tags: ['e2b', 'e4b', '26B', '31B'], updated: 'New', hot: true, agent: true, released: '2026-04' },
+ { name: 'qwen3-coder', description: 'Qwen3-Coder — 30B MoE coding agent (3B active). Native tool calling, 256K context.', pulls: '100K+', tags: ['30B', '480B'], updated: 'New', hot: true, agent: true, released: '2026-02' },
+ { name: 'qwen3-coder-next', description: 'Qwen3-Coder-Next — 80B MoE (3B active). Optimized for agentic coding workflows.', pulls: '10K+', tags: ['Q4_K_M', 'Q8_0'], updated: 'New', hot: true, agent: true, released: '2026-03' },
+ { name: 'qwen3', description: 'Qwen 3 — top-tier reasoning and coding. Thinking mode support.', pulls: '5M+', tags: ['8B', '14B', '32B'], updated: 'Popular', agent: true, released: '2025-05' },
+ { name: 'llama4', description: 'Meta Llama 4 — latest generation MoE. Needs 64GB+ RAM.', pulls: '1M+', tags: ['scout', 'maverick'], updated: 'New', agent: true, released: '2025-04' },
+ { name: 'deepseek-r1', description: 'DeepSeek R1 — chain-of-thought reasoning model. Shows its thinking.', pulls: '2M+', tags: ['8B', '14B', '32B', '70B'], updated: 'Popular', released: '2025-01' },
+ { name: 'phi4', description: 'Microsoft Phi 4 — excellent math, logic, structured tasks.', pulls: '500K+', tags: ['14B'], updated: 'Popular', agent: true, released: '2024-12' },
+ { name: 'mistral-small', description: 'Mistral Small — fast, multilingual, native tool calling.', pulls: '300K+', tags: ['24B'], updated: 'Popular', agent: true, released: '2024-09' },
+ ])
}
/** Combined curated list for search fallback — uncensored first */
@@ -248,6 +322,173 @@ function getCuratedTextModels(): DiscoverModel[] {
return [...getUncensoredTextModels(), ...getMainstreamTextModels()]
}
+// ─── Multi-Provider Discovery ───
+
+/** Fetch models from an OpenAI-compatible provider */
+export async function getOpenAIProviderModels(providerName: string): Promise<DiscoverModel[]> {
+ try {
+ const { getProvider } = await import('./providers/registry')
+ const provider = getProvider('openai')
+ const models = await provider.listModels()
+ return models.map(m => ({
+ name: m.id,
+ description: m.name !== m.id ? m.name : '',
+ pulls: '',
+ tags: m.contextLength ? [`${Math.round(m.contextLength / 1024)}K ctx`] : [],
+ updated: '',
+ provider: 'openai' as ProviderId,
+ providerName,
+ canPull: false,
+ agent: m.supportsTools,
+ }))
+ } catch {
+ return []
+ }
+}
+
+/** Fetch Anthropic Claude models */
+export async function getAnthropicModels(): Promise<DiscoverModel[]> {
+ try {
+ const { getProvider } = await import('./providers/registry')
+ const provider = getProvider('anthropic')
+ const models = await provider.listModels()
+ return models.map(m => ({
+ name: m.id,
+ description: m.name,
+ pulls: '',
+ tags: [
+ m.contextLength ? `${Math.round(m.contextLength / 1000)}K ctx` : '',
+ m.supportsTools ? 'Tools' : '',
+ m.supportsVision ? 'Vision' : '',
+ ].filter(Boolean),
+ updated: '',
+ provider: 'anthropic' as ProviderId,
+ providerName: 'Anthropic',
+ canPull: false,
+ agent: m.supportsTools,
+ }))
+ } catch {
+ return []
+ }
+}
+
+// ─── HuggingFace GGUF Discovery ───
+
+const HF = (repo: string, file: string) => `https://huggingface.co/${repo}/resolve/main/${file}`
+
+/** Uncensored GGUF models from HuggingFace */
+export function getHuggingFaceUncensoredModels(): DiscoverModel[] {
+ return sortByRelease([
+ { name: 'Hermes 3 Llama 3.1 8B', description: 'NousResearch Hermes 3 — uncensored + native tool calling. THE agent model.', tags: ['8B', 'Q4_K_M', '5 GB'], updated: 'Hot', hot: true, agent: true, released: '2024-08', downloadUrl: HF('bartowski/Hermes-3-Llama-3.1-8B-GGUF', 'Hermes-3-Llama-3.1-8B-Q4_K_M.gguf'), filename: 'Hermes-3-Llama-3.1-8B-Q4_K_M.gguf', sizeGB: 5 },
+ { name: 'Dolphin 3 Llama 3.1 8B', description: 'Dolphin 3 — uncensored from training. Coding, math, general purpose.', tags: ['8B', 'Q4_K_M', '5 GB'], updated: 'Hot', hot: true, released: '2024-12', downloadUrl: HF('bartowski/dolphin-2.9.4-llama3.1-8b-GGUF', 'dolphin-2.9.4-llama3.1-8b-Q4_K_M.gguf'), filename: 'dolphin-2.9.4-llama3.1-8b-Q4_K_M.gguf', sizeGB: 5 },
+ ])
+}
+
+/** Mainstream GGUF models from HuggingFace — all URLs verified */
+export function getHuggingFaceMainstreamModels(): DiscoverModel[] {
+ return sortByRelease([
+ // ── Gemma 4 (April 2026) ──
+ { name: 'Gemma 4 31B', description: 'Google Gemma 4 31B — frontier dense model, native tools + vision. 256K context.', tags: ['31B', 'Q4_K_M', '20 GB'], updated: 'Hot', hot: true, agent: true, released: '2026-04', downloadUrl: HF('unsloth/gemma-4-31B-it-GGUF', 'gemma-4-31B-it-Q4_K_M.gguf'), filename: 'gemma-4-31B-it-Q4_K_M.gguf', sizeGB: 20 },
+ { name: 'Gemma 4 26B MoE', description: 'Gemma 4 26B MoE — 26B brain, runs like 4B. Tools + vision. Apache 2.0.', tags: ['26B', 'Q4_K_XL', '18 GB'], updated: 'Hot', hot: true, agent: true, released: '2026-04', downloadUrl: HF('unsloth/gemma-4-26B-A4B-it-GGUF', 'gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf'), filename: 'gemma-4-26B-A4B-it-UD-Q4_K_XL.gguf', sizeGB: 18 },
+ { name: 'Gemma 4 E4B', description: 'Gemma 4 E4B — lightweight 4.5B, great for small GPUs.', tags: ['4.5B', 'Q4_K_M', '5 GB'], updated: 'Hot', hot: true, released: '2026-04', downloadUrl: HF('unsloth/gemma-4-E4B-it-GGUF', 'gemma-4-E4B-it-Q4_K_M.gguf'), filename: 'gemma-4-E4B-it-Q4_K_M.gguf', sizeGB: 5 },
+ { name: 'Gemma 4 E2B', description: 'Gemma 4 E2B — ultra-light 2.3B, runs on anything.', tags: ['2.3B', 'Q4_K_M', '3 GB'], updated: 'New', released: '2026-04', downloadUrl: HF('unsloth/gemma-4-E2B-it-GGUF', 'gemma-4-E2B-it-Q4_K_M.gguf'), filename: 'gemma-4-E2B-it-Q4_K_M.gguf', sizeGB: 3 },
+ // ── Qwen 3.5 (March 2026) ──
+ { name: 'Qwen 3.5 35B MoE', description: 'Qwen 3.5 35B MoE — best agentic, 256K context. SWE-bench leader.', tags: ['35B', 'Q4_K_M', '22 GB'], updated: 'Hot', hot: true, agent: true, released: '2026-03', downloadUrl: HF('unsloth/Qwen3.5-35B-A3B-GGUF', 'Qwen3.5-35B-A3B-Q4_K_M.gguf'), filename: 'Qwen3.5-35B-A3B-Q4_K_M.gguf', sizeGB: 22 },
+ { name: 'Qwen 3.5 27B', description: 'Qwen 3.5 27B dense — strongest reasoning + coding.', tags: ['27B', 'Q4_K_M', '17 GB'], updated: 'Hot', hot: true, released: '2026-03', downloadUrl: HF('unsloth/Qwen3.5-27B-GGUF', 'Qwen3.5-27B-Q4_K_M.gguf'), filename: 'Qwen3.5-27B-Q4_K_M.gguf', sizeGB: 17 },
+ { name: 'Qwen 3.5 9B', description: 'Qwen 3.5 9B — excellent balance of speed and quality.', tags: ['9B', 'Q4_K_M', '6 GB'], updated: 'New', released: '2026-03', downloadUrl: HF('unsloth/Qwen3.5-9B-GGUF', 'Qwen3.5-9B-Q4_K_M.gguf'), filename: 'Qwen3.5-9B-Q4_K_M.gguf', sizeGB: 6 },
+ // ── GPT-OSS (March 2026) ──
+ { name: 'GPT-OSS 20B', description: 'OpenAI GPT-OSS — open-source GPT model, strong all-rounder.', tags: ['20B', 'Q4_K_M', '13 GB'], updated: 'Hot', hot: true, released: '2026-03', downloadUrl: HF('unsloth/gpt-oss-20b-GGUF', 'gpt-oss-20b-Q4_K_M.gguf'), filename: 'gpt-oss-20b-Q4_K_M.gguf', sizeGB: 13 },
+ // ── Qwen3-Coder (March 2026) ──
+ { name: 'Qwen3-Coder-Next', description: 'Qwen3-Coder-Next — 80B MoE, optimized for agentic coding.', tags: ['80B MoE', 'Q4_K_M', '25 GB'], updated: 'Hot', hot: true, agent: true, released: '2026-03', downloadUrl: HF('unsloth/Qwen3-Coder-Next-GGUF', 'Qwen3-Coder-Next-Q4_K_M.gguf'), filename: 'Qwen3-Coder-Next-Q4_K_M.gguf', sizeGB: 25 },
+ // ── DeepSeek (Jan-Jun 2025) ──
+ { name: 'DeepSeek R1 Qwen3 8B', description: 'DeepSeek R1 distilled into Qwen3 8B — chain-of-thought reasoning.', tags: ['8B', 'Q4_K_M', '5 GB'], updated: 'Popular', released: '2025-06', downloadUrl: HF('unsloth/DeepSeek-R1-0528-Qwen3-8B-GGUF', 'DeepSeek-R1-0528-Qwen3-8B-Q4_K_M.gguf'), filename: 'DeepSeek-R1-0528-Qwen3-8B-Q4_K_M.gguf', sizeGB: 5 },
+ { name: 'DeepSeek R1 Qwen 14B', description: 'DeepSeek R1 distilled into Qwen 14B — stronger reasoning.', tags: ['14B', 'Q4_K_M', '9 GB'], updated: 'Popular', released: '2025-01', downloadUrl: HF('unsloth/DeepSeek-R1-Distill-Qwen-14B-GGUF', 'DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.gguf'), filename: 'DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.gguf', sizeGB: 9 },
+ // ── Qwen 3 (May 2025) ──
+ { name: 'Qwen 3 8B', description: 'Qwen 3 8B — top-tier reasoning and coding. Thinking mode.', tags: ['8B', 'Q4_K_M', '5 GB'], updated: 'Popular', agent: true, released: '2025-05', downloadUrl: HF('unsloth/Qwen3-8B-GGUF', 'Qwen3-8B-Q4_K_M.gguf'), filename: 'Qwen3-8B-Q4_K_M.gguf', sizeGB: 5 },
+ { name: 'Qwen 3 4B', description: 'Qwen 3 4B — fast, lightweight, solid for small GPUs.', tags: ['4B', 'Q4_K_M', '3 GB'], updated: 'Popular', released: '2025-05', downloadUrl: HF('unsloth/Qwen3-4B-GGUF', 'Qwen3-4B-Q4_K_M.gguf'), filename: 'Qwen3-4B-Q4_K_M.gguf', sizeGB: 3 },
+ // ── Llama 4 (April 2025) ──
+ { name: 'Llama 4 Scout', description: 'Meta Llama 4 Scout — 16x17B MoE. Massive context window.', tags: ['Scout', 'Q2_K_XL', '65 GB'], updated: 'New', agent: true, released: '2025-04', downloadUrl: HF('unsloth/Llama-4-Scout-17B-16E-Instruct-GGUF', 'Llama-4-Scout-17B-16E-Instruct-UD-Q2_K_XL.gguf'), filename: 'Llama-4-Scout-17B-16E-Instruct-UD-Q2_K_XL.gguf', sizeGB: 65 },
+ // ── Gemma 3 (March 2025) ──
+ { name: 'Gemma 3 12B', description: 'Google Gemma 3 12B — vision support, great quality.', tags: ['12B', 'Q4_K_M', '8 GB'], updated: 'Popular', released: '2025-03', downloadUrl: HF('unsloth/gemma-3-12b-it-GGUF', 'gemma-3-12b-it-Q4_K_M.gguf'), filename: 'gemma-3-12b-it-Q4_K_M.gguf', sizeGB: 8 },
+ { name: 'Gemma 3 27B', description: 'Google Gemma 3 27B — strong reasoning + vision.', tags: ['27B', 'Q4_K_M', '17 GB'], updated: 'Popular', released: '2025-03', downloadUrl: HF('unsloth/gemma-3-27b-it-GGUF', 'gemma-3-27b-it-Q4_K_M.gguf'), filename: 'gemma-3-27b-it-Q4_K_M.gguf', sizeGB: 17 },
+ // ── Phi 4 (Dec 2024) ──
+ { name: 'Phi-4 14B', description: 'Microsoft Phi-4 — excellent at math, logic, structured tasks.', tags: ['14B', 'Q4_K_M', '9 GB'], updated: 'Popular', agent: true, released: '2024-12', downloadUrl: HF('bartowski/phi-4-GGUF', 'phi-4-Q4_K_M.gguf'), filename: 'phi-4-Q4_K_M.gguf', sizeGB: 9 },
+ // ── Llama 3.3 / 3.1 ──
+ { name: 'Llama 3.3 70B', description: 'Meta Llama 3.3 70B — maximum intelligence for high-end setups.', tags: ['70B', 'Q4_K_M', '42 GB'], updated: 'Popular', released: '2024-12', downloadUrl: HF('bartowski/Llama-3.3-70B-Instruct-GGUF', 'Llama-3.3-70B-Instruct-Q4_K_M.gguf'), filename: 'Llama-3.3-70B-Instruct-Q4_K_M.gguf', sizeGB: 42 },
+ { name: 'Llama 3.1 8B', description: 'Meta Llama 3.1 8B — fast, reliable, great entry point.', tags: ['8B', 'Q4_K_M', '5 GB'], updated: 'Popular', released: '2024-07', downloadUrl: HF('bartowski/Meta-Llama-3.1-8B-Instruct-GGUF', 'Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf'), filename: 'Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf', sizeGB: 5 },
+ // ── Mistral ──
+ { name: 'Mistral Small 24B', description: 'Mistral Small — fast, multilingual, native tool calling.', tags: ['24B', 'Q4_K_M', '14 GB'], updated: 'Popular', agent: true, released: '2024-09', downloadUrl: HF('bartowski/Mistral-Small-24B-Instruct-2501-GGUF', 'Mistral-Small-24B-Instruct-2501-Q4_K_M.gguf'), filename: 'Mistral-Small-24B-Instruct-2501-Q4_K_M.gguf', sizeGB: 14 },
+ { name: 'Mistral Nemo 12B', description: 'Mistral Nemo 12B — multilingual powerhouse.', tags: ['12B', 'Q4_K_M', '7 GB'], updated: 'Popular', released: '2024-07', downloadUrl: HF('bartowski/Mistral-Nemo-Instruct-2407-GGUF', 'Mistral-Nemo-Instruct-2407-Q4_K_M.gguf'), filename: 'Mistral-Nemo-Instruct-2407-Q4_K_M.gguf', sizeGB: 7 },
+ // ── Qwen 2.5 ──
+ { name: 'Qwen 2.5 7B', description: 'Qwen 2.5 7B — proven and reliable all-rounder.', tags: ['7B', 'Q4_K_M', '5 GB'], updated: 'Popular', released: '2024-09', downloadUrl: HF('bartowski/Qwen2.5-7B-Instruct-GGUF', 'Qwen2.5-7B-Instruct-Q4_K_M.gguf'), filename: 'Qwen2.5-7B-Instruct-Q4_K_M.gguf', sizeGB: 5 },
+ ])
+}
+
+/** Combined HF models for search fallback */
+export function getHuggingFaceModels(): DiscoverModel[] {
+ return [...getHuggingFaceUncensoredModels(), ...getHuggingFaceMainstreamModels()]
+}
+
+/** Search HuggingFace for GGUF models */
+export async function searchHuggingFaceModels(query: string): Promise<DiscoverModel[]> {
+ try {
+ const searchQuery = query.includes('gguf') ? query : `${query} gguf`
+ const url = `https://huggingface.co/api/models?search=${encodeURIComponent(searchQuery)}&filter=gguf&sort=downloads&direction=-1&limit=20`
+
+ let json: string
+ const { isTauri, fetchExternal } = await import('./backend')
+ if (isTauri()) {
+ json = await fetchExternal(url)
+ } else {
+ const res = await fetch(url)
+ json = await res.text()
+ }
+
+ const repos: Array<{ id: string; downloads?: number; modelId?: string }> = JSON.parse(json)
+
+ const models: DiscoverModel[] = []
+ for (const repo of repos) {
+ // Derive Q4_K_M filename from repo name: "user/Model-Name-GGUF" → "Model-Name-Q4_K_M.gguf"
+ const repoName = repo.id.split('/').pop() || ''
+ const baseName = repoName.replace(/-GGUF$/i, '').replace(/-gguf$/i, '')
+ const q4File = `${baseName}-Q4_K_M.gguf`
+ const downloadUrl = `https://huggingface.co/${repo.id}/resolve/main/${q4File}`
+
+ const downloads = repo.downloads || 0
+ const pullsStr = downloads > 1000000 ? `${(downloads / 1000000).toFixed(1)}M` :
+ downloads > 1000 ? `${Math.round(downloads / 1000)}K` : `${downloads}`
+
+ models.push({
+ name: baseName,
+ description: repo.id,
+ pulls: pullsStr,
+ tags: ['Q4_K_M', 'GGUF'],
+ updated: '',
+ downloadUrl,
+ filename: q4File,
+ url: `https://huggingface.co/${repo.id}`,
+ })
+ }
+ return models
+ } catch {
+ return []
+ }
+}
+
+/** Detect the model directory for the active local provider */
+export async function detectProviderModelPath(providerName: string): Promise<string | null> {
+ try {
+ return await backendCall('detect_model_path', { provider: providerName })
+ } catch {
+ return null
+ }
+}
+
+/** Download a GGUF model to a specific directory (for non-Ollama providers) */
+export async function startModelDownloadToPath(url: string, destDir: string, filename: string): Promise<{ status: string; id: string; error?: string }> {
+ return backendCall('download_model_to_path', { url, dest_dir: destDir, filename })
+}
+
// ─── Image Model Bundles ───
export function getImageBundles(): ModelBundle[] {
@@ -441,17 +682,53 @@ export function getImageModelsDiscover(): DiscoverModel[] {
// Each bundle contains ALL files needed for a working video workflow.
// "Install All" downloads model + VAE + CLIP together.
+export interface CustomNodeDef {
+ key: string
+ repo: string
+ name: string
+}
+
+export const CUSTOM_NODE_REGISTRY: Record<string, { repo: string; name: string; requiredNodes: string[] }> = {
+ 'animatediff-evolved': {
+ repo: 'https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved',
+ name: 'ComfyUI-AnimateDiff-Evolved',
+ requiredNodes: ['ADE_LoadAnimateDiffModel', 'ADE_ApplyAnimateDiffModelSimple', 'ADE_UseEvolvedSampling'],
+ },
+ 'cogvideox-wrapper': {
+ repo: 'https://github.com/kijai/ComfyUI-CogVideoXWrapper',
+ name: 'ComfyUI-CogVideoXWrapper',
+ requiredNodes: ['CogVideoXModelLoader', 'CogVideoXCLIPLoader', 'CogVideoXTextEncode', 'CogVideoXEmptyLatents', 'CogVideoXSampler', 'CogVideoXVAEDecode'],
+ },
+ 'framepack-wrapper': {
+ repo: 'https://github.com/kijai/ComfyUI-FramePackWrapper',
+ name: 'ComfyUI-FramePackWrapper',
+ requiredNodes: ['FramePackModelLoader', 'FramePackEncode', 'FramePackSampler'],
+ },
+ 'pyramidflow-wrapper': {
+ repo: 'https://github.com/kijai/ComfyUI-PyramidFlowWrapper',
+ name: 'ComfyUI-PyramidFlowWrapper',
+ requiredNodes: ['PyramidFlowModelLoader', 'PyramidFlowVAELoader', 'PyramidFlowTextEncode', 'PyramidFlowSampler', 'PyramidFlowDecode'],
+ },
+ 'allegro': {
+ repo: 'https://github.com/bombax-xiaoice/ComfyUI-Allegro',
+ name: 'ComfyUI-Allegro',
+ requiredNodes: ['AllegroModelLoader', 'AllegroTextEncode', 'AllegroSampler', 'AllegroDecoder'],
+ },
+}
+
export interface ModelBundle {
name: string
description: string
tags: string[]
totalSizeGB: number
vramRequired: string
- workflow: 'wan' | 'hunyuan' | 'animatediff'
+ workflow: string
files: DiscoverModel[]
url?: string
hot?: boolean
uncensored?: boolean
+ customNodes?: string[] // keys into CUSTOM_NODE_REGISTRY
+ i2v?: boolean // Image-to-Video model
}
export function getVideoBundles(): ModelBundle[] {
@@ -527,6 +804,7 @@ export function getVideoBundles(): ModelBundle[] {
name: 'HunyuanVideo 1.5 T2V FP8 (High Quality)',
description: 'Tencent HunyuanVideo 1.5 — excellent temporal consistency and visual quality. 480p text-to-video with CFG distillation.',
tags: ['HunyuanVideo 1.5', '480p', 'Quality'],
+ uncensored: true,
totalSizeGB: 21.5,
vramRequired: '12+ GB',
workflow: 'hunyuan',
@@ -568,7 +846,7 @@ export function getVideoBundles(): ModelBundle[] {
tags: ['LTX 2.3', '22B', 'Quality'],
totalSizeGB: 35,
vramRequired: '16+ GB',
- workflow: 'wan',
+ workflow: 'ltx',
url: 'https://huggingface.co/Lightricks/LTX-2.3-fp8',
files: [
{
@@ -587,6 +865,299 @@ export function getVideoBundles(): ModelBundle[] {
},
],
},
+ // ─── NEW VIDEO BUNDLES ───
+ {
+ name: 'AnimateDiff Lightning',
+ description: 'Ultra-fast 4-step animation on any SD1.5 checkpoint. Great for quick iterations. Needs an SD1.5 base model.',
+ tags: ['AnimateDiff', '512x512', 'Lightning'],
+ hot: true,
+ totalSizeGB: 2.4,
+ vramRequired: '6-8 GB',
+ workflow: 'animatediff',
+ customNodes: ['animatediff-evolved'],
+ url: 'https://huggingface.co/ByteDance/AnimateDiff-Lightning',
+ files: [
+ {
+ name: 'AnimateDiff Lightning Motion Model (4-step)',
+ description: 'Lightning-fast motion model — only 4 sampling steps needed.',
+ pulls: '', tags: ['Motion', '400 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/ByteDance/AnimateDiff-Lightning/resolve/main/animatediff_lightning_4step_comfyui.safetensors',
+ filename: 'animatediff_lightning_4step_comfyui.safetensors', subfolder: 'custom_nodes/ComfyUI-AnimateDiff-Evolved/models', sizeGB: 0.4,
+ },
+ {
+ name: 'Realistic Vision V6 (SD1.5 Base)',
+ description: 'Recommended SD1.5 base checkpoint for realistic animations.',
+ pulls: '', tags: ['Checkpoint', '~2 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/SG161222/Realistic_Vision_V6.0_B1_noVAE/resolve/main/Realistic_Vision_V6.0_NV_B1_fp16.safetensors',
+ filename: 'Realistic_Vision_V6.0_NV_B1_fp16.safetensors', subfolder: 'checkpoints', sizeGB: 2.0,
+ },
+ ],
+ },
+ {
+ name: 'AnimateDiff v3',
+ description: 'Classic AnimateDiff with more frames and better quality than Lightning. Slower but more detailed.',
+ tags: ['AnimateDiff', '512x768', 'Quality'],
+ totalSizeGB: 3.8,
+ vramRequired: '6-8 GB',
+ workflow: 'animatediff',
+ customNodes: ['animatediff-evolved'],
+ url: 'https://huggingface.co/guoyww/animatediff',
+ files: [
+ {
+ name: 'AnimateDiff v3 Motion Adapter',
+ description: 'Standard motion model — 20 steps, good quality.',
+ pulls: '', tags: ['Motion', '1.8 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/guoyww/animatediff/resolve/main/v3_sd15_adapter.ckpt',
+ filename: 'v3_sd15_adapter.ckpt', subfolder: 'custom_nodes/ComfyUI-AnimateDiff-Evolved/models', sizeGB: 1.8,
+ },
+ {
+ name: 'Realistic Vision V6 (SD1.5 Base)',
+ description: 'Recommended SD1.5 base checkpoint.',
+ pulls: '', tags: ['Checkpoint', '~2 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/SG161222/Realistic_Vision_V6.0_B1_noVAE/resolve/main/Realistic_Vision_V6.0_NV_B1_fp16.safetensors',
+ filename: 'Realistic_Vision_V6.0_NV_B1_fp16.safetensors', subfolder: 'checkpoints', sizeGB: 2.0,
+ },
+ ],
+ },
+ {
+ name: 'CogVideoX 2B',
+ description: 'Lightweight video model by Tsinghua. 480x480 output, 8-12 GB VRAM. Good text-to-video quality for its size.',
+ tags: ['CogVideoX', '480x480', 'Lightweight'],
+ uncensored: true,
+ totalSizeGB: 15.3,
+ vramRequired: '8-12 GB',
+ workflow: 'cogvideo',
+ customNodes: ['cogvideox-wrapper'],
+ url: 'https://huggingface.co/THUDM/CogVideoX-2b',
+ files: [
+ {
+ name: 'CogVideoX 2B Model',
+ description: 'Main video generation model.',
+ pulls: '', tags: ['Model', '5.5 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/CogVideoX_2b_bf16.safetensors',
+ filename: 'CogVideoX_2b_bf16.safetensors', subfolder: 'diffusion_models', sizeGB: 5.5,
+ },
+ {
+ name: 'CogVideoX VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '300 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/cogvideox_vae.safetensors',
+ filename: 'cogvideox_vae.safetensors', subfolder: 'vae', sizeGB: 0.3,
+ },
+ {
+ name: 'T5-XXL Text Encoder (FP16)',
+ description: 'Required text encoder (shared with other models).',
+ pulls: '', tags: ['Text Encoder', '9.5 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/t5xxl_fp16.safetensors',
+ filename: 't5xxl_fp16.safetensors', subfolder: 'text_encoders', sizeGB: 9.5,
+ },
+ ],
+ },
+ {
+ name: 'CogVideoX 1.5 5B',
+ description: 'Larger CogVideoX with 1360x768 output. Better quality, needs 16 GB VRAM.',
+ tags: ['CogVideoX 1.5', '1360x768', 'Quality'],
+ uncensored: true,
+ totalSizeGB: 19.8,
+ vramRequired: '16+ GB',
+ workflow: 'cogvideo',
+ customNodes: ['cogvideox-wrapper'],
+ url: 'https://huggingface.co/THUDM/CogVideoX1.5-5B',
+ files: [
+ {
+ name: 'CogVideoX 1.5 5B Model',
+ description: 'Higher quality video model with wider resolution.',
+ pulls: '', tags: ['Model', '10 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/CogVideoX1.5_5b_bf16.safetensors',
+ filename: 'CogVideoX1.5_5b_bf16.safetensors', subfolder: 'diffusion_models', sizeGB: 10,
+ },
+ {
+ name: 'CogVideoX VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '300 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/cogvideox_vae.safetensors',
+ filename: 'cogvideox_vae.safetensors', subfolder: 'vae', sizeGB: 0.3,
+ },
+ {
+ name: 'T5-XXL Text Encoder (FP16)',
+ description: 'Required text encoder (shared with other models).',
+ pulls: '', tags: ['Text Encoder', '9.5 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/CogVideoX_comfy/resolve/main/t5xxl_fp16.safetensors',
+ filename: 't5xxl_fp16.safetensors', subfolder: 'text_encoders', sizeGB: 9.5,
+ },
+ ],
+ },
+ {
+ name: 'FramePack F1 (Image-to-Video)',
+ description: 'Revolutionary I2V: runs on 6 GB VRAM via next-frame prediction. Upload an image, get a video. Uses HunyuanVideo backbone.',
+ tags: ['FramePack', 'I2V', 'Low VRAM'],
+ hot: true,
+ uncensored: true,
+ totalSizeGB: 19.3,
+ vramRequired: '6-8 GB',
+ workflow: 'framepack',
+ i2v: true,
+ customNodes: ['framepack-wrapper'],
+ url: 'https://huggingface.co/lllyasviel/FramePack_F1_I2V_HY_20250503',
+ files: [
+ {
+ name: 'FramePack F1 I2V Model (FP8)',
+ description: 'Main I2V model — generates video from a single image.',
+ pulls: '', tags: ['Model', '13 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/HunyuanVideo_comfy/resolve/main/FramePackI2V_HY_fp8_e4m3fn.safetensors',
+ filename: 'FramePackI2V_HY_fp8_e4m3fn.safetensors', subfolder: 'diffusion_models', sizeGB: 13,
+ },
+ {
+ name: 'SigCLIP Vision Encoder',
+ description: 'Required vision encoder for image understanding.',
+ pulls: '', tags: ['CLIP Vision', '900 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/sigclip_vision_384/resolve/main/sigclip_vision_384.safetensors',
+ filename: 'sigclip_vision_384.safetensors', subfolder: 'clip_vision', sizeGB: 0.9,
+ },
+ {
+ name: 'HunyuanVideo VAE',
+ description: 'Required video encoder/decoder (shared with HunyuanVideo).',
+ pulls: '', tags: ['VAE', '490 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors',
+ filename: 'hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae', sizeGB: 0.5,
+ },
+ {
+ name: 'CLIP-L Text Encoder',
+ description: 'Required text encoder (shared).',
+ pulls: '', tags: ['Text Encoder', '240 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/text_encoders/clip_l.safetensors',
+ filename: 'clip_l.safetensors', subfolder: 'text_encoders', sizeGB: 0.2,
+ },
+ {
+ name: 'LLaVA LLaMA3 Text Encoder (FP8)',
+ description: 'Required text encoder for FramePack.',
+ pulls: '', tags: ['Text Encoder', '4.7 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/text_encoders/llava_llama3_fp8_scaled.safetensors',
+ filename: 'llava_llama3_fp8_scaled.safetensors', subfolder: 'text_encoders', sizeGB: 4.7,
+ },
+ ],
+ },
+ {
+ name: 'SVD-XT 1.1 (Image-to-Video)',
+ description: 'Stable Video Diffusion by Stability AI. Upload an image, get 25 frames of smooth video. Native ComfyUI support.',
+ tags: ['SVD', 'I2V', 'Native'],
+ totalSizeGB: 9.5,
+ vramRequired: '12+ GB',
+ workflow: 'svd',
+ i2v: true,
+ url: 'https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt-1-1',
+ files: [
+ {
+ name: 'SVD-XT 1.1 Checkpoint',
+ description: 'Complete I2V model — no additional downloads needed.',
+ pulls: '', tags: ['Checkpoint', '9.5 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt-1-1/resolve/main/svd_xt_1_1.safetensors',
+ filename: 'svd_xt_1_1.safetensors', subfolder: 'checkpoints', sizeGB: 9.5,
+ },
+ ],
+ },
+ {
+ name: 'Mochi 1 Preview (FP8)',
+ description: 'Genmo Mochi — 848x480 video at 24 FPS. Good motion and temporal consistency. Native ComfyUI support.',
+ tags: ['Mochi', '848x480', 'Native'],
+ totalSizeGB: 10.3,
+ vramRequired: '16+ GB',
+ workflow: 'mochi',
+ url: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged',
+ files: [
+ {
+ name: 'Mochi 1 Preview (FP8)',
+ description: 'Main video model (quantized for lower VRAM).',
+ pulls: '', tags: ['Model', '10 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/diffusion_models/mochi_preview_fp8_scaled.safetensors',
+ filename: 'mochi_preview_fp8_scaled.safetensors', subfolder: 'diffusion_models', sizeGB: 10,
+ },
+ {
+ name: 'Mochi VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '300 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/vae/mochi_vae.safetensors',
+ filename: 'mochi_vae.safetensors', subfolder: 'vae', sizeGB: 0.3,
+ },
+ ],
+ },
+ {
+ name: 'Pyramid Flow SD3',
+ description: 'Pyramid-style temporal generation based on SD3. 768x1280 output. Experimental but interesting results.',
+ tags: ['Pyramid Flow', '768x1280', 'Experimental'],
+ totalSizeGB: 8.8,
+ vramRequired: '16+ GB',
+ workflow: 'pyramidflow',
+ customNodes: ['pyramidflow-wrapper'],
+ url: 'https://huggingface.co/rain1011/pyramid-flow-sd3',
+ files: [
+ {
+ name: 'Pyramid Flow Model',
+ description: 'Main video generation model.',
+ pulls: '', tags: ['Model', '8.5 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/pyramid-flow-comfy/resolve/main/pyramid_flow_model.safetensors',
+ filename: 'pyramid_flow_model.safetensors', subfolder: 'diffusion_models', sizeGB: 8.5,
+ },
+ {
+ name: 'Pyramid Flow VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '300 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Kijai/pyramid-flow-comfy/resolve/main/pyramid_flow_vae.safetensors',
+ filename: 'pyramid_flow_vae.safetensors', subfolder: 'vae', sizeGB: 0.3,
+ },
+ ],
+ },
+ {
+ name: 'Allegro',
+ description: 'Rhymes AI Allegro — 720x1280 video at 15 FPS. Diffusers format, auto-downloaded on first use. High VRAM needed.',
+ tags: ['Allegro', '720x1280', 'High-End'],
+ totalSizeGB: 15.5,
+ vramRequired: '24+ GB',
+ workflow: 'allegro',
+ customNodes: ['allegro'],
+ url: 'https://huggingface.co/rhymes-ai/Allegro',
+ files: [
+ {
+ name: 'Allegro Model (Diffusers)',
+ description: 'Full model — auto-downloads additional components on first ComfyUI use.',
+ pulls: '', tags: ['Model', '~15.5 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/rhymes-ai/Allegro/resolve/main/model_index.json',
+ filename: 'allegro_model_index.json', subfolder: 'diffusion_models', sizeGB: 15.5,
+ },
+ ],
+ },
+ {
+ name: 'NVIDIA Cosmos 7B',
+ description: 'NVIDIA Cosmos Diffusion 7B Text-to-World. 1024x1024 output at 24 FPS. Native ComfyUI support. Uses oldt5 text encoder (NOT t5xxl).',
+ tags: ['Cosmos', '1024x1024', 'NVIDIA'],
+ totalSizeGB: 19.2,
+ vramRequired: '24+ GB',
+ workflow: 'cosmos',
+ url: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text2world_safetensors',
+ files: [
+ {
+ name: 'Cosmos 7B Text2World',
+ description: 'Main video generation model by NVIDIA.',
+ pulls: '', tags: ['Model', '14 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text2world_safetensors/resolve/main/Cosmos-1_0-Diffusion-7B-Text2World.safetensors',
+ filename: 'Cosmos-1_0-Diffusion-7B-Text2World.safetensors', subfolder: 'diffusion_models', sizeGB: 14,
+ },
+ {
+ name: 'OldT5-XXL Text Encoder (FP8)',
+ description: 'Required text encoder — NOT the same as regular T5-XXL!',
+ pulls: '', tags: ['Text Encoder', '4.9 GB'], updated: '',
+ downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text2world_safetensors/resolve/main/oldt5_xxl_fp8_e4m3fn_scaled.safetensors',
+ filename: 'oldt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders', sizeGB: 4.9,
+ },
+ {
+ name: 'Cosmos VAE',
+ description: 'Required video encoder/decoder.',
+ pulls: '', tags: ['VAE', '300 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text2world_safetensors/resolve/main/cosmos_cv8x8x8_1.0.safetensors',
+ filename: 'cosmos_cv8x8x8_1.0.safetensors', subfolder: 'vae', sizeGB: 0.3,
+ },
+ ],
+ },
]
}
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 99bfa1e3..457c77b1 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -16,6 +16,13 @@ export type WorkflowStrategy =
| 'unet_flux2' // FLUX 2: UNETLoader + CLIPLoader + VAELoader + EmptyFlux2LatentImage
| 'unet_video' // Wan/Hunyuan: UNETLoader + CLIPLoader + VAELoader + EmptyHunyuanLatentVideo
| 'unet_ltx' // LTX Video: UNETLoader + CLIPLoader + EmptyLTXVLatentVideo
+ | 'unet_mochi' // Mochi: UNETLoader + CLIPLoader + VAELoader + EmptyMochiLatentVideo
+ | 'unet_cosmos' // Cosmos: UNETLoader + CLIPLoader(oldt5) + VAELoader + EmptyCosmosLatentVideo
+ | 'svd' // SVD: ImageOnlyCheckpointLoader + SVD_img2vid_Conditioning
+ | 'cogvideo' // CogVideoX: Kijai wrapper nodes
+ | 'framepack' // FramePack: Kijai wrapper + image input
+ | 'pyramidflow' // Pyramid Flow: Kijai wrapper nodes
+ | 'allegro' // Allegro: Community wrapper nodes
| 'checkpoint' // SDXL/SD1.5: CheckpointLoaderSimple + EmptyLatentImage
| 'animatediff' // AnimateDiff: CheckpointLoaderSimple + ADE_* nodes
| 'unavailable'
@@ -25,7 +32,7 @@ interface StrategyResult {
reason: string
}
-function determineStrategy(
+export function determineStrategy(
modelType: ModelType,
isVideo: boolean,
nodes: CategorizedNodes,
@@ -69,6 +76,67 @@ function determineStrategy(
return { strategy: 'unavailable', reason: 'Wan/Hunyuan requires UNETLoader + CLIPLoader + VAELoader nodes' }
}
+ // Mochi → UNET + EmptyMochiLatentVideo (native)
+ if (modelType === 'mochi') {
+ if (hasUNET && hasCLIPLoader && hasVAELoader) {
+ return { strategy: 'unet_mochi', reason: 'Mochi → UNETLoader + EmptyMochiLatentVideo' }
+ }
+ return { strategy: 'unavailable', reason: 'Mochi requires UNETLoader + CLIPLoader + VAELoader nodes' }
+ }
+
+ // Cosmos → UNET + EmptyCosmosLatentVideo (native, oldt5 encoder)
+ if (modelType === 'cosmos') {
+ if (hasUNET && hasCLIPLoader && hasVAELoader) {
+ return { strategy: 'unet_cosmos', reason: 'Cosmos → UNETLoader + EmptyCosmosLatentVideo (oldt5)' }
+ }
+ return { strategy: 'unavailable', reason: 'Cosmos requires UNETLoader + CLIPLoader + VAELoader nodes' }
+ }
+
+ // SVD → ImageOnlyCheckpointLoader (native, I2V)
+ if (modelType === 'svd') {
+ const hasIOCL = nodes.loaders.includes('ImageOnlyCheckpointLoader')
+ if (hasIOCL) {
+ return { strategy: 'svd', reason: 'SVD → ImageOnlyCheckpointLoader + SVD_img2vid_Conditioning' }
+ }
+ return { strategy: 'unavailable', reason: 'SVD requires ImageOnlyCheckpointLoader node' }
+ }
+
+ // CogVideoX → Kijai wrapper nodes
+ if (modelType === 'cogvideo') {
+ const hasCogNodes = nodes.samplers.includes('CogVideoXSampler')
+ if (hasCogNodes) {
+ return { strategy: 'cogvideo', reason: 'CogVideoX → Kijai wrapper pipeline' }
+ }
+ return { strategy: 'unavailable', reason: 'CogVideoX requires ComfyUI-CogVideoXWrapper custom nodes. Install them from the Model Manager.' }
+ }
+
+ // FramePack → Kijai wrapper nodes (I2V)
+ if (modelType === 'framepack') {
+ const hasFPNodes = nodes.samplers.includes('FramePackSampler')
+ if (hasFPNodes) {
+ return { strategy: 'framepack', reason: 'FramePack → Kijai wrapper pipeline (I2V)' }
+ }
+ return { strategy: 'unavailable', reason: 'FramePack requires ComfyUI-FramePackWrapper custom nodes. Install them from the Model Manager.' }
+ }
+
+ // Pyramid Flow → Kijai wrapper nodes
+ if (modelType === 'pyramidflow') {
+ const hasPFNodes = nodes.samplers.includes('PyramidFlowSampler')
+ if (hasPFNodes) {
+ return { strategy: 'pyramidflow', reason: 'Pyramid Flow → Kijai wrapper pipeline' }
+ }
+ return { strategy: 'unavailable', reason: 'Pyramid Flow requires ComfyUI-PyramidFlowWrapper custom nodes. Install them from the Model Manager.' }
+ }
+
+ // Allegro → Community wrapper nodes
+ if (modelType === 'allegro') {
+ const hasAllegroNodes = nodes.samplers.includes('AllegroSampler')
+ if (hasAllegroNodes) {
+ return { strategy: 'allegro', reason: 'Allegro → Community wrapper pipeline' }
+ }
+ return { strategy: 'unavailable', reason: 'Allegro requires ComfyUI-Allegro custom nodes. Install them from the Model Manager.' }
+ }
+
// SDXL / SD1.5 / Unknown
if (isVideo && hasAnimateDiff && hasCheckpoint && models.motionModels.length > 0) {
return { strategy: 'animatediff', reason: 'Video mode → AnimateDiff pipeline' }
@@ -108,11 +176,31 @@ export async function buildDynamicWorkflow(
throw new Error(reason)
}
+ const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
+
+ // ─── Wrapper Strategies (custom node pipelines — completely different node chains) ───
+
+ if (strategy === 'cogvideo') {
+ return buildCogVideoWorkflow(params as VideoParams, seed, nodes)
+ }
+ if (strategy === 'svd') {
+ return buildSVDWorkflow(params as VideoParams, seed, nodes)
+ }
+ if (strategy === 'framepack') {
+ return buildFramePackWorkflow(params as VideoParams, seed, nodes)
+ }
+ if (strategy === 'pyramidflow') {
+ return buildPyramidFlowWorkflow(params as VideoParams, seed, nodes)
+ }
+ if (strategy === 'allegro') {
+ return buildAllegroWorkflow(params as VideoParams, seed, nodes)
+ }
+
+ // ─── Standard Strategies (UNET/Checkpoint → CLIP → Latent → KSampler → VAEDecode) ───
+
const workflow: Record<string, any> = {}
let n = 1 // node counter
- const seed = params.seed === -1 ? Math.floor(Math.random() * 2147483647) : params.seed
-
// ─── Phase 1: Model Loading ───
let modelNodeId: string
@@ -135,7 +223,8 @@ export async function buildDynamicWorkflow(
vaeOutputSlot = 2
samplerModelId = modelNodeId
- } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_video' || strategy === 'unet_ltx') {
+ } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_video' || strategy === 'unet_ltx'
+ || strategy === 'unet_mochi' || strategy === 'unet_cosmos') {
// Separate loaders
const unetId = String(n++)
const clipId = String(n++)
@@ -143,7 +232,9 @@ export async function buildDynamicWorkflow(
const clipType = type === 'flux2' ? 'flux2'
: type === 'flux' ? 'flux'
: type === 'ltx' ? 'ltxv'
- : (type === 'wan' || type === 'hunyuan') ? 'wan'
+ : (type === 'wan' || type === 'hunyuan' || type === 'framepack') ? 'wan'
+ : type === 'mochi' ? 'mochi'
+ : type === 'cosmos' ? 'cosmos'
: 'flux'
let vae: string, clip: string
@@ -254,6 +345,24 @@ export async function buildDynamicWorkflow(
class_type: 'EmptyLatentImage',
inputs: { width: params.width, height: params.height, batch_size: videoParams.frames },
}
+ } else if (strategy === 'unet_mochi') {
+ // Mochi video latent
+ const latentNode = nodes.latentInit.includes('EmptyMochiLatentVideo')
+ ? 'EmptyMochiLatentVideo'
+ : 'EmptyHunyuanLatentVideo'
+ workflow[latentId] = {
+ class_type: latentNode,
+ inputs: { width: params.width, height: params.height, length: videoParams.frames, batch_size: 1 },
+ }
+ } else if (strategy === 'unet_cosmos') {
+ // Cosmos video latent
+ const latentNode = nodes.latentInit.includes('EmptyCosmosLatentVideo')
+ ? 'EmptyCosmosLatentVideo'
+ : 'EmptyHunyuanLatentVideo'
+ workflow[latentId] = {
+ class_type: latentNode,
+ inputs: { width: params.width, height: params.height, length: videoParams.frames, batch_size: 1 },
+ }
} else if (strategy === 'unet_ltx') {
// LTX Video latent — uses length instead of batch_size
workflow[latentId] = {
@@ -374,3 +483,160 @@ export async function buildDynamicWorkflow(
return workflow
}
+
+// ─── Wrapper Workflow Builders ───
+
+function addVideoOutput(workflow: Record<string, any>, n: number, decodeId: string, fps: number, nodes: CategorizedNodes): number {
+ const saveId = String(n++)
+ if (nodes.videoSavers.includes('VHS_VideoCombine')) {
+ workflow[saveId] = {
+ class_type: 'VHS_VideoCombine',
+ inputs: { images: [decodeId, 0], frame_rate: fps, loop_count: 0, filename_prefix: 'locally_uncensored_vid', format: 'video/h264-mp4', pingpong: false, save_output: true },
+ }
+ } else if (nodes.videoSavers.includes('SaveAnimatedWEBP')) {
+ workflow[saveId] = {
+ class_type: 'SaveAnimatedWEBP',
+ inputs: { images: [decodeId, 0], filename_prefix: 'locally_uncensored_vid', fps, lossless: false, quality: 90, method: 'default' },
+ }
+ } else {
+ workflow[saveId] = {
+ class_type: 'SaveImage',
+ inputs: { images: [decodeId, 0], filename_prefix: 'locally_uncensored_vid' },
+ }
+ }
+ return n
+}
+
+function buildCogVideoWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+
+ const modelId = String(n++)
+ const clipId = String(n++)
+ const posId = String(n++)
+ const negId = String(n++)
+ const latentId = String(n++)
+ const samplerId = String(n++)
+ const decodeId = String(n++)
+
+ workflow[modelId] = { class_type: 'CogVideoXModelLoader', inputs: { model: params.model } }
+ workflow[clipId] = { class_type: 'CogVideoXCLIPLoader', inputs: { clip_name: 't5xxl_fp16.safetensors' } }
+ workflow[posId] = { class_type: 'CogVideoXTextEncode', inputs: { text: params.prompt, clip: [clipId, 0] } }
+ workflow[negId] = { class_type: 'CogVideoXTextEncode', inputs: { text: params.negativePrompt || '', clip: [clipId, 0] } }
+ workflow[latentId] = { class_type: 'CogVideoXEmptyLatents', inputs: { width: params.width, height: params.height, frames: params.frames, batch_size: 1 } }
+ workflow[samplerId] = {
+ class_type: 'CogVideoXSampler',
+ inputs: { model: [modelId, 0], positive: [posId, 0], negative: [negId, 0], latents: [latentId, 0], seed, steps: params.steps, cfg: params.cfgScale },
+ }
+ workflow[decodeId] = { class_type: 'CogVideoXVAEDecode', inputs: { samples: [samplerId, 0], vae: [modelId, 1] } }
+
+ addVideoOutput(workflow, n, decodeId, params.fps, nodes)
+ return workflow
+}
+
+function buildSVDWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+
+ const loaderId = String(n++)
+ const imageId = String(n++)
+ const condId = String(n++)
+ const guidanceId = String(n++)
+ const samplerId = String(n++)
+ const decodeId = String(n++)
+
+ workflow[loaderId] = { class_type: 'ImageOnlyCheckpointLoader', inputs: { ckpt_name: params.model } }
+ workflow[imageId] = { class_type: 'LoadImage', inputs: { image: params.inputImage || 'input_image.png' } }
+ workflow[condId] = {
+ class_type: 'SVD_img2vid_Conditioning',
+ inputs: {
+ clip_vision: [loaderId, 1], init_image: [imageId, 0], vae: [loaderId, 2],
+ augmentation_level: 0.0, width: params.width, height: params.height,
+ video_frames: params.frames, motion_bucket_id: 127, fps: params.fps,
+ },
+ }
+ workflow[guidanceId] = { class_type: 'VideoLinearCFGGuidance', inputs: { model: [loaderId, 0], min_cfg: 1.0 } }
+ workflow[samplerId] = {
+ class_type: 'KSampler',
+ inputs: { model: [guidanceId, 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 },
+ }
+ workflow[decodeId] = { class_type: 'VAEDecode', inputs: { samples: [samplerId, 0], vae: [loaderId, 2] } }
+
+ addVideoOutput(workflow, n, decodeId, params.fps, nodes)
+ return workflow
+}
+
+function buildFramePackWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+
+ const modelId = String(n++)
+ const clipId = String(n++)
+ const clipVisionId = String(n++)
+ const vaeId = String(n++)
+ const imageId = String(n++)
+ const encodeId = String(n++)
+ const posId = String(n++)
+ const samplerId = String(n++)
+ const decodeId = String(n++)
+
+ workflow[modelId] = { class_type: 'FramePackModelLoader', inputs: { model: params.model } }
+ workflow[clipId] = { class_type: 'CLIPLoader', inputs: { clip_name: 'llava_llama3_fp8_scaled.safetensors', type: 'wan', device: 'default' } }
+ workflow[clipVisionId] = { class_type: 'CLIPVisionLoader', inputs: { clip_name: 'sigclip_vision_384.safetensors' } }
+ workflow[vaeId] = { class_type: 'VAELoader', inputs: { vae_name: 'hunyuanvideo15_vae_fp16.safetensors' } }
+ workflow[imageId] = { class_type: 'LoadImage', inputs: { image: params.inputImage || 'input_image.png' } }
+ workflow[encodeId] = { class_type: 'FramePackEncode', inputs: { image: [imageId, 0], clip_vision: [clipVisionId, 0] } }
+ workflow[posId] = { class_type: 'CLIPTextEncode', inputs: { text: params.prompt, clip: [clipId, 0] } }
+ workflow[samplerId] = {
+ class_type: 'FramePackSampler',
+ inputs: { model: [modelId, 0], positive: [posId, 0], image_embeds: [encodeId, 0], latent: [encodeId, 1], seed, steps: params.steps, cfg: params.cfgScale },
+ }
+ workflow[decodeId] = { class_type: 'VAEDecode', inputs: { samples: [samplerId, 0], vae: [vaeId, 0] } }
+
+ addVideoOutput(workflow, n, decodeId, params.fps, nodes)
+ return workflow
+}
+
+function buildPyramidFlowWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+
+ const modelId = String(n++)
+ const vaeId = String(n++)
+ const posId = String(n++)
+ const samplerId = String(n++)
+ const decodeId = String(n++)
+
+ workflow[modelId] = { class_type: 'PyramidFlowModelLoader', inputs: { model: params.model } }
+ workflow[vaeId] = { class_type: 'PyramidFlowVAELoader', inputs: { vae: 'pyramid_flow_vae.safetensors' } }
+ workflow[posId] = { class_type: 'PyramidFlowTextEncode', inputs: { text: params.prompt } }
+ workflow[samplerId] = {
+ class_type: 'PyramidFlowSampler',
+ inputs: { model: [modelId, 0], vae: [vaeId, 0], text: [posId, 0], seed, steps: params.steps, cfg: params.cfgScale, width: params.width, height: params.height, frames: params.frames },
+ }
+ workflow[decodeId] = { class_type: 'PyramidFlowDecode', inputs: { samples: [samplerId, 0] } }
+
+ addVideoOutput(workflow, n, decodeId, params.fps, nodes)
+ return workflow
+}
+
+function buildAllegroWorkflow(params: VideoParams, seed: number, nodes: CategorizedNodes): Record<string, any> {
+ const workflow: Record<string, any> = {}
+ let n = 1
+
+ const modelId = String(n++)
+ const posId = String(n++)
+ const samplerId = String(n++)
+ const decodeId = String(n++)
+
+ workflow[modelId] = { class_type: 'AllegroModelLoader', inputs: { model: params.model } }
+ workflow[posId] = { class_type: 'AllegroTextEncode', inputs: { text: params.prompt } }
+ workflow[samplerId] = {
+ class_type: 'AllegroSampler',
+ inputs: { model: [modelId, 0], text: [posId, 0], seed, steps: params.steps, cfg: params.cfgScale, width: params.width, height: params.height, frames: params.frames },
+ }
+ workflow[decodeId] = { class_type: 'AllegroDecoder', inputs: { samples: [samplerId, 0] } }
+
+ addVideoOutput(workflow, n, decodeId, params.fps, nodes)
+ return workflow
+}
diff --git a/src/api/preflight.ts b/src/api/preflight.ts
index 828abcf7..90008a0f 100644
--- a/src/api/preflight.ts
+++ b/src/api/preflight.ts
@@ -63,6 +63,8 @@ export async function preflightCheck(
}
const needsUnet = modelType === 'flux' || modelType === 'flux2' || modelType === 'wan' || modelType === 'hunyuan'
+ || modelType === 'ltx' || modelType === 'mochi' || modelType === 'cosmos' || modelType === 'cogvideo'
+ || modelType === 'framepack' || modelType === 'pyramidflow' || modelType === 'allegro'
if (needsUnet) {
const hasUNET = nodes.loaders.includes('UNETLoader')
const hasCLIPLoader = nodes.loaders.includes('CLIPLoader')
diff --git a/src/components/create/CreateView.tsx b/src/components/create/CreateView.tsx
index 4d472614..32280380 100644
--- a/src/components/create/CreateView.tsx
+++ b/src/components/create/CreateView.tsx
@@ -1,7 +1,7 @@
import { useEffect, useState, useCallback, useRef } from 'react'
-import { Image, Video, WifiOff, Loader2, AlertTriangle, RefreshCw, Settings, FolderOpen, HardDriveDownload, CheckCircle2, XCircle, Download, Pause, Play, X as XIcon } from 'lucide-react'
+import { Image, Video, WifiOff, Loader2, AlertTriangle, RefreshCw, Settings, FolderOpen, HardDriveDownload, CheckCircle2, XCircle, Download, Pause, Play, X as XIcon, Upload, ImagePlus } from 'lucide-react'
import { backendCall } from '../../api/backend'
-import { freeMemory } from '../../api/comfyui'
+import { freeMemory, uploadImage, classifyModel } from '../../api/comfyui'
import { startModelDownload, getDownloadProgress, pauseDownload, cancelDownload, resumeDownload } from '../../api/discover'
import { useCreate } from '../../hooks/useCreate'
import { useCreateStore } from '../../stores/createStore'
@@ -113,7 +113,7 @@ export function CreateView() {
connected, imageModels, videoModels, samplerList, schedulerList,
videoBackend, modelsLoaded, checkConnection, fetchModels, runPreflight, generate, cancel,
} = useCreate()
- const { mode, setMode, error, preflightReady, preflightErrors, preflightWarnings } = useCreateStore()
+ const { mode, setMode, error, preflightReady, preflightErrors, preflightWarnings, videoModel, i2vImage, setI2vImage } = useCreateStore()
const [status, setStatus] = useState<ComfyStatus | null>(null)
const [startupLogs, setStartupLogs] = useState<string[]>([])
@@ -126,6 +126,8 @@ export function CreateView() {
const [installLogs, setInstallLogs] = useState<string[]>([])
const [installError, setInstallError] = useState('')
const [showConnected, setShowConnected] = useState(true)
+ const [i2vUploading, setI2vUploading] = useState(false)
+ const [i2vDragOver, setI2vDragOver] = useState(false)
const installPollRef = useRef<ReturnType<typeof setInterval> | null>(null)
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)
const pollIdRef = useRef(0)
@@ -194,6 +196,29 @@ export function CreateView() {
}, 3000)
}
+ // Detect I2V model (SVD, FramePack need an input image)
+ const videoModelType = videoModel ? classifyModel(videoModel) : null
+ const isI2V = mode === 'video' && (videoModelType === 'svd' || videoModelType === 'framepack')
+
+ const handleI2vUpload = async (file: File) => {
+ if (!file.type.startsWith('image/')) return
+ setI2vUploading(true)
+ try {
+ const filename = await uploadImage(file)
+ setI2vImage(filename)
+ } catch (err) {
+ console.error('[CreateView] I2V image upload failed:', err)
+ }
+ setI2vUploading(false)
+ }
+
+ const handleI2vDrop = (e: React.DragEvent) => {
+ e.preventDefault()
+ setI2vDragOver(false)
+ const file = e.dataTransfer.files[0]
+ if (file) handleI2vUpload(file)
+ }
+
const isStarting = status?.starting || status?.processAlive
const notFound = status && !status.found && !status.running
@@ -424,6 +449,59 @@ export function CreateView() {
</div>
)}
+ {/* I2V Image Upload — shown when SVD or FramePack model is selected */}
+ {isI2V && connected === true && (
+ <div
+ onDragOver={(e) => { e.preventDefault(); setI2vDragOver(true) }}
+ onDragLeave={() => setI2vDragOver(false)}
+ onDrop={handleI2vDrop}
+ className={`relative rounded-lg border-2 border-dashed transition-colors ${
+ i2vDragOver
+ ? 'border-blue-400 bg-blue-500/10'
+ : i2vImage
+ ? 'border-emerald-500/30 bg-emerald-500/5'
+ : 'border-white/10 bg-white/[0.02] hover:border-white/20'
+ }`}
+ >
+ {i2vImage ? (
+ <div className="flex items-center justify-between px-3 py-2">
+ <div className="flex items-center gap-2 text-emerald-400 text-[11px]">
+ <CheckCircle2 size={12} />
+ <span className="truncate max-w-[200px]">{i2vImage}</span>
+ </div>
+ <div className="flex items-center gap-1">
+ <label className="cursor-pointer px-2 py-0.5 rounded text-[10px] text-gray-400 hover:text-white hover:bg-white/10 transition-colors">
+ Replace
+ <input type="file" accept="image/*" className="hidden" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleI2vUpload(f) }} />
+ </label>
+ <button
+ onClick={() => setI2vImage(null)}
+ className="p-0.5 rounded text-gray-500 hover:text-red-400 hover:bg-white/10 transition-colors"
+ title="Remove image"
+ >
+ <XIcon size={10} />
+ </button>
+ </div>
+ </div>
+ ) : (
+ <label className="flex flex-col items-center gap-1 px-3 py-3 cursor-pointer">
+ {i2vUploading ? (
+ <Loader2 size={16} className="animate-spin text-gray-400" />
+ ) : (
+ <ImagePlus size={16} className="text-gray-500" />
+ )}
+ <span className="text-[11px] text-gray-400">
+ {i2vUploading ? 'Uploading...' : 'Drop or click to upload input image'}
+ </span>
+ <span className="text-[9px] text-gray-600">
+ {videoModelType === 'svd' ? 'SVD' : 'FramePack'} generates video from an image
+ </span>
+ <input type="file" accept="image/*" className="hidden" onChange={(e) => { const f = e.target.files?.[0]; if (f) handleI2vUpload(f) }} />
+ </label>
+ )}
+ </div>
+ )}
+
{/* Output area */}
<div className="flex-1 min-h-0 rounded-xl border border-gray-200 dark:border-white/5 bg-gray-100 dark:bg-white/[0.03] overflow-hidden flex flex-col">
<OutputDisplay />
diff --git a/src/components/layout/DownloadBadge.tsx b/src/components/layout/DownloadBadge.tsx
index 5678e593..30f122a4 100644
--- a/src/components/layout/DownloadBadge.tsx
+++ b/src/components/layout/DownloadBadge.tsx
@@ -2,6 +2,7 @@ import { useState, useRef, useEffect } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { ArrowDownToLine, Pause, Play, X, CheckCircle } from 'lucide-react'
import { useModels } from '../../hooks/useModels'
+import { useDownloadStore } from '../../stores/downloadStore'
import { formatBytes } from '../../lib/formatters'
function ProgressBar({ progress }: { progress: number }) {
@@ -14,12 +15,31 @@ function ProgressBar({ progress }: { progress: number }) {
export function DownloadBadge() {
const { activePulls, pullModel, pausePull, dismissPull } = useModels()
+ const comfyDownloads = useDownloadStore(s => s.downloads)
+ const bundleMap = useDownloadStore(s => s.bundleMap)
const [open, setOpen] = useState(false)
const ref = useRef<HTMLDivElement>(null)
- const entries = Object.entries(activePulls)
- const activeCount = entries.filter(([, s]) => !s.paused && !s.complete).length
- const hasAny = entries.length > 0
+ // Text model entries
+ const textEntries = Object.entries(activePulls)
+ const textActiveCount = textEntries.filter(([, s]) => !s.paused && !s.complete).length
+
+ // ComfyUI (image/video) entries — group by bundle
+ const comfyEntries = Object.entries(comfyDownloads).filter(([, d]) =>
+ d.status === 'downloading' || d.status === 'connecting' || d.status === 'pausing' || d.status === 'paused' || d.status === 'complete'
+ )
+ const comfyActiveCount = comfyEntries.filter(([, d]) => d.status === 'downloading' || d.status === 'connecting').length
+
+ // Group comfyUI downloads by bundle name
+ const comfyBundles = new Map<string, { id: string; d: typeof comfyDownloads[string] }[]>()
+ for (const [id, d] of comfyEntries) {
+ const bundleName = bundleMap[id] || id // Ungrouped files show as individual
+ if (!comfyBundles.has(bundleName)) comfyBundles.set(bundleName, [])
+ comfyBundles.get(bundleName)!.push({ id, d })
+ }
+
+ const totalActive = textActiveCount + comfyActiveCount
+ const hasAny = textEntries.length > 0 || comfyEntries.length > 0
// Click outside to close
useEffect(() => {
@@ -32,8 +52,8 @@ export function DownloadBadge() {
// Auto-open when a new download starts
useEffect(() => {
- if (activeCount > 0) setOpen(true)
- }, [activeCount])
+ if (totalActive > 0) setOpen(true)
+ }, [totalActive])
return (
<div ref={ref} className="relative">
@@ -49,14 +69,14 @@ export function DownloadBadge() {
>
<ArrowDownToLine size={14} />
{/* Badge */}
- {activeCount > 0 && (
+ {totalActive > 0 && (
<span className="absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] flex items-center justify-center rounded-full bg-blue-500 text-[0.5rem] font-bold text-white leading-none px-0.5">
- {activeCount}
+ {totalActive}
<span className="absolute inset-0 rounded-full bg-blue-500 animate-ping opacity-40" />
</span>
)}
- {/* Paused indicator (yellow dot, no ping) */}
- {activeCount === 0 && entries.some(([, s]) => s.paused) && (
+ {/* Paused indicator */}
+ {totalActive === 0 && (textEntries.some(([, s]) => s.paused) || comfyEntries.some(([, d]) => d.status === 'paused')) && (
<span className="absolute -top-0.5 -right-0.5 w-2.5 h-2.5 rounded-full bg-yellow-500" />
)}
</button>
@@ -74,11 +94,14 @@ export function DownloadBadge() {
{/* Header */}
<div className="flex items-center justify-between px-3 pt-2.5 pb-1">
<span className="text-[0.65rem] font-semibold uppercase tracking-widest text-gray-500">
- Downloads {hasAny && `(${entries.length})`}
+ Downloads {hasAny && `(${textEntries.length + comfyEntries.length})`}
</span>
- {entries.some(([, s]) => s.complete) && (
+ {(textEntries.some(([, s]) => s.complete) || comfyEntries.some(([, d]) => d.status === 'complete')) && (
<button
- onClick={() => entries.filter(([, s]) => s.complete).forEach(([n]) => dismissPull(n))}
+ onClick={() => {
+ textEntries.filter(([, s]) => s.complete).forEach(([n]) => dismissPull(n))
+ comfyEntries.filter(([, d]) => d.status === 'complete').forEach(([id]) => useDownloadStore.getState().dismiss(id))
+ }}
className="text-[0.6rem] text-gray-500 hover:text-gray-300 transition-colors"
>
Clear completed
@@ -88,59 +111,33 @@ export function DownloadBadge() {
{/* Download list */}
<div className="max-h-[300px] overflow-y-auto">
- {entries.length === 0 && (
+ {!hasAny && (
<p className="text-center text-[0.7rem] text-gray-500 py-6">No active downloads</p>
)}
- {entries.map(([name, state]) => {
+ {/* Text model downloads (Ollama) */}
+ {textEntries.map(([name, state]) => {
const prog = state.progress.total && state.progress.completed
? (state.progress.completed / state.progress.total) * 100 : 0
return (
<div key={name} className="px-3 py-2 border-t border-gray-100 dark:border-white/[0.04] first:border-t-0">
- {/* Top row: name + controls */}
<div className="flex items-center justify-between gap-2 mb-1">
<p className="text-[0.7rem] font-mono text-gray-700 dark:text-gray-300 truncate">{name}</p>
<div className="flex items-center gap-0.5 shrink-0">
- {/* Pause */}
{!state.complete && !state.paused && (
- <button
- onClick={() => pausePull(name)}
- className="p-0.5 rounded hover:bg-yellow-500/20 text-gray-400 hover:text-yellow-400 transition-colors"
- title="Pause"
- >
- <Pause size={11} />
- </button>
+ <button onClick={() => pausePull(name)} className="p-0.5 rounded hover:bg-yellow-500/20 text-gray-400 hover:text-yellow-400 transition-colors" title="Pause"><Pause size={11} /></button>
)}
- {/* Resume */}
{state.paused && (
- <button
- onClick={() => pullModel(name)}
- className="p-0.5 rounded hover:bg-green-500/20 text-gray-400 hover:text-green-400 transition-colors"
- title="Resume"
- >
- <Play size={11} />
- </button>
+ <button onClick={() => pullModel(name)} className="p-0.5 rounded hover:bg-green-500/20 text-gray-400 hover:text-green-400 transition-colors" title="Resume"><Play size={11} /></button>
)}
- {/* Dismiss */}
- <button
- onClick={() => dismissPull(name)}
- className="p-0.5 rounded hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors"
- title="Dismiss"
- >
- <X size={11} />
- </button>
+ <button onClick={() => dismissPull(name)} className="p-0.5 rounded hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors" title="Dismiss"><X size={11} /></button>
</div>
</div>
-
- {/* Status */}
{state.complete ? (
- <div className="flex items-center gap-1.5 text-green-400">
- <CheckCircle size={11} />
- <span className="text-[0.65rem]">Complete</span>
- </div>
+ <div className="flex items-center gap-1.5 text-green-400"><CheckCircle size={11} /><span className="text-[0.65rem]">Complete</span></div>
) : state.paused ? (
- <span className="text-[0.65rem] text-yellow-400">Paused — click ▶ to resume</span>
+ <span className="text-[0.65rem] text-yellow-400">Paused</span>
) : (
<>
<p className="text-[0.6rem] text-gray-500 mb-1 truncate">{state.progress.status}</p>
@@ -158,6 +155,59 @@ export function DownloadBadge() {
</div>
)
})}
+
+ {/* ComfyUI downloads (image/video models) — grouped by bundle */}
+ {Array.from(comfyBundles.entries()).map(([bundleName, files]) => {
+ const allComplete = files.every(f => f.d.status === 'complete')
+ const totalBytes = files.reduce((s, f) => s + f.d.total, 0)
+ const doneBytes = files.reduce((s, f) => s + f.d.progress, 0)
+ const bundleProg = totalBytes > 0 ? (doneBytes / totalBytes) * 100 : 0
+ const isBundle = files.length > 1
+
+ return (
+ <div key={bundleName} className="px-3 py-2 border-t border-gray-100 dark:border-white/[0.04] first:border-t-0">
+ {/* Bundle header */}
+ <div className="flex items-center justify-between gap-2 mb-1">
+ <p className={`${isBundle ? 'text-[0.7rem] font-medium' : 'text-[0.7rem] font-mono'} text-gray-700 dark:text-gray-300 truncate`}>{bundleName}</p>
+ <div className="flex items-center gap-0.5 shrink-0">
+ {allComplete ? (
+ <button onClick={() => files.forEach(f => useDownloadStore.getState().dismiss(f.id))} className="p-0.5 rounded hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors" title="Dismiss"><X size={11} /></button>
+ ) : (
+ <button onClick={() => files.forEach(f => useDownloadStore.getState().cancel(f.id))} className="p-0.5 rounded hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors" title="Cancel all"><X size={11} /></button>
+ )}
+ </div>
+ </div>
+
+ {allComplete ? (
+ <div className="flex items-center gap-1.5 text-green-400"><CheckCircle size={11} /><span className="text-[0.65rem]">Complete ({files.length} files)</span></div>
+ ) : (
+ <>
+ {totalBytes > 0 && <ProgressBar progress={bundleProg} />}
+ <p className="text-[0.55rem] text-gray-500 mt-0.5">
+ {totalBytes > 0 ? `${formatBytes(doneBytes)} / ${formatBytes(totalBytes)}` : 'Starting...'}
+ {bundleProg > 0 && <span className="ml-1.5 text-blue-400">{Math.round(bundleProg)}%</span>}
+ </p>
+ {/* Individual file rows */}
+ {isBundle && (
+ <div className="mt-1.5 space-y-0.5">
+ {files.map(({ id, d }) => (
+ <div key={id} className="flex items-center justify-between text-[0.55rem] text-gray-500">
+ <span className="truncate flex-1 font-mono">{d.filename || id}</span>
+ <span className="shrink-0 ml-2">
+ {d.status === 'complete' ? <span className="text-green-400">Done</span>
+ : d.status === 'paused' ? <span className="text-yellow-400">Paused</span>
+ : d.total > 0 ? `${Math.round((d.progress / d.total) * 100)}%`
+ : d.status === 'connecting' ? 'Connecting' : '...'}
+ </span>
+ </div>
+ ))}
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ )
+ })}
</div>
</motion.div>
)}
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index 60b9fa12..36067589 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -3,14 +3,19 @@ import { motion } from 'framer-motion'
import { Download, RefreshCw, ExternalLink, Search, Info, CheckCircle, XCircle, Loader2 } from 'lucide-react'
import { Pause, Play, X } from 'lucide-react'
import {
- fetchAbliteratedModels, searchOllamaModels, getImageBundles, getVideoBundles,
+ fetchAbliteratedModels, searchOllamaModels, searchHuggingFaceModels,
+ getImageBundles, getVideoBundles,
getUncensoredTextModels, getMainstreamTextModels,
+ getHuggingFaceUncensoredModels, getHuggingFaceMainstreamModels,
+ detectProviderModelPath, startModelDownloadToPath,
startModelDownload, getDownloadProgress, searchCivitaiModels,
- pauseDownload, cancelDownload, resumeDownload,
+ installBundleComplete,
type DiscoverModel, type DownloadProgress, type ModelBundle, type CivitAIModelResult,
} from '../../api/discover'
import { getSystemVRAM } from '../../api/comfyui'
+import { useDownloadStore } from '../../stores/downloadStore'
import { useModels } from '../../hooks/useModels'
+import { useProviderStore } from '../../stores/providerStore'
import { GlassCard } from '../ui/GlassCard'
import { GlowButton } from '../ui/GlowButton'
import { ProgressBar } from '../ui/ProgressBar'
@@ -44,7 +49,7 @@ function VariantPullButton({ model, pullModel, isPullingModel, isInstalled }: {
// If no size tags or only one, show simple button
if (tags.length <= 1) {
const fullName = tags.length === 1 ? `${model.name}:${tags[0].toLowerCase()}` : model.name
- if (isInstalled(model.name)) {
+ if (isInstalled(fullName)) {
return <span className="text-xs text-green-500 px-2 py-1">Installed</span>
}
return (
@@ -116,7 +121,7 @@ function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullMo
const isDownloading = dlState?.status === 'downloading' || dlState?.status === 'connecting'
const isComplete = dlState?.status === 'complete'
const isError = dlState?.status === 'error'
- const canDirectDownload = !!model.downloadUrl && !!model.filename && !!model.subfolder
+ const canDirectDownload = !!model.downloadUrl && !!model.filename
return (
<motion.div
@@ -127,15 +132,13 @@ function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullMo
<GlassCard className="p-3">
<div className="flex items-start justify-between gap-2">
<div className="flex-1 min-w-0">
- <h3 className="text-sm font-medium text-gray-900 dark:text-white truncate flex items-center gap-1.5">
+ <h3 className="text-sm font-medium text-gray-900 dark:text-white flex items-center gap-1.5 flex-wrap">
{isInstalled(model.name) && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-green-500/15 text-green-500 font-bold border border-green-500/30 shrink-0">INSTALLED</span>}
{model.hot && !isInstalled(model.name) && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-orange-500/15 text-orange-500 font-bold border border-orange-500/30 shrink-0">HOT</span>}
{model.agent && <span className="text-[0.55rem] px-1.5 py-0.5 rounded bg-green-500/15 text-green-500 font-bold border border-green-500/30 shrink-0">AGENT</span>}
- <span className="truncate">{model.name}</span>
+ <span>{model.description || model.name}</span>
</h3>
- {model.description && (
- <p className="text-xs text-gray-500 mt-0.5">{model.description}</p>
- )}
+ <p className="text-xs text-gray-400 dark:text-gray-500 mt-0.5 truncate">{model.name}</p>
<div className="flex items-center gap-2 mt-1.5 flex-wrap">
{model.tags.map((tag) => (
<span key={tag} className="text-[10px] px-1.5 py-0.5 rounded bg-gray-100 dark:bg-white/5 text-gray-600 dark:text-gray-400">
@@ -167,7 +170,28 @@ function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullMo
</div>
<div className="flex items-center gap-1 shrink-0">
- {isText ? (
+ {isText && model.canPull === false ? (
+ <span className="text-xs text-green-500 px-2 py-1 rounded bg-green-500/10">Available</span>
+ ) : isText && canDirectDownload ? (
+ /* HuggingFace GGUF: direct download button */
+ isComplete ? (
+ <span className="flex items-center gap-1 text-xs text-green-500 px-2 py-1">
+ <CheckCircle size={12} /> Downloaded
+ </span>
+ ) : isDownloading ? (
+ <span className="p-2 text-gray-400">
+ <Loader2 size={14} className="animate-spin" />
+ </span>
+ ) : (
+ <button
+ onClick={() => handleDownload(model)}
+ className="p-2 rounded-lg bg-green-100 dark:bg-green-500/15 hover:bg-green-200 dark:hover:bg-green-500/25 text-green-700 dark:text-green-400 transition-all"
+ title={`Download ${model.sizeGB ? model.sizeGB + ' GB' : ''}`}
+ >
+ <Download size={14} />
+ </button>
+ )
+ ) : isText ? (
<VariantPullButton model={model} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} />
) : (
<>
@@ -209,49 +233,46 @@ export function DiscoverModels({ category }: Props) {
const [civitaiQuery, setCivitaiQuery] = useState('')
const [loading, setLoading] = useState(false)
const [search, setSearch] = useState('')
- const [downloads, setDownloads] = useState<Record<string, DownloadProgress>>({})
- const [downloadMeta, setDownloadMeta] = useState<Record<string, { url: string; subfolder: string }>>({})
const [systemVRAM, setSystemVRAM] = useState<number | null>(null)
const [subTab, setSubTab] = useState<'uncensored' | 'mainstream'>('uncensored')
+ const [vramTier, setVramTier] = useState<'all' | 'lightweight' | 'mid' | 'highend'>('all')
const { pullModel, isPullingModel, models: installedModels } = useModels()
- const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)
+ const downloads = useDownloadStore(s => s.downloads)
+ const dlStore = useDownloadStore
- // Load text models from Ollama search
+ // Multi-provider state
+ const providers = useProviderStore(s => s.providers)
+ const [discoverSource, setDiscoverSource] = useState<'ollama' | 'huggingface'>('ollama')
+ const [hfModelPath, setHfModelPath] = useState<string | null>(null)
+ const isOllama = discoverSource === 'ollama'
+
+ // Load text models based on selected source
useEffect(() => {
- if (category === 'text') {
- setLoading(true)
+ if (category !== 'text') return
+ setLoading(true)
+
+ setSearch('')
+ setHfSearchResults([])
+
+ if (discoverSource === 'ollama') {
fetchAbliteratedModels().then(m => { setTextModels(m); setLoading(false) })
+ } else {
+ // Auto-detect provider model path for downloads
+ const providerName = providers.openai?.name || 'LM Studio'
+ detectProviderModelPath(providerName).then(path => setHfModelPath(path))
+ setLoading(false)
}
- }, [category])
+ }, [category, discoverSource])
// Detect system VRAM
useEffect(() => {
getSystemVRAM().then(v => setSystemVRAM(v))
}, [])
- // Poll download progress
+ // Start polling on mount if there are active downloads
useEffect(() => {
- const hasActive = Object.values(downloads).some(d => d.status === 'downloading' || d.status === 'connecting' || d.status === 'pausing')
- if (hasActive && !pollRef.current) {
- pollRef.current = setInterval(async () => {
- const prog = await getDownloadProgress()
- setDownloads(prev => {
- for (const [id, d] of Object.entries(prog)) {
- if (d.status === 'complete' && prev[id]?.status !== 'complete') {
- window.dispatchEvent(new CustomEvent('comfyui-model-downloaded'))
- }
- }
- return prog
- })
- const stillActive = Object.values(prog).some(d => d.status === 'downloading' || d.status === 'connecting' || d.status === 'pausing')
- if (!stillActive && pollRef.current) {
- clearInterval(pollRef.current)
- pollRef.current = null
- }
- }, 1000)
- }
- return () => { if (pollRef.current) { clearInterval(pollRef.current); pollRef.current = null } }
- }, [downloads])
+ dlStore.getState().refresh()
+ }, [])
const isText = category === 'text'
const isImage = category === 'image'
@@ -294,56 +315,55 @@ export function DiscoverModels({ category }: Props) {
})
const tabFilteredBundles = sortedBundles.filter(b => subTab === 'uncensored' ? b.uncensored : !b.uncensored)
+
+ // VRAM tier filtering for bundles
+ const vramFilteredBundles = tabFilteredBundles.filter(b => {
+ if (vramTier === 'all') return true
+ const vram = parseVRAM(b.vramRequired)
+ if (vramTier === 'lightweight') return vram <= 10
+ if (vramTier === 'mid') return vram > 10 && vram <= 16
+ return vram > 16 // highend
+ })
+
const filteredBundles = search
- ? tabFilteredBundles.filter((b) => b.name.toLowerCase().includes(search.toLowerCase()) || b.description.toLowerCase().includes(search.toLowerCase()))
- : tabFilteredBundles
+ ? vramFilteredBundles.filter((b) => b.name.toLowerCase().includes(search.toLowerCase()) || b.description.toLowerCase().includes(search.toLowerCase()))
+ : vramFilteredBundles
- const isInstalled = (name: string) => installedModels.some((m) => m.name.startsWith(name.split(':')[0]))
+ const isInstalled = (name: string) => {
+ return installedModels.some((m) => m.name === name)
+ }
const handleDownload = async (model: DiscoverModel) => {
if (!model.downloadUrl || !model.filename || !model.subfolder) return
- // Store meta for resume
- setDownloadMeta(prev => ({ ...prev, [model.filename!]: { url: model.downloadUrl!, subfolder: model.subfolder! } }))
- const result = await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
- if (result.status === 'started' || result.status === 'already_exists') {
- const prog = await getDownloadProgress()
- setDownloads(prog)
- }
+ dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder)
+ await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
+ dlStore.getState().startPolling()
}
+ const [installingBundle, setInstallingBundle] = useState<string | null>(null)
+
const handleBundleInstall = async (bundle: ModelBundle) => {
+ setInstallingBundle(bundle.name)
+ const filenames: string[] = []
for (const file of bundle.files) {
if (file.downloadUrl && file.filename && file.subfolder) {
- setDownloadMeta(prev => ({ ...prev, [file.filename!]: { url: file.downloadUrl!, subfolder: file.subfolder! } }))
- await startModelDownload(file.downloadUrl, file.subfolder, file.filename)
+ dlStore.getState().setMeta(file.filename, file.downloadUrl, file.subfolder)
+ filenames.push(file.filename)
}
}
- const prog = await getDownloadProgress()
- setDownloads(prog)
- }
-
- const handlePause = async (id: string) => {
- await pauseDownload(id)
- const prog = await getDownloadProgress()
- setDownloads(prog)
- }
-
- const handleCancel = async (id: string) => {
- await cancelDownload(id)
- setDownloads(prev => {
- const updated = { ...prev }
- delete updated[id]
- return updated
- })
+ dlStore.getState().setBundleGroup(bundle.name, filenames)
+ try {
+ await installBundleComplete(bundle)
+ } catch (err) {
+ console.error('[DiscoverModels] Bundle install failed:', err)
+ }
+ dlStore.getState().startPolling()
+ setInstallingBundle(null)
}
- const handleResume = async (id: string) => {
- const meta = downloadMeta[id]
- if (!meta) return
- await resumeDownload(id, meta.url, meta.subfolder)
- const prog = await getDownloadProgress()
- setDownloads(prog)
- }
+ const handlePause = async (id: string) => { await dlStore.getState().pause(id) }
+ const handleCancel = async (id: string) => { await dlStore.getState().cancel(id) }
+ const handleResume = async (id: string) => { await dlStore.getState().resume(id) }
const handleCivitaiSearch = async () => {
if (!civitaiQuery.trim()) return
@@ -355,15 +375,9 @@ export function DiscoverModels({ category }: Props) {
const handleCivitaiDownload = async (model: CivitAIModelResult) => {
if (!model.downloadUrl || !model.filename || !model.subfolder) return
- // CivitAI downloads need the proxy
- const url = model.downloadUrl.startsWith('http')
- ? `/local-api/proxy-download?url=${encodeURIComponent(model.downloadUrl)}`
- : model.downloadUrl
- const result = await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
- if (result.status === 'started' || result.status === 'already_exists') {
- const prog = await getDownloadProgress()
- setDownloads(prog)
- }
+ dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder)
+ await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
+ dlStore.getState().startPolling()
}
const isBundleComplete = (bundle: ModelBundle): boolean => {
@@ -392,6 +406,8 @@ export function DiscoverModels({ category }: Props) {
// Progress calculation moved to DownloadBadge in Header
+ const [hfSearchResults, setHfSearchResults] = useState<DiscoverModel[]>([])
+
const handleOllamaSearch = async () => {
if (!search.trim() || !isText) return
setLoading(true)
@@ -402,8 +418,22 @@ export function DiscoverModels({ category }: Props) {
setLoading(false)
}
- const uncensoredModels = isText ? getUncensoredTextModels() : []
- const mainstreamModels = isText ? getMainstreamTextModels() : []
+ const handleHfSearch = async () => {
+ if (!search.trim() || !isText) return
+ setLoading(true)
+ try {
+ const results = await searchHuggingFaceModels(search.trim())
+ setHfSearchResults(results)
+ } catch { /* keep existing */ }
+ setLoading(false)
+ }
+
+ const uncensoredModels = isText
+ ? (isOllama ? getUncensoredTextModels() : getHuggingFaceUncensoredModels())
+ : []
+ const mainstreamModels = isText
+ ? (isOllama ? getMainstreamTextModels() : getHuggingFaceMainstreamModels())
+ : []
const filteredUncensored = search
? uncensoredModels.filter((m) => m.name.toLowerCase().includes(search.toLowerCase()) || m.description.toLowerCase().includes(search.toLowerCase()))
@@ -414,17 +444,46 @@ export function DiscoverModels({ category }: Props) {
const title = isText ? 'Discover LUncensored' : isImage ? 'Discover LUncensored' : 'Discover LUncensored'
const subtitle = isText
- ? 'Search the Ollama registry or browse curated models.'
+ ? (isOllama ? 'Search the Ollama registry or browse curated models.'
+ : `Download GGUF models from HuggingFace.${hfModelPath ? ` Saves to: ${hfModelPath}` : ''}`)
: isImage
? 'Browse image generation models for ComfyUI.'
: 'Browse video generation models for ComfyUI.'
+ const handleRefresh = () => {
+ setLoading(true)
+ if (isOllama) fetchAbliteratedModels().then(m => { setTextModels(m); setLoading(false) })
+ else { setHfModels(getHuggingFaceModels()); setLoading(false) }
+ }
+
+ const handleHfDownload = async (model: DiscoverModel) => {
+ if (!model.downloadUrl || !model.filename) return
+ const destDir = hfModelPath || (await detectProviderModelPath(providers.openai?.name || 'fallback'))
+ if (!destDir) return
+ setHfModelPath(destDir)
+ try {
+ await startModelDownloadToPath(model.downloadUrl, destDir, model.filename)
+ dlStore.getState().startPolling()
+ } catch (e) {
+ console.error('HF download failed:', e)
+ }
+ }
+
+ // Unified download handler — routes to HF or ComfyUI based on source
+ const handleModelDownload = (model: DiscoverModel) => {
+ if (!isOllama && isText) {
+ handleHfDownload(model)
+ } else {
+ handleDownload(model)
+ }
+ }
+
return (
- <div className="space-y-4">
+ <div className="space-y-4 scale-[0.87] origin-top-left w-[115%]">
<div className="flex items-center justify-between">
<h2 className="text-lg font-semibold text-gray-900 dark:text-white">{title}</h2>
{isText && (
- <GlowButton variant="secondary" onClick={() => { setLoading(true); fetchAbliteratedModels().then(m => { setTextModels(m); setLoading(false) }) }} disabled={loading} aria-label="Refresh">
+ <GlowButton variant="secondary" onClick={handleRefresh} disabled={loading} aria-label="Refresh">
<RefreshCw size={16} className={loading ? 'animate-spin' : ''} />
</GlowButton>
)}
@@ -432,13 +491,32 @@ export function DiscoverModels({ category }: Props) {
<p className="text-sm text-gray-500">{subtitle}</p>
+ {/* Source Selector — Ollama (pull) or HuggingFace (GGUF download) */}
+ {isText && (
+ <div className="flex gap-2">
+ {(['ollama', 'huggingface'] as const).map(src => (
+ <button
+ key={src}
+ onClick={() => setDiscoverSource(src)}
+ className={`px-3 py-1 rounded-full text-xs font-medium transition-all ${
+ discoverSource === src
+ ? 'bg-white/15 text-white border border-white/20'
+ : 'text-gray-500 hover:text-gray-300 hover:bg-white/5'
+ }`}
+ >
+ {src === 'ollama' ? 'Ollama' : 'HuggingFace'}
+ </button>
+ ))}
+ </div>
+ )}
+
<div className="relative">
<Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-500" />
<input
value={search}
onChange={(e) => setSearch(e.target.value)}
- onKeyDown={(e) => { if (e.key === 'Enter' && isText) handleOllamaSearch() }}
- placeholder={isText ? 'Search Ollama registry... (Enter to search)' : 'Filter models...'}
+ onKeyDown={(e) => { if (e.key === 'Enter' && isText) { isOllama ? handleOllamaSearch() : handleHfSearch() } }}
+ placeholder={isText ? (isOllama ? 'Search Ollama registry... (Enter to search)' : 'Search HuggingFace GGUF models... (Enter to search)') : 'Filter models...'}
className="w-full pl-9 pr-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-900 dark:text-white placeholder-gray-500 focus:outline-none focus:border-gray-400 dark:focus:border-white/30"
/>
</div>
@@ -489,36 +567,63 @@ export function DiscoverModels({ category }: Props) {
</p>
)}
- {/* Sub-tabs: Uncensored / Mainstream — all categories */}
- <div className="flex gap-4 mb-4">
- <button
- onClick={() => setSubTab('uncensored')}
- className={`flex items-center gap-2 transition-all ${
- subTab === 'uncensored' ? 'opacity-100' : 'opacity-40 hover:opacity-70'
- }`}
- >
- <div className={`w-1 h-5 rounded-full ${subTab === 'uncensored' ? 'bg-red-500' : 'bg-red-500/50'}`} />
- <span className="text-[0.75rem] font-semibold text-gray-900 dark:text-white uppercase tracking-wider">Uncensored</span>
- <span className="text-[0.55rem] text-gray-500">{isText ? 'No filters, no limits' : 'No content filter'}</span>
- </button>
- <button
- onClick={() => setSubTab('mainstream')}
- className={`flex items-center gap-2 transition-all ${
- subTab === 'mainstream' ? 'opacity-100' : 'opacity-40 hover:opacity-70'
- }`}
- >
- <div className={`w-1 h-5 rounded-full ${subTab === 'mainstream' ? 'bg-blue-500' : 'bg-blue-500/50'}`} />
- <span className="text-[0.75rem] font-semibold text-gray-900 dark:text-white uppercase tracking-wider">Mainstream</span>
- <span className="text-[0.55rem] text-gray-500">{isText ? 'Tool calling + vision' : 'Popular + high quality'}</span>
- </button>
- </div>
+ {/* Sub-tabs: Uncensored / Mainstream — for all text sources and image/video */}
+ {(isText || isImage || isVideo) && (
+ <div className="flex gap-4 mb-4">
+ <button
+ onClick={() => setSubTab('uncensored')}
+ className={`flex items-center gap-2 transition-all ${
+ subTab === 'uncensored' ? 'opacity-100' : 'opacity-40 hover:opacity-70'
+ }`}
+ >
+ <div className={`w-1 h-5 rounded-full ${subTab === 'uncensored' ? 'bg-red-500' : 'bg-red-500/50'}`} />
+ <span className="text-[0.75rem] font-semibold text-gray-900 dark:text-white uppercase tracking-wider">Uncensored</span>
+ <span className="text-[0.55rem] text-gray-500">{isText ? 'No filters, no limits' : 'No content filter'}</span>
+ </button>
+ <button
+ onClick={() => setSubTab('mainstream')}
+ className={`flex items-center gap-2 transition-all ${
+ subTab === 'mainstream' ? 'opacity-100' : 'opacity-40 hover:opacity-70'
+ }`}
+ >
+ <div className={`w-1 h-5 rounded-full ${subTab === 'mainstream' ? 'bg-blue-500' : 'bg-blue-500/50'}`} />
+ <span className="text-[0.75rem] font-semibold text-gray-900 dark:text-white uppercase tracking-wider">Mainstream</span>
+ <span className="text-[0.55rem] text-gray-500">{isText ? 'Tool calling + vision' : 'Popular + high quality'}</span>
+ </button>
+ </div>
+ )}
+
+ {/* VRAM Tier Filter — for image/video bundles */}
+ {(isImage || isVideo) && sortedBundles.length > 0 && (
+ <div className="flex gap-1.5">
+ {([
+ { key: 'all', label: 'All', desc: '' },
+ { key: 'lightweight', label: 'Lightweight', desc: '6-10 GB' },
+ { key: 'mid', label: 'Mid-Range', desc: '12-16 GB' },
+ { key: 'highend', label: 'High-End', desc: '20+ GB' },
+ ] as const).map(tier => (
+ <button
+ key={tier.key}
+ onClick={() => setVramTier(tier.key)}
+ className={`px-2.5 py-1 rounded-full text-[11px] font-medium transition-all ${
+ vramTier === tier.key
+ ? 'bg-white/15 text-white border border-white/20'
+ : 'text-gray-500 hover:text-gray-300 hover:bg-white/5'
+ }`}
+ >
+ {tier.label}
+ {tier.desc && <span className="text-[9px] text-gray-500 ml-1">{tier.desc}</span>}
+ </button>
+ ))}
+ </div>
+ )}
{/* Model Bundles (Image + Video) — same grid style as text models */}
{(isImage || isVideo) && filteredBundles.length > 0 && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{filteredBundles.map((bundle, bi) => {
const complete = isBundleComplete(bundle)
- const downloading = isBundleDownloading(bundle)
+ const downloading = isBundleDownloading(bundle) || installingBundle === bundle.name
const bundleProgress = getBundleProgress(bundle)
return (
@@ -585,6 +690,10 @@ export function DiscoverModels({ category }: Props) {
</div>
)}
+ {(isImage || isVideo) && sortedBundles.length > 0 && filteredBundles.length === 0 && (
+ <p className="text-center text-gray-500 py-4 text-sm">No models match this VRAM tier. Try a different filter.</p>
+ )}
+
{/* CivitAI Search (Image & Video) */}
{(isImage || isVideo) && (
<GlassCard className="p-4 space-y-3">
@@ -655,15 +764,21 @@ export function DiscoverModels({ category }: Props) {
</GlassCard>
)}
+ {/* HuggingFace model path info */}
+ {!isOllama && isText && hfModelPath && (
+ <p className="text-[0.65rem] text-gray-500 truncate">
+ Downloads save to: {hfModelPath}
+ </p>
+ )}
+
{loading ? (
<div className="text-center py-8 text-gray-500">Loading models...</div>
) : isText ? (
<>
- {/* Active sub-tab content */}
{subTab === 'uncensored' && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{filteredUncensored.map((model, i) => (
- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleModelDownload} />
))}
{filteredUncensored.length === 0 && (
<p className="text-center text-gray-500 py-4 col-span-2">No uncensored models match your search</p>
@@ -673,7 +788,7 @@ export function DiscoverModels({ category }: Props) {
{subTab === 'mainstream' && (
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{filteredMainstream.map((model, i) => (
- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleModelDownload} />
))}
{filteredMainstream.length === 0 && (
<p className="text-center text-gray-500 py-4 col-span-2">No mainstream models match your search</p>
@@ -681,27 +796,39 @@ export function DiscoverModels({ category }: Props) {
</div>
)}
- {/* Search Results (only when searching, show extra results not in curated lists) */}
- {search && filtered.filter(m => !uncensoredModels.some(u => u.name === m.name) && !mainstreamModels.some(u => u.name === m.name)).length > 0 && (
+ {/* Ollama Search Results */}
+ {isOllama && search && filtered.filter(m => !uncensoredModels.some(u => u.name === m.name) && !mainstreamModels.some(u => u.name === m.name)).length > 0 && (
<div className="space-y-3 mt-6">
<h3 className="text-[0.7rem] font-semibold text-gray-500 uppercase tracking-wider">Search Results</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{filtered.filter(m => !uncensoredModels.some(u => u.name === m.name) && !mainstreamModels.some(u => u.name === m.name)).map((model, i) => (
- <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleModelDownload} />
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* HuggingFace Search Results */}
+ {!isOllama && hfSearchResults.length > 0 && (
+ <div className="space-y-3 mt-6">
+ <h3 className="text-[0.7rem] font-semibold text-gray-500 uppercase tracking-wider">HuggingFace Search Results</h3>
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+ {hfSearchResults.map((model, i) => (
+ <ModelDiscoverCard key={model.name + i} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleModelDownload} />
))}
</div>
</div>
)}
</>
- ) : !isVideo && (
+ ) : !isVideo ? (
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{filtered.map((model, i) => (
<ModelDiscoverCard key={model.name} model={model} index={i} isText={false} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} handleDownload={handleDownload} />
))}
</div>
- )}
+ ) : null}
- {!loading && filtered.length === 0 && filteredBundles.length === 0 && filteredUncensored.length === 0 && filteredMainstream.length === 0 && (
+ {!loading && isOllama && filtered.length === 0 && filteredBundles.length === 0 && filteredUncensored.length === 0 && filteredMainstream.length === 0 && (
<p className="text-center text-gray-500 py-4">No models found</p>
)}
</div>
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index 00ba8663..e3432f81 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
-import { Sun, Moon, ArrowRight, Download, Check, ChevronRight, Loader2, Pause, RefreshCw, ExternalLink } from 'lucide-react'
+import { Minus, Square, Copy, X as XIcon, ArrowRight, Download, Check, ChevronRight, Loader2, Pause, RefreshCw, ExternalLink, FolderOpen } from 'lucide-react'
import { useSettingsStore } from '../../stores/settingsStore'
import { useProviderStore } from '../../stores/providerStore'
import { useModels } from '../../hooks/useModels'
@@ -9,8 +9,12 @@ import { PROVIDER_PRESETS } from '../../api/providers/types'
import { detectLocalBackends, type DetectedBackend } from '../../lib/backend-detector'
import { ProgressBar } from '../ui/ProgressBar'
import { formatBytes } from '../../lib/formatters'
+import { backendCall } from '../../api/backend'
+import { getSystemVRAM } from '../../api/comfyui'
-type Step = 'welcome' | 'theme' | 'backends' | 'models' | 'done'
+type Step = 'welcome' | 'theme' | 'backends' | 'comfyui' | 'models' | 'done'
+const STEP_ORDER: Step[] = ['welcome', 'theme', 'backends', 'comfyui', 'models', 'done']
+const isTauri = typeof window !== 'undefined' && !!(window as any).__TAURI_INTERNALS__
/* ── Local backend info for the "nothing found" state ──────── */
interface LocalBackendInfo {
@@ -48,6 +52,17 @@ export function Onboarding() {
const [selectedBackend, setSelectedBackend] = useState<string>('')
const { setProviderConfig } = useProviderStore()
+ // ComfyUI step state
+ const [comfyDetecting, setComfyDetecting] = useState(false)
+ const [comfyFound, setComfyFound] = useState<{ found: boolean; path?: string } | null>(null)
+ const [comfyInstalling, setComfyInstalling] = useState(false)
+ const [comfyInstallLogs, setComfyInstallLogs] = useState<string[]>([])
+ const [comfyInstallError, setComfyInstallError] = useState('')
+ const [comfyPathInput, setComfyPathInput] = useState('')
+ const [comfyReady, setComfyReady] = useState(false)
+ const [systemVRAM, setSystemVRAM] = useState<number | null>(null)
+ const [modelSubTab, setModelSubTab] = useState<'uncensored' | 'mainstream'>('uncensored')
+
const isDark = settings.theme === 'dark'
const bgClass = isDark ? 'bg-[#0a0a0a] text-white' : 'bg-white text-gray-900'
const cardClass = isDark ? 'bg-[#141414] border-white/[0.08]' : 'bg-gray-50 border-gray-200'
@@ -85,6 +100,23 @@ export function Onboarding() {
})
}
+ // Detect system VRAM for model filtering
+ useEffect(() => { getSystemVRAM().then(v => setSystemVRAM(v)).catch(() => {}) }, [])
+
+ // Auto-detect ComfyUI when entering the comfyui step
+ useEffect(() => {
+ if (step === 'comfyui' && !comfyFound && !comfyDetecting) {
+ setComfyDetecting(true)
+ backendCall<{ found: boolean; path?: string }>('find_comfyui')
+ .then(result => {
+ setComfyFound(result)
+ if (result.found) setComfyReady(true)
+ })
+ .catch(() => setComfyFound({ found: false }))
+ .finally(() => setComfyDetecting(false))
+ }
+ }, [step])
+
const currentPull = pullingModel ? activePulls[pullingModel] : null
const pullProgress = currentPull?.progress ?? null
const progress =
@@ -102,8 +134,31 @@ export function Onboarding() {
isDark ? 'bg-white/10 text-white hover:bg-white/15' : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
}`
+ const handleMinimize = async () => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); getCurrentWindow().minimize() }
+ const handleMaximize = async () => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); getCurrentWindow().toggleMaximize() }
+ const handleClose = async () => { const { getCurrentWindow } = await import('@tauri-apps/api/window'); getCurrentWindow().close() }
+ const winBtn = 'inline-flex items-center justify-center w-[46px] h-8 transition-colors text-gray-400 hover:text-gray-200'
+
+ const stepIndex = STEP_ORDER.indexOf(step)
+
return (
<div className={`h-screen w-screen flex items-center justify-center p-4 ${bgClass}`}>
+ {/* Drag region + window controls */}
+ {isTauri && (
+ <div data-tauri-drag-region className="fixed top-0 left-0 right-0 h-8 z-50 flex items-center justify-end select-none">
+ <button onClick={handleMinimize} className={winBtn} aria-label="Minimize"><Minus size={14} strokeWidth={1.5} /></button>
+ <button onClick={handleMaximize} className={winBtn} aria-label="Maximize"><Square size={11} strokeWidth={1.5} /></button>
+ <button onClick={handleClose} className={`${winBtn} hover:bg-red-500 hover:text-white`} aria-label="Close"><XIcon size={14} strokeWidth={1.5} /></button>
+ </div>
+ )}
+
+ {/* Step indicator dots */}
+ <div className="fixed top-10 left-1/2 -translate-x-1/2 z-40 flex gap-1.5">
+ {STEP_ORDER.map((s, i) => (
+ <div key={s} className={`w-1.5 h-1.5 rounded-full transition-colors ${i <= stepIndex ? (isDark ? 'bg-white' : 'bg-gray-900') : (isDark ? 'bg-white/15' : 'bg-gray-300')}`} />
+ ))}
+ </div>
+
<AnimatePresence mode="wait">
{/* Step 1: Welcome */}
{step === 'welcome' && (
@@ -142,7 +197,7 @@ export function Onboarding() {
!isDark ? 'border-gray-900 bg-gray-50' : 'border-white/10 hover:border-white/20'
}`}
>
- <Sun size={18} className={isDark ? 'text-gray-400' : 'text-yellow-500'} />
+ <div className="w-4 h-4 rounded-full bg-white border border-gray-300" />
<span className="text-[0.7rem] font-medium">Light</span>
</button>
<button
@@ -151,7 +206,7 @@ export function Onboarding() {
isDark ? 'border-white bg-white/10' : 'border-gray-200 hover:border-gray-400'
}`}
>
- <Moon size={18} className={isDark ? 'text-white' : 'text-gray-600'} />
+ <div className="w-4 h-4 rounded-full bg-[#050505]" />
<span className="text-[0.7rem] font-medium">Dark</span>
</button>
</div>
@@ -236,12 +291,8 @@ export function Onboarding() {
})
}
}
- // Go to models if Ollama detected (can pull models), otherwise done
- if (hasOllama) {
- setStep('models')
- } else {
- setStep('done')
- }
+ // Go to ComfyUI step next
+ setStep('comfyui')
}}
className={primaryBtn}
>
@@ -287,7 +338,7 @@ export function Onboarding() {
<button onClick={runDetection} className={secondaryBtn}>
<RefreshCw size={12} /> Re-Scan
</button>
- <button onClick={() => setStep('done')} className={`${secondaryBtn} opacity-60`}>
+ <button onClick={() => setStep('comfyui')} className={`${secondaryBtn} opacity-60`}>
Skip for now <ChevronRight size={12} />
</button>
</div>
@@ -296,7 +347,192 @@ export function Onboarding() {
</motion.div>
)}
- {/* Step 4: Models (Ollama only — pull models) */}
+ {/* Step 4: ComfyUI Setup */}
+ {step === 'comfyui' && (
+ <motion.div
+ key="comfyui"
+ className="max-w-md w-full text-center space-y-4"
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: -20 }}
+ >
+ <div className="w-3 h-3 rounded-full bg-purple-400 mx-auto" />
+ <h2 className="text-base font-semibold">Image & Video Generation</h2>
+ <p className={`text-[0.7rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
+ Generate images and videos right from the app. We'll set everything up for you.
+ </p>
+
+ {/* Auto-detecting */}
+ {comfyDetecting && (
+ <div className="flex items-center justify-center gap-2">
+ <Loader2 size={14} className="animate-spin text-gray-400" />
+ <span className={`text-[0.7rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>Looking for ComfyUI...</span>
+ </div>
+ )}
+
+ {/* Found */}
+ {comfyFound?.found && !comfyInstalling && (
+ <div className={`p-3 rounded-lg border ${isDark ? 'bg-green-500/10 border-green-500/20' : 'bg-green-50 border-green-200'}`}>
+ <div className="flex items-center gap-2 justify-center">
+ <Check size={14} className="text-green-400" />
+ <span className="text-[0.7rem] font-medium">ComfyUI detected</span>
+ </div>
+ <p className={`text-[0.55rem] font-mono mt-1 ${isDark ? 'text-gray-500' : 'text-gray-400'}`}>{comfyFound.path}</p>
+ </div>
+ )}
+
+ {/* Not found — install options */}
+ {comfyFound && !comfyFound.found && !comfyInstalling && !comfyReady && (
+ <div className="space-y-2">
+ <button
+ onClick={async () => {
+ setComfyInstalling(true)
+ setComfyInstallError('')
+ setComfyInstallLogs(['Starting ComfyUI installation...'])
+ try {
+ await backendCall('install_comfyui')
+ // Poll installation status
+ const poll = setInterval(async () => {
+ try {
+ const status: any = await backendCall('install_comfyui_status')
+ setComfyInstallLogs(status.logs || [])
+ if (status.status === 'complete' || status.status === 'done') {
+ clearInterval(poll)
+ setComfyInstalling(false)
+ setComfyReady(true)
+ // Auto-start ComfyUI
+ try { await backendCall('start_comfyui') } catch {}
+ } else if (status.status === 'error') {
+ clearInterval(poll)
+ setComfyInstalling(false)
+ setComfyInstallError('Installation failed. Check logs below.')
+ }
+ } catch { /* keep polling */ }
+ }, 2000)
+ } catch (err) {
+ setComfyInstalling(false)
+ setComfyInstallError(err instanceof Error ? err.message : 'Installation failed')
+ }
+ }}
+ className={`w-full flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg text-[0.7rem] font-medium transition-all ${
+ isDark ? 'bg-white text-black hover:bg-gray-200' : 'bg-gray-900 text-white hover:bg-gray-800'
+ }`}
+ >
+ <Download size={14} /> Install ComfyUI (Recommended)
+ </button>
+ <button
+ onClick={() => {
+ const input = document.createElement('input')
+ input.type = 'text'
+ // Show path input inline
+ setComfyPathInput('')
+ setComfyFound({ found: false })
+ }}
+ className={secondaryBtn}
+ style={{ width: '100%', justifyContent: 'center' }}
+ >
+ <FolderOpen size={14} /> I already have ComfyUI
+ </button>
+
+ {/* Manual path input */}
+ {comfyPathInput !== undefined && (
+ <div className="flex gap-1.5">
+ <input
+ type="text"
+ value={comfyPathInput}
+ onChange={e => setComfyPathInput(e.target.value)}
+ placeholder="C:\ComfyUI"
+ className={`flex-1 px-2 py-1.5 rounded-lg border text-[0.65rem] font-mono ${
+ isDark ? 'bg-black border-white/10 text-white' : 'bg-white border-gray-300 text-gray-900'
+ }`}
+ />
+ <button
+ onClick={async () => {
+ if (!comfyPathInput.trim()) return
+ try {
+ await backendCall('set_comfyui_path', { path: comfyPathInput.trim() })
+ setComfyReady(true)
+ try { await backendCall('start_comfyui') } catch {}
+ } catch (err) {
+ setComfyInstallError(err instanceof Error ? err.message : 'Invalid path')
+ }
+ }}
+ className={primaryBtn}
+ >
+ Connect
+ </button>
+ </div>
+ )}
+ </div>
+ )}
+
+ {/* Installing progress */}
+ {comfyInstalling && (
+ <div className={`p-3 rounded-lg border ${cardClass} text-left`}>
+ <div className="flex items-center gap-2 mb-2">
+ <Loader2 size={14} className="animate-spin text-purple-400" />
+ <span className="text-[0.7rem] font-medium">Installing ComfyUI...</span>
+ </div>
+ <div className={`text-[0.55rem] font-mono max-h-24 overflow-y-auto space-y-0.5 ${isDark ? 'text-gray-500' : 'text-gray-400'}`}>
+ {comfyInstallLogs.slice(-8).map((log, i) => (
+ <p key={i}>{log}</p>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Error */}
+ {comfyInstallError && (
+ <p className="text-[0.65rem] text-red-400">{comfyInstallError}</p>
+ )}
+
+ {/* Ready state */}
+ {comfyReady && (
+ <div className={`p-3 rounded-lg border ${isDark ? 'bg-green-500/10 border-green-500/20' : 'bg-green-50 border-green-200'}`}>
+ <div className="flex items-center gap-2 justify-center">
+ <Check size={14} className="text-green-400" />
+ <span className="text-[0.7rem] font-medium">ComfyUI is ready</span>
+ </div>
+ </div>
+ )}
+
+ <div className="flex items-center justify-center gap-2 pt-1">
+ {(comfyFound?.found || comfyReady) && (
+ <button
+ onClick={() => hasOllama ? setStep('models') : setStep('done')}
+ className={primaryBtn}
+ >
+ Continue <ArrowRight size={14} />
+ </button>
+ )}
+ {!comfyInstalling && !comfyFound?.found && !comfyReady && (
+ <>
+ <button
+ onClick={() => {
+ setComfyDetecting(true)
+ setComfyFound(null)
+ backendCall<{ found: boolean; path?: string }>('find_comfyui')
+ .then(result => { setComfyFound(result); if (result.found) setComfyReady(true) })
+ .catch(() => setComfyFound({ found: false }))
+ .finally(() => setComfyDetecting(false))
+ }}
+ className={secondaryBtn}
+ >
+ <RefreshCw size={12} /> Re-Scan
+ </button>
+ <button
+ onClick={() => hasOllama ? setStep('models') : setStep('done')}
+ className={`${secondaryBtn} opacity-60`}
+ >
+ Skip for now <ChevronRight size={12} />
+ </button>
+ </>
+ )}
+ </div>
+ </motion.div>
+ )}
+
+ {/* Step 5: Models (Ollama only — pull models) */}
{step === 'models' && (
<motion.div
key="models"
@@ -308,10 +544,22 @@ export function Onboarding() {
<div className="text-center mb-3">
<h2 className="text-base font-semibold mb-1">Choose your models</h2>
<p className={`text-[0.7rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
- Select uncensored models to install. You can add more later.
+ {systemVRAM ? `Showing models for your ${systemVRAM} GB GPU.` : 'Select models to install.'} You can add more later.
</p>
</div>
+ {/* Uncensored / Mainstream tabs */}
+ <div className="flex gap-4 justify-center">
+ <button onClick={() => setModelSubTab('uncensored')} className={`flex items-center gap-2 transition-all ${modelSubTab === 'uncensored' ? 'opacity-100' : 'opacity-40 hover:opacity-70'}`}>
+ <div className={`w-1 h-4 rounded-full ${modelSubTab === 'uncensored' ? 'bg-red-500' : 'bg-red-500/50'}`} />
+ <span className="text-[0.65rem] font-semibold uppercase tracking-wider">Uncensored</span>
+ </button>
+ <button onClick={() => setModelSubTab('mainstream')} className={`flex items-center gap-2 transition-all ${modelSubTab === 'mainstream' ? 'opacity-100' : 'opacity-40 hover:opacity-70'}`}>
+ <div className={`w-1 h-4 rounded-full ${modelSubTab === 'mainstream' ? 'bg-blue-500' : 'bg-blue-500/50'}`} />
+ <span className="text-[0.65rem] font-semibold uppercase tracking-wider">Mainstream</span>
+ </button>
+ </div>
+
{isPulling && pullingModel && (
<div className={`p-2.5 rounded-lg border ${cardClass}`}>
<div className="flex items-center justify-between mb-1">
@@ -334,7 +582,14 @@ export function Onboarding() {
)}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2 max-h-[50vh] overflow-y-auto scrollbar-thin pr-1">
- {ONBOARDING_MODELS.map((model) => {
+ {ONBOARDING_MODELS.filter(m => {
+ // Filter by tab
+ if (modelSubTab === 'uncensored' && !m.uncensored) return false
+ if (modelSubTab === 'mainstream' && m.uncensored) return false
+ // Filter by VRAM if known
+ if (systemVRAM && m.vramGB > systemVRAM) return false
+ return true
+ }).map((model) => {
const selected = selectedModels.includes(model.name)
const pulled = pulledModels.includes(model.name) || installedModels.some((m) => m.name === model.name)
return (
@@ -359,6 +614,11 @@ export function Onboarding() {
Recommended
</span>
)}
+ {model.agent && (
+ <span className={`text-[0.5rem] px-1 py-0.5 rounded ${isDark ? 'bg-green-500/15 text-green-400 border border-green-500/30' : 'bg-green-50 text-green-700 border border-green-200'}`}>
+ Tool Calling
+ </span>
+ )}
</div>
<p className={`text-[0.6rem] mt-0.5 ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>{model.description}</p>
<p className={`text-[0.55rem] mt-0.5 ${isDark ? 'text-gray-500' : 'text-gray-400'}`}>
@@ -411,19 +671,17 @@ export function Onboarding() {
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
>
- <div className={`w-10 h-10 rounded-lg flex items-center justify-center mx-auto ${isDark ? 'bg-green-500/10' : 'bg-green-50'}`}>
- <Check size={20} className="text-green-400" />
- </div>
+ <div className="w-3 h-3 rounded-full bg-green-400 mx-auto" />
<h2 className="text-base font-semibold">You're all set!</h2>
<p className={`text-[0.75rem] ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>
{pulledModels.length > 0
- ? `${pulledModels.length} model${pulledModels.length > 1 ? 's' : ''} installed. Start chatting!`
+ ? `${pulledModels.length} model${pulledModels.length > 1 ? 's' : ''} installed. You're ready to go.`
: detectedBackends.length > 0
- ? `Connected to ${detectedBackends.find(b => b.id === selectedBackend)?.name || detectedBackends[0].name}. Start chatting!`
+ ? `Connected to ${detectedBackends.find(b => b.id === selectedBackend)?.name || detectedBackends[0].name}. You're ready to go.`
: 'You can configure backends and install models anytime from Settings and Model Manager.'}
</p>
<button onClick={finish} className={primaryBtn}>
- Start Chatting <ArrowRight size={14} />
+ Get Started <ArrowRight size={14} />
</button>
</motion.div>
)}
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 7bdabbbc..e4c79753 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -99,6 +99,106 @@ function WorkflowSection() {
)
}
+// ── ComfyUI Settings ────────────────────────────────────────────
+
+function ComfyUISettings() {
+ const [status, setStatus] = useState<{ running: boolean; found: boolean; path?: string; starting?: boolean } | null>(null)
+ const [loading, setLoading] = useState(true)
+
+ useEffect(() => {
+ let cancelled = false
+ const check = async () => {
+ try {
+ const { backendCall } = await import('../../api/backend')
+ const s: any = await backendCall('comfyui_status')
+ if (!cancelled) setStatus(s)
+ } catch {}
+ if (!cancelled) setLoading(false)
+ }
+ check()
+ const interval = setInterval(check, 5000)
+ return () => { cancelled = true; clearInterval(interval) }
+ }, [])
+
+ const handleStart = async () => {
+ try {
+ const { backendCall } = await import('../../api/backend')
+ await backendCall('start_comfyui')
+ setStatus(prev => prev ? { ...prev, starting: true } : null)
+ } catch {}
+ }
+
+ const handleStop = async () => {
+ try {
+ const { backendCall } = await import('../../api/backend')
+ await backendCall('stop_comfyui')
+ setStatus(prev => prev ? { ...prev, running: false } : null)
+ } catch {}
+ }
+
+ if (loading) {
+ return <div className="flex items-center gap-2 text-[0.65rem] text-gray-500"><Loader2 size={12} className="animate-spin" /> Checking...</div>
+ }
+
+ return (
+ <div className="space-y-2">
+ {/* Status */}
+ <div className="flex items-center justify-between">
+ <span className="text-[0.7rem] text-gray-700 dark:text-gray-400">Status</span>
+ <div className="flex items-center gap-1.5">
+ <div className={`w-1.5 h-1.5 rounded-full ${status?.running ? 'bg-green-500' : status?.found ? 'bg-orange-500' : 'bg-gray-500'}`} />
+ <span className="text-[0.65rem] text-gray-500">
+ {status?.running ? 'Running' : status?.found ? 'Stopped' : 'Not Installed'}
+ </span>
+ </div>
+ </div>
+
+ {/* Path */}
+ {status?.path && (
+ <div className="flex items-center justify-between">
+ <span className="text-[0.7rem] text-gray-700 dark:text-gray-400">Path</span>
+ <span className="text-[0.55rem] font-mono text-gray-500 truncate max-w-48" title={status.path}>{status.path}</span>
+ </div>
+ )}
+
+ {/* Controls */}
+ <div className="flex items-center gap-1.5">
+ {status?.found && !status.running && (
+ <button onClick={handleStart} className="px-2 py-1 rounded text-[0.6rem] bg-green-500/10 text-green-400 hover:bg-green-500/20 transition-colors">
+ Start
+ </button>
+ )}
+ {status?.running && (
+ <button onClick={handleStop} className="px-2 py-1 rounded text-[0.6rem] bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors">
+ Stop
+ </button>
+ )}
+ {status?.running && (
+ <button
+ onClick={async () => { await handleStop(); setTimeout(handleStart, 2000) }}
+ className="px-2 py-1 rounded text-[0.6rem] bg-white/5 text-gray-400 hover:bg-white/10 transition-colors"
+ >
+ Restart
+ </button>
+ )}
+ {!status?.found && (
+ <button
+ onClick={async () => {
+ try {
+ const { backendCall } = await import('../../api/backend')
+ await backendCall('install_comfyui')
+ } catch {}
+ }}
+ className="px-2 py-1 rounded text-[0.6rem] bg-purple-500/10 text-purple-400 hover:bg-purple-500/20 transition-colors"
+ >
+ Install ComfyUI
+ </button>
+ )}
+ </div>
+ </div>
+ )
+}
+
// ── Main Component ──────────────────────────────────────────────
export function SettingsPage() {
@@ -188,6 +288,11 @@ export function SettingsPage() {
<ProviderSettings />
</Section>
+ {/* ── ComfyUI (Image & Video Engine) ─────────── */}
+ <Section title="ComfyUI (Image & Video)">
+ <ComfyUISettings />
+ </Section>
+
{/* ── Voice ──────────────────────────────────── */}
<Section title="Voice">
<div className="flex items-center gap-3 text-[0.65rem]">
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 139c260b..4ec7b758 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -126,7 +126,7 @@ export function useCreate() {
const state = useCreateStore.getState()
const {
mode, prompt, negativePrompt, imageModel, videoModel,
- sampler, scheduler, steps, cfgScale, width, height, seed, batchSize, frames, fps,
+ sampler, scheduler, steps, cfgScale, width, height, seed, batchSize, frames, fps, i2vImage,
setIsGenerating, setProgress, setCurrentPromptId, setError, addToGallery, addToPromptHistory,
} = state
@@ -182,13 +182,13 @@ export function useCreate() {
if (customWf) {
builderUsed = 'custom'
setProgress(5, `Using workflow: ${customWf.name}...`)
- const params = mode === 'video' ? { ...baseParams, frames, fps } : baseParams
+ const params = mode === 'video' ? { ...baseParams, frames, fps, ...(i2vImage ? { inputImage: i2vImage } : {}) } : baseParams
workflow = await injectParameters(customWf.workflow, customWf.parameterMap, params, imageModelType)
} else {
// Dynamic workflow builder — auto-detects nodes and builds the right pipeline
setProgress(5, 'Building workflow...')
try {
- const genParams = mode === 'video' ? { ...baseParams, frames, fps } : baseParams
+ const genParams = mode === 'video' ? { ...baseParams, frames, fps, ...(i2vImage ? { inputImage: i2vImage } : {}) } : baseParams
workflow = await buildDynamicWorkflow(genParams, imageModelType)
builderUsed = 'dynamic'
} catch (dynErr) {
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 525425c0..f108924d 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -204,19 +204,30 @@ export interface OnboardingModel {
description: string
size: string
vram: string
+ vramGB: number
recommended?: boolean
+ uncensored?: boolean
+ agent?: boolean // Supports tool calling / agent mode
}
export const ONBOARDING_MODELS: OnboardingModel[] = [
- { name: 'mannix/llama3.1-8b-abliterated:q5_K_M', label: 'Llama 3.1 8B', description: 'Fast & reliable all-rounder', size: '5.7 GB', vram: '6 GB', recommended: true },
- { name: 'huihui_ai/qwen3-abliterated:8b', label: 'Qwen3 8B', description: 'Latest Qwen, great for coding', size: '5.2 GB', vram: '6 GB' },
- { name: 'richardyoung/qwen3-14b-abliterated:q4_K_M', label: 'Qwen3 14B', description: 'Very smart, fits 12GB GPU', size: '9 GB', vram: '12 GB' },
- { name: 'huihui_ai/gemma3-abliterated:12b', label: 'Gemma 3 12B', description: 'Google model, vision support', size: '8 GB', vram: '12 GB' },
- { name: 'krith/mistral-nemo-instruct-2407-abliterated:IQ4_XS', label: 'Mistral Nemo 12B', description: 'Strong multilingual model', size: '6.8 GB', vram: '8 GB' },
- { name: 'huihui_ai/deepseek-r1-abliterated:8b', label: 'DeepSeek R1 8B', description: 'Reasoning & chain-of-thought', size: '5 GB', vram: '6 GB' },
- { name: 'huihui_ai/phi4-abliterated:14b', label: 'Phi-4 14B', description: 'Microsoft, great at math & logic', size: '9 GB', vram: '12 GB' },
- { name: 'huihui_ai/mistral-small-abliterated:24b', label: 'Mistral Small 24B', description: 'Powerful, needs 16GB+ VRAM', size: '14 GB', vram: '16 GB' },
- { name: 'huihui_ai/glm4.6-abliterated:9b', label: 'GLM 4.6 9B', description: 'Newest model, strong coding', size: '6 GB', vram: '8 GB' },
- { name: 'huihui_ai/qwen2.5-abliterated:7b', label: 'Qwen 2.5 7B', description: 'Lightweight & capable', size: '4.7 GB', vram: '6 GB' },
- { name: 'huihui_ai/llama3.3-abliterated:70b-q4_K_M', label: 'Llama 3.3 70B', description: 'Maximum intelligence, needs 48GB', size: '42 GB', vram: '48 GB' },
+ // Uncensored (abliterated)
+ { name: 'mannix/llama3.1-8b-abliterated:q5_K_M', label: 'Llama 3.1 8B', description: 'Fast & reliable all-rounder', size: '5.7 GB', vram: '6 GB', vramGB: 6, recommended: true, uncensored: true, agent: true },
+ { name: 'huihui_ai/qwen3-abliterated:8b', label: 'Qwen3 8B', description: 'Latest Qwen, great for coding', size: '5.2 GB', vram: '6 GB', vramGB: 6, uncensored: true, agent: true },
+ { name: 'richardyoung/qwen3-14b-abliterated:q4_K_M', label: 'Qwen3 14B', description: 'Very smart, fits 12GB GPU', size: '9 GB', vram: '12 GB', vramGB: 12, uncensored: true, agent: true },
+ { name: 'huihui_ai/gemma3-abliterated:12b', label: 'Gemma 3 12B', description: 'Google model, vision support', size: '8 GB', vram: '12 GB', vramGB: 12, uncensored: true, agent: true },
+ { name: 'krith/mistral-nemo-instruct-2407-abliterated:IQ4_XS', label: 'Mistral Nemo 12B', description: 'Strong multilingual model', size: '6.8 GB', vram: '8 GB', vramGB: 8, uncensored: true },
+ { name: 'huihui_ai/deepseek-r1-abliterated:8b', label: 'DeepSeek R1 8B', description: 'Reasoning & chain-of-thought', size: '5 GB', vram: '6 GB', vramGB: 6, uncensored: true },
+ { name: 'huihui_ai/phi4-abliterated:14b', label: 'Phi-4 14B', description: 'Microsoft, great at math & logic', size: '9 GB', vram: '12 GB', vramGB: 12, uncensored: true },
+ { name: 'huihui_ai/mistral-small-abliterated:24b', label: 'Mistral Small 24B', description: 'Powerful, needs 16GB+ VRAM', size: '14 GB', vram: '16 GB', vramGB: 16, uncensored: true, agent: true },
+ { name: 'huihui_ai/glm4.6-abliterated:9b', label: 'GLM 4.6 9B', description: 'Newest model, strong coding', size: '6 GB', vram: '8 GB', vramGB: 8, uncensored: true, agent: true },
+ { name: 'huihui_ai/qwen2.5-abliterated:7b', label: 'Qwen 2.5 7B', description: 'Lightweight & capable', size: '4.7 GB', vram: '6 GB', vramGB: 6, uncensored: true, agent: true },
+ { name: 'huihui_ai/llama3.3-abliterated:70b-q4_K_M', label: 'Llama 3.3 70B', description: 'Maximum intelligence, needs 48GB', size: '42 GB', vram: '48 GB', vramGB: 48, uncensored: true, agent: true },
+ // Mainstream (official, not abliterated)
+ { name: 'llama3.1:8b', label: 'Llama 3.1 8B', description: 'Meta general-purpose model', size: '4.7 GB', vram: '6 GB', vramGB: 6, recommended: true, agent: true },
+ { name: 'qwen3:8b', label: 'Qwen3 8B', description: 'Latest Qwen, coding & reasoning', size: '5.2 GB', vram: '6 GB', vramGB: 6, agent: true },
+ { name: 'gemma3:12b', label: 'Gemma 3 12B', description: 'Google model, vision support', size: '8 GB', vram: '12 GB', vramGB: 12, agent: true },
+ { name: 'phi4:14b', label: 'Phi-4 14B', description: 'Microsoft, math & logic', size: '9 GB', vram: '12 GB', vramGB: 12 },
+ { name: 'deepseek-r1:8b', label: 'DeepSeek R1 8B', description: 'Reasoning & chain-of-thought', size: '5 GB', vram: '6 GB', vramGB: 6 },
+ { name: 'gemma4:e4b', label: 'Gemma 4 E4B', description: 'Google latest, lightweight MoE', size: '3 GB', vram: '4 GB', vramGB: 4, agent: true },
]
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index c8f56eb5..93f27f94 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -63,6 +63,7 @@ interface CreateState {
batchSize: number
frames: number
fps: number
+ i2vImage: string | null // Uploaded image filename for I2V models (SVD, FramePack)
isGenerating: boolean
progress: number
progressText: string
@@ -91,6 +92,7 @@ interface CreateState {
setBatchSize: (batchSize: number) => void
setFrames: (frames: number) => void
setFps: (fps: number) => void
+ setI2vImage: (image: string | null) => void
setIsGenerating: (generating: boolean) => void
setProgress: (progress: number, text?: string) => void
setProgressPhase: (phase: ProgressPhase) => void
@@ -122,6 +124,7 @@ export const useCreateStore = create<CreateState>()(
batchSize: 1,
frames: 24,
fps: 8,
+ i2vImage: null,
isGenerating: false,
progress: 0,
progressText: '',
@@ -172,6 +175,7 @@ export const useCreateStore = create<CreateState>()(
setBatchSize: (batchSize) => set({ batchSize: Math.max(1, Math.min(8, Math.floor(batchSize))) }),
setFrames: (frames) => set({ frames: Math.max(1, Math.min(120, Math.floor(frames))) }),
setFps: (fps) => set({ fps: Math.max(1, Math.min(60, Math.floor(fps))) }),
+ setI2vImage: (image) => set({ i2vImage: image }),
setIsGenerating: (generating) => set({ isGenerating: generating, ...(generating ? {} : { progressPhase: 'idle' as ProgressPhase }) }),
setProgress: (progress, text) => set({ progress, progressText: text ?? '' }),
setProgressPhase: (phase) => set({ progressPhase: phase }),
diff --git a/src/stores/downloadStore.ts b/src/stores/downloadStore.ts
new file mode 100644
index 00000000..ad9a01ca
--- /dev/null
+++ b/src/stores/downloadStore.ts
@@ -0,0 +1,113 @@
+import { create } from 'zustand'
+import { getDownloadProgress, pauseDownload, cancelDownload, resumeDownload, type DownloadProgress } from '../api/discover'
+
+// Maps filename → bundle name for grouped display
+type BundleMap = Record<string, string>
+
+interface DownloadStoreState {
+ downloads: Record<string, DownloadProgress>
+ downloadMeta: Record<string, { url: string; subfolder: string }>
+ bundleMap: BundleMap // filename → bundle name
+ polling: boolean
+ pollInterval: ReturnType<typeof setInterval> | null
+
+ refresh: () => Promise<void>
+ startPolling: () => void
+ stopPolling: () => void
+ setMeta: (filename: string, url: string, subfolder: string) => void
+ setBundleGroup: (bundleName: string, filenames: string[]) => void
+ pause: (id: string) => Promise<void>
+ cancel: (id: string) => Promise<void>
+ resume: (id: string) => Promise<void>
+ dismiss: (id: string) => void
+}
+
+export const useDownloadStore = create<DownloadStoreState>()((set, get) => ({
+ downloads: {},
+ downloadMeta: {},
+ bundleMap: {},
+ polling: false,
+ pollInterval: null,
+
+ refresh: async () => {
+ try {
+ const prog = await getDownloadProgress()
+ const prev = get().downloads
+
+ // Detect newly completed downloads and dispatch event
+ for (const [id, d] of Object.entries(prog)) {
+ if (d.status === 'complete' && prev[id]?.status !== 'complete') {
+ window.dispatchEvent(new CustomEvent('comfyui-model-downloaded'))
+ }
+ }
+
+ set({ downloads: prog })
+
+ // Auto-stop polling when no active downloads
+ const hasActive = Object.values(prog).some(d =>
+ d.status === 'downloading' || d.status === 'connecting' || d.status === 'pausing'
+ )
+ if (!hasActive) {
+ get().stopPolling()
+ }
+ } catch {
+ // Keep polling on transient errors
+ }
+ },
+
+ startPolling: () => {
+ const state = get()
+ if (state.polling) return
+ const interval = setInterval(() => get().refresh(), 1000)
+ set({ polling: true, pollInterval: interval })
+ // Immediate first fetch
+ get().refresh()
+ },
+
+ stopPolling: () => {
+ const state = get()
+ if (state.pollInterval) clearInterval(state.pollInterval)
+ set({ polling: false, pollInterval: null })
+ },
+
+ setMeta: (filename, url, subfolder) => {
+ set(s => ({ downloadMeta: { ...s.downloadMeta, [filename]: { url, subfolder } } }))
+ },
+
+ setBundleGroup: (bundleName, filenames) => {
+ set(s => {
+ const updated = { ...s.bundleMap }
+ for (const f of filenames) updated[f] = bundleName
+ return { bundleMap: updated }
+ })
+ },
+
+ pause: async (id: string) => {
+ await pauseDownload(id)
+ await get().refresh()
+ },
+
+ cancel: async (id: string) => {
+ await cancelDownload(id)
+ set(s => {
+ const updated = { ...s.downloads }
+ delete updated[id]
+ return { downloads: updated }
+ })
+ },
+
+ resume: async (id: string) => {
+ const meta = get().downloadMeta[id]
+ if (!meta) return
+ await resumeDownload(id, meta.url, meta.subfolder)
+ get().startPolling()
+ },
+
+ dismiss: (id: string) => {
+ set(s => {
+ const updated = { ...s.downloads }
+ delete updated[id]
+ return { downloads: updated }
+ })
+ },
+}))
diff --git a/src/stores/uiStore.ts b/src/stores/uiStore.ts
index 8283c9ed..80e0c46e 100644
--- a/src/stores/uiStore.ts
+++ b/src/stores/uiStore.ts
@@ -11,7 +11,7 @@ interface UIState {
}
export const useUIStore = create<UIState>()((set) => ({
- currentView: 'models',
+ currentView: 'chat',
sidebarOpen: true,
setView: (view) => set({ currentView: view }),