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.

fix: end-user UX overhaul — partial downloads, terminal popup, CORS, I2V tabs

PurpleDoubleDd391c7b9b351
diff --git a/src-tauri/src/commands/download.rs b/src-tauri/src/commands/download.rs
index fb05d00e..28d31cc7 100644
--- a/src-tauri/src/commands/download.rs
+++ b/src-tauri/src/commands/download.rs
@@ -579,3 +579,81 @@ pub async fn download_model_to_path(
Ok(serde_json::json!({"status": "started", "id": id}))
}
+
+// ─── File Size Validation ───
+
+#[derive(serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CheckFileRequest {
+ pub subfolder: String,
+ pub filename: String,
+ pub expected_bytes: u64,
+}
+
+#[derive(serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CheckFileResult {
+ pub filename: String,
+ pub exists: bool,
+ pub actual_bytes: u64,
+ pub complete: bool,
+}
+
+#[tauri::command]
+pub async fn check_model_sizes(
+ files: Vec<CheckFileRequest>,
+ state: State<'_, AppState>,
+) -> Result<Vec<CheckFileResult>, String> {
+ let comfy_path = {
+ let mut p = state.comfy_path.lock().unwrap();
+ if p.is_none() {
+ if let Some(found) = crate::commands::process::find_comfyui_path() {
+ *p = Some(found);
+ }
+ }
+ p.clone()
+ };
+
+ let mut results = Vec::with_capacity(files.len());
+
+ for file in &files {
+ let dest_dir = match models_dir(&comfy_path, &file.subfolder) {
+ Ok(d) => d,
+ Err(_) => {
+ results.push(CheckFileResult {
+ filename: file.filename.clone(),
+ exists: false,
+ actual_bytes: 0,
+ complete: false,
+ });
+ continue;
+ }
+ };
+
+ let dest_file = dest_dir.join(&file.filename);
+ if dest_file.exists() {
+ let actual = dest_file.metadata().map(|m| m.len()).unwrap_or(0);
+ let threshold = if file.expected_bytes > 0 {
+ (file.expected_bytes as f64 * 0.9) as u64
+ } else {
+ 0
+ };
+ let complete = file.expected_bytes == 0 || actual >= threshold;
+ results.push(CheckFileResult {
+ filename: file.filename.clone(),
+ exists: true,
+ actual_bytes: actual,
+ complete,
+ });
+ } else {
+ results.push(CheckFileResult {
+ filename: file.filename.clone(),
+ exists: false,
+ actual_bytes: 0,
+ complete: false,
+ });
+ }
+ }
+
+ Ok(results)
+}
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index 016066fa..10cad5a0 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -2,10 +2,17 @@ use std::fs;
use std::path::PathBuf;
use std::process::{Command, Stdio};
+#[cfg(target_os = "windows")]
+use std::os::windows::process::CommandExt;
+
use tauri::State;
use crate::state::AppState;
+/// Windows: hide console windows for spawned processes
+#[cfg(target_os = "windows")]
+const CREATE_NO_WINDOW: u32 = 0x08000000;
+
#[tauri::command]
pub fn install_comfyui(
install_path: Option<String>,
@@ -30,12 +37,14 @@ pub fn install_comfyui(
std::thread::spawn(move || {
// Step 1: Git clone
println!("[Install] Cloning ComfyUI to {:?}", target_dir);
- let clone = Command::new("git")
- .args(["clone", "https://github.com/comfyanonymous/ComfyUI.git"])
+ let mut cmd = Command::new("git");
+ cmd.args(["clone", "https://github.com/comfyanonymous/ComfyUI.git"])
.arg(&target_dir)
.stdout(Stdio::piped())
- .stderr(Stdio::piped())
- .output();
+ .stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ let clone = cmd.output();
match clone {
Ok(output) if output.status.success() => {
@@ -46,10 +55,12 @@ pub fn install_comfyui(
// Directory might already exist
if stderr.contains("already exists") {
println!("[Install] ComfyUI directory already exists, updating...");
- let _ = Command::new("git")
- .args(["pull"])
- .current_dir(&target_dir)
- .output();
+ let mut pull = Command::new("git");
+ pull.args(["pull"]).current_dir(&target_dir)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ pull.creation_flags(CREATE_NO_WINDOW);
+ let _ = pull.output();
} else {
println!("[Install] Git clone failed: {}", stderr);
return;
@@ -62,10 +73,11 @@ pub fn install_comfyui(
}
// Step 2: Detect GPU and install PyTorch
- let has_nvidia = Command::new("nvidia-smi")
- .output()
- .map(|o| o.status.success())
- .unwrap_or(false);
+ let mut nv = Command::new("nvidia-smi");
+ nv.stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ nv.creation_flags(CREATE_NO_WINDOW);
+ let has_nvidia = nv.output().map(|o| o.status.success()).unwrap_or(false);
println!("[Install] GPU detected: {}", if has_nvidia { "NVIDIA CUDA" } else { "CPU only" });
@@ -77,22 +89,22 @@ pub fn install_comfyui(
};
println!("[Install] Installing PyTorch...");
- let _ = Command::new(&python_bin)
- .args(&torch_args)
- .stdout(Stdio::piped())
- .stderr(Stdio::piped())
- .output();
+ let mut pip = Command::new(&python_bin);
+ pip.args(&torch_args).stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ pip.creation_flags(CREATE_NO_WINDOW);
+ let _ = pip.output();
// Step 3: Install ComfyUI requirements
println!("[Install] Installing ComfyUI requirements...");
let reqs = target_dir.join("requirements.txt");
if reqs.exists() {
- let _ = Command::new(&python_bin)
- .args(["-m", "pip", "install", "-r"])
- .arg(&reqs)
- .stdout(Stdio::piped())
- .stderr(Stdio::piped())
- .output();
+ let mut pip_req = Command::new(&python_bin);
+ pip_req.args(["-m", "pip", "install", "-r"]).arg(&reqs)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ pip_req.creation_flags(CREATE_NO_WINDOW);
+ let _ = pip_req.output();
}
println!("[Install] ComfyUI installation complete");
@@ -145,12 +157,12 @@ pub fn install_custom_node(
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()
+ let mut cmd = Command::new("git");
+ cmd.args(["pull"]).current_dir(&target_dir)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ let output = cmd.output()
.map_err(|e| format!("Git pull failed: {}", e))?;
let status = if output.status.success() { "updated" } else { "update_failed" };
@@ -161,12 +173,12 @@ pub fn install_custom_node(
} 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()
+ let mut cmd = Command::new("git");
+ cmd.args(["clone", &repo_url]).arg(&target_dir)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
+ let output = cmd.output()
.map_err(|e| format!("Git clone failed: {}", e))?;
if output.status.success() {
@@ -175,12 +187,12 @@ pub fn install_custom_node(
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();
+ let mut pip = Command::new(&python_bin);
+ pip.args(["-m", "pip", "install", "-r"]).arg(&reqs)
+ .stdout(Stdio::piped()).stderr(Stdio::piped());
+ #[cfg(target_os = "windows")]
+ pip.creation_flags(CREATE_NO_WINDOW);
+ let _ = pip.output();
}
Ok(serde_json::json!({
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index 80e728a2..bc12307a 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -220,7 +220,7 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, St
println!("[ComfyUI] Starting from: {}", comfy_path);
let mut cmd = Command::new(python);
- cmd.args(["main.py", "--listen", "127.0.0.1", "--port", "8188"])
+ cmd.args(["main.py", "--listen", "127.0.0.1", "--port", "8188", "--enable-cors-header", "*"])
.current_dir(&comfy_path)
.stdin(Stdio::null())
.stdout(Stdio::piped())
@@ -410,7 +410,7 @@ pub fn auto_start_comfyui(state: &AppState) {
*state.comfy_path.lock().unwrap() = Some(path.clone());
let mut cmd = Command::new(&state.python_bin);
- cmd.args(["main.py", "--listen", "127.0.0.1", "--port", "8188"])
+ cmd.args(["main.py", "--listen", "127.0.0.1", "--port", "8188", "--enable-cors-header", "*"])
.current_dir(&path)
.stdin(Stdio::null())
.stdout(Stdio::piped())
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index a72c0e5e..c36cac67 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -59,6 +59,7 @@ fn main() {
commands::download::cancel_download,
commands::download::resume_download,
commands::download::detect_model_path,
+ commands::download::check_model_sizes,
// Web search
commands::search::web_search,
commands::search::search_status,
diff --git a/src/api/backend.ts b/src/api/backend.ts
index a32addb6..13b27bdd 100644
--- a/src/api/backend.ts
+++ b/src/api/backend.ts
@@ -122,6 +122,7 @@ export async function backendCall<T = any>(
download_model: { path: "/local-api/download-model", method: "POST" },
download_model_to_path: { path: "/local-api/download-model-to-path", method: "POST" },
detect_model_path: { path: "/local-api/detect-model-path", method: "POST" },
+ check_model_sizes: { path: "/local-api/check-model-sizes", method: "POST" },
download_progress: { path: "/local-api/download-progress" },
pause_download: { path: "/local-api/pause-download", method: "POST" },
cancel_download: { path: "/local-api/cancel-download", method: "POST" },
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 51eeb9a7..1aae6d40 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -104,6 +104,12 @@ export function isVideoModelType(type: ModelType): boolean {
|| type === 'cogvideo' || type === 'svd' || type === 'framepack' || type === 'pyramidflow' || type === 'allegro'
}
+/** Check if a model filename is an Image-to-Video model (needs input image) */
+export function isI2VModel(name: string): boolean {
+ const lower = name.toLowerCase()
+ return lower.includes('i2v') || lower.includes('svd') || lower.includes('framepack')
+}
+
// ─── Default generation parameters per model type ───
export interface ModelTypeDefaults {
@@ -335,18 +341,71 @@ export async function getAnimateDiffModels(): Promise<string[]> {
}
}
+// ─── Partial Download Filter ───
+// Filters out files that exist on disk but are incomplete (< 90% of expected size).
+// Uses known bundle file sizes from discover.ts. Unknown files pass through.
+
+let _knownFileSizes: Map<string, { subfolder: string; expectedBytes: number }> | null = null
+
+function getKnownFileSizes(): Map<string, { subfolder: string; expectedBytes: number }> {
+ if (_knownFileSizes) return _knownFileSizes
+ // Lazy import to avoid circular deps
+ const { getImageBundles, getVideoBundles } = require('../api/discover')
+ _knownFileSizes = new Map()
+ for (const bundle of [...getImageBundles(), ...getVideoBundles()]) {
+ for (const f of (bundle as any).files) {
+ if (f.filename && f.sizeGB && f.subfolder) {
+ _knownFileSizes.set(f.filename, {
+ subfolder: f.subfolder,
+ expectedBytes: Math.round(f.sizeGB * 1_073_741_824),
+ })
+ }
+ }
+ }
+ return _knownFileSizes
+}
+
+/** Filter out partially downloaded files. Returns only filenames that are complete. */
+export async function filterPartialFiles(filenames: string[]): Promise<Set<string>> {
+ const known = getKnownFileSizes()
+ const filesToCheck = filenames
+ .filter(name => known.has(name))
+ .map(name => {
+ const info = known.get(name)!
+ return { subfolder: info.subfolder, filename: name, expectedBytes: info.expectedBytes }
+ })
+
+ if (filesToCheck.length === 0) return new Set(filenames) // nothing to check → all pass
+
+ try {
+ const { backendCall } = await import('./backend')
+ const results: Array<{ filename: string; complete: boolean }> =
+ await backendCall('check_model_sizes', { files: filesToCheck })
+ const incomplete = new Set(results.filter(r => !r.complete).map(r => r.filename))
+ if (incomplete.size > 0) {
+ console.log(`[ComfyUI] Filtered ${incomplete.size} partial downloads:`, [...incomplete])
+ }
+ return new Set(filenames.filter(name => !incomplete.has(name)))
+ } catch {
+ return new Set(filenames) // if check fails, show all (backward compat)
+ }
+}
+
// ─── Classified Model Lists ───
export async function getImageModels(): Promise<ClassifiedModel[]> {
const [checkpoints, diffModels] = await Promise.all([getCheckpoints(), getDiffusionModels()])
+ const complete = await filterPartialFiles([...checkpoints, ...diffModels])
const result: ClassifiedModel[] = []
for (const name of checkpoints) {
+ if (!complete.has(name)) continue
const type = classifyModel(name)
result.push({ name, type: isImageModelType(type) ? type : 'sdxl', source: 'checkpoint' })
}
for (const name of diffModels) {
+ if (!complete.has(name)) continue
const type = classifyModel(name)
if (isImageModelType(type)) {
result.push({ name, type, source: 'diffusion_model' })
@@ -358,9 +417,11 @@ export async function getImageModels(): Promise<ClassifiedModel[]> {
export async function getVideoModels(): Promise<ClassifiedModel[]> {
const diffModels = await getDiffusionModels()
+ const complete = await filterPartialFiles(diffModels)
const result: ClassifiedModel[] = []
for (const name of diffModels) {
+ if (!complete.has(name)) continue
const type = classifyModel(name)
if (isVideoModelType(type)) {
result.push({ name, type, source: 'diffusion_model' })
diff --git a/src/api/discover.ts b/src/api/discover.ts
index e17ef03c..89f6d3cf 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -60,6 +60,61 @@ export async function resumeDownload(id: string, url: string, subfolder: string)
// ─── Custom Node Installation ───
+/** Check if ALL files in a bundle are completely downloaded (size validated) */
+export async function checkBundleInstalled(bundle: ModelBundle): Promise<boolean> {
+ try {
+ const files = bundle.files
+ .filter(f => f.subfolder && f.filename)
+ .map(f => ({
+ subfolder: f.subfolder!,
+ filename: f.filename!,
+ expectedBytes: f.sizeGB ? Math.round(f.sizeGB * 1_073_741_824) : 0,
+ }))
+ if (files.length === 0) return false
+ const results: Array<{ filename: string; exists: boolean; actualBytes: number; complete: boolean }> =
+ await backendCall('check_model_sizes', { files })
+ return results.every(r => r.complete)
+ } catch {
+ return false
+ }
+}
+
+/** Check multiple bundles at once, returns map of bundle name → installed status */
+export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Record<string, boolean>> {
+ const result: Record<string, boolean> = {}
+ // Collect ALL files from ALL bundles into a single batch request
+ const allFiles: Array<{ subfolder: string; filename: string; expectedBytes: number; bundleName: string }> = []
+ for (const bundle of bundles) {
+ for (const f of bundle.files) {
+ if (!f.subfolder || !f.filename) continue
+ allFiles.push({
+ subfolder: f.subfolder,
+ filename: f.filename,
+ expectedBytes: f.sizeGB ? Math.round(f.sizeGB * 1_073_741_824) : 0,
+ bundleName: bundle.name,
+ })
+ }
+ }
+ if (allFiles.length === 0) return result
+
+ try {
+ const checkFiles = allFiles.map(f => ({ subfolder: f.subfolder, filename: f.filename, expectedBytes: f.expectedBytes }))
+ const results: Array<{ filename: string; exists: boolean; actualBytes: number; complete: boolean }> =
+ await backendCall('check_model_sizes', { files: checkFiles })
+
+ // Map results back to bundles
+ const fileStatus = new Map(results.map(r => [r.filename, r.complete]))
+ for (const bundle of bundles) {
+ const bundleFiles = bundle.files.filter(f => f.filename)
+ result[bundle.name] = bundleFiles.length > 0 && bundleFiles.every(f => fileStatus.get(f.filename!) === true)
+ }
+ } catch {
+ // If check fails (e.g. no ComfyUI), all bundles are not installed
+ for (const b of bundles) result[b.name] = false
+ }
+ return result
+}
+
export async function installCustomNodes(nodeKeys: string[]): Promise<void> {
for (const key of nodeKeys) {
const entry = CUSTOM_NODE_REGISTRY[key]
@@ -80,23 +135,7 @@ export async function installCustomNodes(nodeKeys: string[]): Promise<void> {
export async function installBundleComplete(bundle: ModelBundle): Promise<void> {
const errors: string[] = []
- // Step 1: Install custom nodes if needed (non-blocking — don't prevent downloads)
- if (bundle.customNodes && bundle.customNodes.length > 0) {
- for (const key of bundle.customNodes) {
- try {
- const entry = CUSTOM_NODE_REGISTRY[key]
- if (!entry) continue
- await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
- console.log(`[discover] Installed custom node: ${entry.name}`)
- } catch (err) {
- console.warn('[discover] Custom node install failed (continuing with downloads):', err)
- errors.push(`Custom node ${key}: ${err}`)
- }
- }
- }
-
- // Step 2: Download all model files — each file independently (don't let one failure stop others)
- let startedDownloads = 0
+ // Step 1: Start ALL downloads IMMEDIATELY (don't wait for custom nodes)
for (const file of bundle.files) {
if (!file.downloadUrl || !file.filename || !file.subfolder) continue
try {
@@ -105,8 +144,6 @@ export async function installBundleComplete(bundle: ModelBundle): Promise<void>
if (result.status === 'exists') {
// File already on disk — emit synthetic 'complete' so UI reflects it
window.dispatchEvent(new CustomEvent('comfyui-download-exists', { detail: { filename: file.filename } }))
- } else {
- startedDownloads++
}
} catch (err) {
console.error(`[discover] Download failed for ${file.filename}:`, err)
@@ -114,15 +151,31 @@ export async function installBundleComplete(bundle: ModelBundle): Promise<void>
}
}
- // Step 3: Restart ComfyUI if custom nodes were installed (needed for node registration)
+ // Step 2: Install custom nodes in BACKGROUND (fire-and-forget, non-blocking)
+ // This runs git clone + pip install which can take minutes — never block downloads
if (bundle.customNodes && bundle.customNodes.length > 0) {
- try {
- await backendCall('stop_comfyui')
- await new Promise(resolve => setTimeout(resolve, 2000))
- await backendCall('start_comfyui')
- } catch (err) {
- console.warn('[discover] ComfyUI restart after custom node install failed:', err)
- }
+ const nodeKeys = [...bundle.customNodes]
+ void (async () => {
+ for (const key of nodeKeys) {
+ try {
+ const entry = CUSTOM_NODE_REGISTRY[key]
+ if (!entry) continue
+ await backendCall('install_custom_node', { repoUrl: entry.repo, nodeName: entry.name })
+ console.log(`[discover] Installed custom node: ${entry.name}`)
+ } catch (err) {
+ console.warn('[discover] Custom node install failed:', err)
+ }
+ }
+ // Restart ComfyUI after custom nodes are done (needed for node registration)
+ try {
+ await backendCall('stop_comfyui')
+ await new Promise(resolve => setTimeout(resolve, 2000))
+ await backendCall('start_comfyui')
+ console.log('[discover] ComfyUI restarted after custom node install')
+ } catch (err) {
+ console.warn('[discover] ComfyUI restart after custom node install failed:', err)
+ }
+ })()
}
if (errors.length > 0) {
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index 796c6e3e..e084942f 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -9,7 +9,6 @@ import { MessageList } from './MessageList'
import { ChatInput } from './ChatInput'
import { RAGPanel } from './RAGPanel'
import { AgentModeToggle } from './AgentModeToggle'
-import { ModelRecommendation } from '../models/ModelRecommendation'
import { ErrorBoundary } from '../ui/ErrorBoundary'
import { useSettingsStore } from '../../stores/settingsStore'
import { FEATURE_FLAGS } from '../../lib/constants'
@@ -75,7 +74,6 @@ export function ChatView() {
<h1 className="text-[0.95rem] font-semibold text-gray-400 mb-0.5 tracking-wide">LUncensored</h1>
<p className="text-[0.72rem] text-gray-600">No filters, no limits.</p>
- {models.length === 0 && <div className="mt-4"><ModelRecommendation /></div>}
{models.length > 0 && !activeModel && (
<p className="text-[0.6rem] text-amber-500/60 mt-3">Select a model above.</p>
)}
diff --git a/src/components/create/ParamPanel.tsx b/src/components/create/ParamPanel.tsx
index 561fa67a..809267ec 100644
--- a/src/components/create/ParamPanel.tsx
+++ b/src/components/create/ParamPanel.tsx
@@ -1,9 +1,10 @@
+import { useState } from 'react'
import { useCreateStore } from '../../stores/createStore'
import { SliderControl } from '../settings/SliderControl'
import { WorkflowFinder } from './WorkflowFinder'
-import { Dice5, Info, AlertTriangle } from 'lucide-react'
+import { Dice5, Info, AlertTriangle, Film, ImageIcon } from 'lucide-react'
import type { ClassifiedModel, ModelType } from '../../api/comfyui'
-import { snapToVideoGrid } from '../../api/comfyui'
+import { snapToVideoGrid, isI2VModel } from '../../api/comfyui'
interface Props {
imageModels: ClassifiedModel[]
@@ -47,16 +48,29 @@ const TYPE_BADGE: Record<ModelType, { label: string; color: string }> = {
wan: { label: 'Wan', color: 'bg-orange-500/15 text-orange-300' },
hunyuan: { label: 'Hunyuan', color: 'bg-red-500/15 text-red-300' },
ltx: { label: 'LTX', color: 'bg-cyan-500/15 text-cyan-300' },
+ mochi: { label: 'Mochi', color: 'bg-pink-500/15 text-pink-300' },
+ cosmos: { label: 'Cosmos', color: 'bg-emerald-500/15 text-emerald-300' },
+ cogvideo: { label: 'CogVideo', color: 'bg-amber-500/15 text-amber-300' },
+ svd: { label: 'SVD', color: 'bg-indigo-500/15 text-indigo-300' },
+ framepack: { label: 'FramePack', color: 'bg-teal-500/15 text-teal-300' },
+ pyramidflow: { label: 'PyramidFlow', color: 'bg-violet-500/15 text-violet-300' },
+ allegro: { label: 'Allegro', color: 'bg-rose-500/15 text-rose-300' },
unknown: { label: 'Model', color: 'bg-white/10 text-gray-400' },
}
export function ParamPanel({ imageModels, videoModels, samplerList, schedulerList, modelsLoaded }: Props) {
const store = useCreateStore()
const isVideo = store.mode === 'video'
+ const [videoSubTab, setVideoSubTab] = useState<'t2v' | 'i2v'>('t2v')
const sizePresets = isVideo ? VID_SIZE_PRESETS : getImageSizePresets(store.imageModelType)
- const models = isVideo ? videoModels : imageModels
- const sel = 'w-full px-2.5 py-1.5 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/8 text-gray-900 dark:text-white text-[11px] focus:outline-none focus:border-gray-400 dark:focus:border-white/20 appearance-none cursor-pointer'
+ // Filter video models by sub-tab
+ const filteredVideoModels = isVideo
+ ? videoModels.filter(m => videoSubTab === 'i2v' ? isI2VModel(m.name) : !isI2VModel(m.name))
+ : videoModels
+ const models = isVideo ? filteredVideoModels : imageModels
+
+ const sel = 'w-full px-2.5 py-1.5 rounded-lg bg-gray-100 dark:bg-[#1a1a1a] border border-gray-200 dark:border-white/8 text-gray-900 dark:text-white text-[11px] focus:outline-none focus:border-gray-400 dark:focus:border-white/20 cursor-pointer'
const lbl = 'text-[10px] font-medium text-gray-500 dark:text-gray-600 uppercase tracking-widest mb-1 block'
const handleModelChange = (name: string) => {
@@ -73,15 +87,37 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLis
return (
<div className="space-y-3">
- {/* Workflow */}
- <WorkflowFinder
- modelName={activeModel}
- modelType={isVideo ? (models.find(m => m.name === activeModel)?.type ?? 'unknown') : store.imageModelType}
- />
+ {/* Video Sub-Tabs: Text to Video / Image to Video */}
+ {isVideo && (
+ <div className="flex rounded-lg bg-gray-100 dark:bg-white/5 p-0.5 gap-0.5">
+ <button
+ onClick={() => setVideoSubTab('t2v')}
+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md text-[10px] font-medium transition-all ${
+ videoSubTab === 't2v'
+ ? 'bg-white dark:bg-white/15 text-gray-900 dark:text-white shadow-sm'
+ : 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'
+ }`}
+ >
+ <Film size={11} />
+ Text to Video
+ </button>
+ <button
+ onClick={() => setVideoSubTab('i2v')}
+ className={`flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded-md text-[10px] font-medium transition-all ${
+ videoSubTab === 'i2v'
+ ? 'bg-white dark:bg-white/15 text-gray-900 dark:text-white shadow-sm'
+ : 'text-gray-500 hover:text-gray-700 dark:hover:text-gray-300'
+ }`}
+ >
+ <ImageIcon size={11} />
+ Image to Video
+ </button>
+ </div>
+ )}
{/* Model */}
<div>
- <label className={lbl}>{isVideo ? 'Video Model' : 'Image Model'}</label>
+ <label className={lbl}>{isVideo ? (videoSubTab === 'i2v' ? 'I2V Model' : 'Video Model') : 'Image Model'}</label>
{!modelsLoaded ? (
<div className="px-2.5 py-1.5 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/8 text-gray-400 dark:text-gray-600 text-[10px] animate-pulse">
Loading...
@@ -209,6 +245,14 @@ export function ParamPanel({ imageModels, videoModels, samplerList, schedulerLis
)}
</>
)}
+
+ {/* Workflow (bottom) */}
+ <div className="pt-2 border-t border-gray-200 dark:border-white/5">
+ <WorkflowFinder
+ modelName={activeModel}
+ modelType={isVideo ? (models.find(m => m.name === activeModel)?.type ?? 'unknown') : store.imageModelType}
+ />
+ </div>
</div>
)
}
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index 03b43db0..285f0b1c 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -9,7 +9,7 @@ import {
getHuggingFaceUncensoredModels, getHuggingFaceMainstreamModels,
detectProviderModelPath, startModelDownloadToPath,
startModelDownload, getDownloadProgress, searchCivitaiModels,
- installBundleComplete,
+ installBundleComplete, checkBundlesInstalled,
type DiscoverModel, type DownloadProgress, type ModelBundle, type CivitAIModelResult,
} from '../../api/discover'
import { getSystemVRAM } from '../../api/comfyui'
@@ -107,7 +107,7 @@ function VariantPullButton({ model, pullModel, isPullingModel, isInstalled }: {
)
}
-function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullModel, isPullingModel, isInstalled, handleDownload }: {
+function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullModel, isPullingModel, isInstalled, isModelFullyInstalled, handleDownload }: {
model: DiscoverModel
index: number
isText: boolean
@@ -115,6 +115,7 @@ function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullMo
pullModel: (name: string) => void
isPullingModel: (name: string) => boolean
isInstalled: (name: string) => boolean
+ isModelFullyInstalled: (model: DiscoverModel) => boolean
handleDownload: (m: DiscoverModel) => void
}) {
const dlState = getModelDownloadState(model)
@@ -133,8 +134,8 @@ function ModelDiscoverCard({ model, index, isText, getModelDownloadState, pullMo
<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 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>}
+ {isModelFullyInstalled(model) && <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 && !isModelFullyInstalled(model) && <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>{model.description || model.name}</span>
</h3>
@@ -256,6 +257,14 @@ export function DiscoverModels({ category }: Props) {
getSystemVRAM().then(v => setSystemVRAM(v))
}, [])
+ // Check which bundles are REALLY installed (file size validated, not just file existence)
+ const [bundleStatuses, setBundleStatuses] = useState<Record<string, boolean>>({})
+ useEffect(() => {
+ if (category !== 'image' && category !== 'video') return
+ const allBundles = [...getImageBundles(), ...getVideoBundles()]
+ checkBundlesInstalled(allBundles).then(statuses => setBundleStatuses(statuses))
+ }, [category])
+
// Start polling on mount if there are active downloads
useEffect(() => {
dlStore.getState().refresh()
@@ -319,11 +328,22 @@ export function DiscoverModels({ category }: Props) {
const isInstalled = (name: string) => {
// Exact match (e.g., "hermes3:8b" === "hermes3:8b")
if (installedModels.some((m) => m.name === name)) return true
- // Prefix match for Ollama models without tag (e.g., "hermes3" matches "hermes3:8b" or "hermes3:latest")
- if (!name.includes(':')) {
- return installedModels.some((m) => m.name === name + ':latest' || m.name.startsWith(name + ':'))
+ // For names WITH a tag (e.g., "gemma4:31b") — only exact match, no prefix
+ if (name.includes(':')) return false
+ // For names WITHOUT a tag — only match ":latest" (default pull)
+ return installedModels.some((m) => m.name === name + ':latest')
+ }
+
+ // Card-level: is the model fully installed? (all variants or the single default)
+ const isModelFullyInstalled = (model: DiscoverModel) => {
+ const sizeTags = model.tags.filter(t => /^\d+B$/i.test(t) || /^[Qe]\d/i.test(t) || /^IQ\d/i.test(t) || /^[a-z]+$/i.test(t))
+ if (sizeTags.length <= 1) {
+ // Single variant: check if that specific one is installed
+ const fullName = sizeTags.length === 1 ? `${model.name}:${sizeTags[0].toLowerCase()}` : model.name
+ return isInstalled(fullName)
}
- return false
+ // Multi-variant: show INSTALLED only if ALL variants are installed
+ return sizeTags.every(tag => isInstalled(`${model.name}:${tag.toLowerCase()}`))
}
const handleDownload = async (model: DiscoverModel) => {
@@ -339,6 +359,7 @@ export function DiscoverModels({ category }: Props) {
const handleBundleInstall = async (bundle: ModelBundle) => {
if (installingBundle === bundle.name) return // Prevent duplicate installs
setInstallingBundle(bundle.name)
+ setInstallError(null)
const filenames: string[] = []
for (const file of bundle.files) {
if (file.downloadUrl && file.filename && file.subfolder) {
@@ -355,9 +376,20 @@ export function DiscoverModels({ category }: Props) {
console.error('[DiscoverModels] Bundle install failed:', err)
setInstallError(`${bundle.name}: ${err instanceof Error ? err.message : String(err)}`)
}
- // Keep installingBundle set until polling confirms downloads are active
- // (small delay to let first poll complete)
- setTimeout(() => setInstallingBundle(null), 1500)
+ // Wait for polling to pick up at least one active download before clearing spinner
+ // This prevents the "disappearing" UI — spinner stays until downloads are visible
+ const waitForDownloads = () => {
+ const active = filenames.some(fn => {
+ const dl = dlStore.getState().downloads[fn]
+ return dl && (dl.status === 'downloading' || dl.status === 'connecting' || dl.status === 'complete')
+ })
+ if (active) {
+ setInstallingBundle(null)
+ } else {
+ setTimeout(waitForDownloads, 500)
+ }
+ }
+ setTimeout(waitForDownloads, 1000)
}
const handleCivitaiSearch = async () => {
@@ -376,7 +408,11 @@ export function DiscoverModels({ category }: Props) {
}
const isBundleComplete = (bundle: ModelBundle): boolean => {
- return bundle.files.every(f => f.filename && downloads[f.filename]?.status === 'complete')
+ // Check 1: Download store says all files complete (current session downloads)
+ const dlComplete = bundle.files.every(f => f.filename && downloads[f.filename]?.status === 'complete')
+ if (dlComplete) return true
+ // Check 2: Disk check says all files are complete (size validated)
+ return bundleStatuses[bundle.name] === true
}
const isBundleDownloading = (bundle: ModelBundle): boolean => {
@@ -753,7 +789,7 @@ export function DiscoverModels({ category }: Props) {
{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={handleModelDownload} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleModelDownload} />
))}
{filteredUncensored.length === 0 && (
<p className="text-center text-gray-500 py-4 col-span-2">No uncensored models match your search</p>
@@ -763,7 +799,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={handleModelDownload} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleModelDownload} />
))}
{filteredMainstream.length === 0 && (
<p className="text-center text-gray-500 py-4 col-span-2">No mainstream models match your search</p>
@@ -777,7 +813,7 @@ export function DiscoverModels({ category }: Props) {
<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={handleModelDownload} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleModelDownload} />
))}
</div>
</div>
@@ -789,7 +825,7 @@ export function DiscoverModels({ category }: Props) {
<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} />
+ <ModelDiscoverCard key={model.name + i} model={model} index={i} isText={isText} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleModelDownload} />
))}
</div>
</div>
@@ -798,7 +834,7 @@ export function DiscoverModels({ category }: Props) {
) : !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} />
+ <ModelDiscoverCard key={model.name} model={model} index={i} isText={false} getModelDownloadState={getModelDownloadState} pullModel={pullModel} isPullingModel={isPullingModel} isInstalled={isInstalled} isModelFullyInstalled={isModelFullyInstalled} handleDownload={handleDownload} />
))}
</div>
) : null}
diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.ts
index d687a031..1c7bb49b 100644
--- a/src/hooks/useModels.ts
+++ b/src/hooks/useModels.ts
@@ -1,7 +1,7 @@
import { useCallback } from 'react'
import { listModels, pullModel as pullModelApi, pullModelTauri, deleteModel as deleteModelApi } from '../api/ollama'
import { isTauri } from '../api/backend'
-import { getCheckpoints as getComfyCheckpoints, getDiffusionModels as getComfyDiffusionModels, checkComfyConnection } from '../api/comfyui'
+import { getCheckpoints as getComfyCheckpoints, getDiffusionModels as getComfyDiffusionModels, checkComfyConnection, filterPartialFiles } from '../api/comfyui'
import { parseNDJSONStream } from '../api/stream'
import { useModelStore } from '../stores/modelStore'
import { useProviderStore } from '../stores/providerStore'
@@ -64,11 +64,14 @@ export function useModels() {
if (comfyOk) {
try {
const [checkpoints, diffusionModels] = await Promise.all([getComfyCheckpoints(), getComfyDiffusionModels()])
+ const allNames = [...checkpoints, ...diffusionModels]
+ const complete = await filterPartialFiles(allNames)
+
const classifyComfyModel = (name: string): AIModel => {
if (isVideoModel(name)) return { name, model: name, size: 0, format: 'safetensors', architecture: 'unknown', type: 'video', providerName: 'ComfyUI' } as VideoModel
return { name, model: name, size: 0, format: 'safetensors', architecture: 'unknown', type: 'image', providerName: 'ComfyUI' } as ImageModel
}
- comfyModels = [...checkpoints.map(classifyComfyModel), ...diffusionModels.map(classifyComfyModel)]
+ comfyModels = allNames.filter(name => complete.has(name)).map(classifyComfyModel)
} catch { /* continue */ }
}
setModels([...allModels, ...comfyModels])
diff --git a/vite.config.ts b/vite.config.ts
index bfd85299..d64fedd4 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -484,6 +484,46 @@ function comfyLauncher(): Plugin {
})
})
+ // API: Check model file sizes (for partial download detection)
+ server.middlewares.use('/local-api/check-model-sizes', (req, res) => {
+ if (req.method !== 'POST') { res.writeHead(405); res.end(); return }
+ let body = ''
+ req.on('data', (c: any) => { body += c })
+ req.on('end', () => {
+ try {
+ const { files } = JSON.parse(body)
+ const { existsSync, statSync } = require('fs')
+ const { join } = require('path')
+ const home = require('os').homedir()
+ // Try to find ComfyUI path
+ const candidates = [
+ join(home, 'ComfyUI'),
+ join(home, 'Desktop', 'ComfyUI'),
+ 'C:\\ComfyUI',
+ ]
+ const comfyPath = candidates.find(p => existsSync(p)) || join(home, 'ComfyUI')
+ const results = (files as any[]).map((f: any) => {
+ const subfolder = f.subfolder || ''
+ const dir = subfolder.startsWith('custom_nodes')
+ ? join(comfyPath, subfolder)
+ : join(comfyPath, 'models', subfolder)
+ const filePath = join(dir, f.filename)
+ if (existsSync(filePath)) {
+ const actual = statSync(filePath).size
+ const threshold = f.expectedBytes > 0 ? f.expectedBytes * 0.9 : 0
+ return { filename: f.filename, exists: true, actualBytes: actual, complete: f.expectedBytes === 0 || actual >= threshold }
+ }
+ return { filename: f.filename, exists: false, actualBytes: 0, complete: false }
+ })
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify(results))
+ } catch (err) {
+ res.writeHead(500, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ error: String(err) }))
+ }
+ })
+ })
+
// API: Download model to a specific path (for HuggingFace GGUF → LM Studio etc.)
server.middlewares.use('/local-api/download-model-to-path', (req, res) => {
if (req.method !== 'POST') { res.writeHead(405); res.end(); return }