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(comfyui+models+waitlist): .venv support, partial-installed filter, hide waitlist for prior submitters, dev #51 parity

purpleee459d134cdf
diff --git a/package.json b/package.json
index f9f191df..16916e1d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "locally-uncensored",
- "version": "2.5.0",
+ "version": "2.5.1",
"private": false,
"description": "Generate anything — text, images, video. Locally. Uncensored.",
"license": "AGPL-3.0",
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index b6fc1ce4..eb134561 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2514,7 +2514,7 @@ dependencies = [
[[package]]
name = "locally-uncensored"
-version = "2.5.0"
+version = "2.5.1"
dependencies = [
"axum",
"base64 0.22.1",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 6ac35d15..f5576d49 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "locally-uncensored"
-version = "2.5.0"
+version = "2.5.1"
description = "Private, local AI chat & image/video generation"
authors = ["purpledoubled"]
edition = "2021"
diff --git a/src-tauri/src/python.rs b/src-tauri/src/python.rs
index 500c9e05..497e0f14 100644
--- a/src-tauri/src/python.rs
+++ b/src-tauri/src/python.rs
@@ -18,7 +18,15 @@ const CREATE_NO_WINDOW: u32 = 0x08000000;
/// process launcher (so `start_comfyui` runs ComfyUI inside the same
/// isolated env that pip installed PyTorch into).
pub fn venv_python_path(comfyui_dir: &Path) -> PathBuf {
- let venv = comfyui_dir.join("venv");
+ venv_python_path_named(comfyui_dir, "venv")
+}
+
+/// Same as [`venv_python_path`] but for an arbitrary venv directory name.
+/// ComfyUI installs in the wild use either the classic `venv` (LU's own
+/// PEP 668 installer — Bug E) or the modern `.venv` (`uv`,
+/// `python -m venv .venv`). The file is NOT guaranteed to exist.
+pub fn venv_python_path_named(comfyui_dir: &Path, venv_name: &str) -> PathBuf {
+ let venv = comfyui_dir.join(venv_name);
if cfg!(target_os = "windows") {
venv.join("Scripts").join("python.exe")
} else {
@@ -29,14 +37,21 @@ pub fn venv_python_path(comfyui_dir: &Path) -> PathBuf {
/// Resolve the venv Python for `comfyui_dir` iff it exists. Returns the
/// path as a String (matching the API that `process::start_comfyui` already
/// uses for its `bundled_python` / `system_python` slots), or None when
-/// the venv has not been created — caller falls back to the system Python.
+/// no venv has been created — caller falls back to the system Python.
+///
+/// Checks both the classic `venv` and the modern `.venv` directory (issue #51,
+/// adhney): a macOS/Linux ComfyUI installed into `.venv` was previously missed,
+/// so `start_comfyui` fell back to the system Python and crashed with
+/// `ModuleNotFoundError: torch`. `venv` is checked first to preserve the exact
+/// behavior for users whose env LU's own installer created.
pub fn resolve_comfyui_venv_python(comfyui_dir: &Path) -> Option<String> {
- let candidate = venv_python_path(comfyui_dir);
- if candidate.exists() {
- Some(candidate.to_string_lossy().to_string())
- } else {
- None
+ for venv_name in ["venv", ".venv"] {
+ let candidate = venv_python_path_named(comfyui_dir, venv_name);
+ if candidate.exists() {
+ return Some(candidate.to_string_lossy().to_string());
+ }
}
+ None
}
/// Resolve the real Python binary path, filtering out the Microsoft Store stub
@@ -232,6 +247,30 @@ mod tests {
let _ = fs::remove_dir_all(&tmp);
}
+ #[test]
+ fn resolve_finds_dot_venv_layout() {
+ // Issue #51 (adhney): ComfyUI installed into `.venv` (uv / modern
+ // `python -m venv .venv`) must also be picked up, not just `venv`.
+ let tmp = std::env::temp_dir().join("lu-dotvenv-test-present");
+ let _ = fs::remove_dir_all(&tmp);
+ let inner = if cfg!(target_os = "windows") {
+ tmp.join(".venv").join("Scripts")
+ } else {
+ tmp.join(".venv").join("bin")
+ };
+ fs::create_dir_all(&inner).unwrap();
+ let py = if cfg!(target_os = "windows") {
+ inner.join("python.exe")
+ } else {
+ inner.join("python")
+ };
+ fs::write(&py, "stub").unwrap();
+ let resolved = resolve_comfyui_venv_python(&tmp);
+ assert!(resolved.is_some(), "expected resolver to find {}", py.display());
+ assert!(resolved.unwrap().contains(".venv"));
+ let _ = fs::remove_dir_all(&tmp);
+ }
+
// ── is_real_python (Bug P14 — Microsoft Store stub filter) ──────────────
#[test]
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index d2c5ccff..8081a2e4 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json",
"productName": "Locally Uncensored",
- "version": "2.5.0",
+ "version": "2.5.1",
"identifier": "com.purpledoubled.locally-uncensored",
"build": {
"beforeBuildCommand": "npm run build",
diff --git a/src/api/discover.ts b/src/api/discover.ts
index fefc3f2d..ff9afbce 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1,5 +1,5 @@
import { backendCall, fetchExternal } from "./backend"
-import { getCheckpoints, getDiffusionModels, getVAEModels, getCLIPModels } from "./comfyui"
+import { getCheckpoints, getDiffusionModels, getVAEModels, getCLIPModels, filterPartialFiles } from "./comfyui"
import type { ProviderId } from "./providers/types"
import { log } from "../lib/logger"
@@ -129,9 +129,18 @@ export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Rec
const undetected = bundles.filter(b => !result[b.name])
if (undetected.length > 0) {
try {
- const [checkpoints, diffModels, vaes, clips] = await Promise.all([
+ const [rawCheckpoints, rawDiffModels, rawVaes, rawClips] = await Promise.all([
getCheckpoints(), getDiffusionModels(), getVAEModels(), getCLIPModels(),
])
+ // Issue #51 (adhney): ComfyUI lists partially-downloaded files too, so the
+ // fuzzy fallback below would mark an incomplete download as INSTALLED. Drop
+ // any file check_model_sizes confirms is partial before matching.
+ const [checkpoints, diffModels, vaes, clips] = await Promise.all([
+ filterPartialFiles(rawCheckpoints).then(s => Array.from(s)),
+ filterPartialFiles(rawDiffModels).then(s => Array.from(s)),
+ filterPartialFiles(rawVaes).then(s => Array.from(s)),
+ filterPartialFiles(rawClips).then(s => Array.from(s)),
+ ])
const modelsBySubfolder: Record<string, string[]> = {
checkpoints, diffusion_models: diffModels, vae: vaes, text_encoders: clips,
}
diff --git a/src/components/layout/CloudWaitlistBadge.tsx b/src/components/layout/CloudWaitlistBadge.tsx
index 7540c4db..a3b46e6a 100644
--- a/src/components/layout/CloudWaitlistBadge.tsx
+++ b/src/components/layout/CloudWaitlistBadge.tsx
@@ -13,8 +13,10 @@ import { log } from '../../lib/logger'
* Deliberately NOT naggy (the adversarial call): no pulsing/animation on the
* dot, the network call fires ONLY on the explicit "Notify me" click (never on
* render or launch), and there is honest microcopy that this is the one thing
- * LU sends off-device. The badge only ever disappears via the explicit
- * "Don't show me again" — closing the popover or clicking outside leaves it.
+ * LU sends off-device. The badge disappears for good once the user clicks
+ * "Don't show me again", or on the next launch after they join the waitlist
+ * (a fresh submit still shows the "you're on the list" confirmation first).
+ * Closing the popover or clicking outside leaves it.
*
* The popover is a self-contained dark gradient card (black → dark-grey) in
* both themes — David 2026-06-06 wanted it distinct from the flat grey panels,
@@ -26,6 +28,13 @@ export function CloudWaitlistBadge() {
const setDismissed = useCloudTeaserStore((s) => s.setDismissed)
const setSubmitted = useCloudTeaserStore((s) => s.setSubmitted)
+ // A user who joined the waitlist in a PREVIOUS session (incl. v2.5.0) should
+ // not see the badge again (David 2026-06-07: gone for people who already
+ // submitted OR dismissed). `submitted` persists in lu_cloud_teaser (a
+ // STORE_KEY, so it survives updates). Snapshot it once at mount so a fresh
+ // same-session submit still shows the confirmation before it's gone next launch.
+ const [submittedBeforeThisSession] = useState(() => useCloudTeaserStore.getState().submitted)
+
const [open, setOpen] = useState(false)
const [email, setEmail] = useState('')
const [busy, setBusy] = useState(false)
@@ -41,8 +50,9 @@ export function CloudWaitlistBadge() {
return () => document.removeEventListener('mousedown', handler)
}, [])
- // The badge is gone for good only once the user explicitly opts out.
- if (dismissed) return null
+ // Gone for good once the user opts out, or if they already joined the
+ // waitlist in an earlier session (see snapshot above).
+ if (dismissed || submittedBeforeThisSession) return null
const handleSubmit = async () => {
if (busy) return
diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.ts
index edc334ae..558c8eb1 100644
--- a/src/hooks/useModels.ts
+++ b/src/hooks/useModels.ts
@@ -144,12 +144,21 @@ export function useModels() {
// Dev mode: streaming fetch
try {
const response = await pullModelApi(name, controller.signal)
+ let streamError: string | null = null
for await (const chunk of parseNDJSONStream<PullProgress>(response)) {
updatePullProgress(name, chunk)
+ // Surface an error the NDJSON stream reports mid-pull instead of
+ // falsely flipping the card to "complete" (adhney; mirrors the
+ // Tauri-path Bug Z/a handling above).
+ if (chunk.error) { streamError = chunk.error; break }
+ }
+ if (streamError) {
+ updatePullProgress(name, { status: `Error: ${streamError}` })
+ } else {
+ completePull(name)
+ try { await fetchModels() } catch { /* non-critical */ }
+ setTimeout(() => dismissPull(name), 5000)
}
- completePull(name)
- try { await fetchModels() } catch { /* non-critical */ }
- setTimeout(() => dismissPull(name), 5000)
} catch (err) {
if ((err as Error).name !== 'AbortError') {
updatePullProgress(name, { status: `Error: ${(err as Error).message}` })
diff --git a/src/types/models.ts b/src/types/models.ts
index 2ae3080b..a8f2ff5c 100644
--- a/src/types/models.ts
+++ b/src/types/models.ts
@@ -77,6 +77,10 @@ export interface PullProgress {
digest?: string
total?: number
completed?: number
+ // Ollama can stream an `{"error": "..."}` line mid-pull (e.g. HTTP 400 on an
+ // incompatible repo). Surfaced so the pull card shows why it failed instead
+ // of falsely completing (adhney).
+ error?: string
}
diff --git a/vite.config.ts b/vite.config.ts
index 40272239..36447395 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -218,14 +218,32 @@ function comfyLauncher(): Plugin {
let comfyProcess: ChildProcess | null = null
let comfyLogs: string[] = []
+ // Mirror the Rust launcher (process.rs): prefer a venv python so ComfyUI runs
+ // inside the env pip installed torch into. Checks both the classic `venv` and
+ // the modern `.venv` (issue #51, adhney). Dev-mode only.
+ const getComfyPython = (comfyPath: string): string => {
+ const isWin = process.platform === 'win32'
+ for (const v of ['venv', '.venv']) {
+ const vp = isWin
+ ? join(comfyPath, v, 'Scripts', 'python.exe')
+ : join(comfyPath, v, 'bin', 'python')
+ if (existsSync(vp)) {
+ console.log(`[ComfyUI] Using venv python: ${vp}`)
+ return vp
+ }
+ }
+ return pythonBin
+ }
+
const startComfy = (comfyPath: string): { status: string; path: string } => {
if (comfyProcess && !comfyProcess.killed) {
return { status: 'already_running', path: comfyPath }
}
comfyLogs = []
- console.log(`[ComfyUI] Spawning ${pythonBin} in: ${comfyPath}`)
- comfyProcess = spawn(pythonBin, ['main.py', '--listen', '127.0.0.1', '--port', '8188'], {
+ const executable = getComfyPython(comfyPath)
+ console.log(`[ComfyUI] Spawning ${executable} in: ${comfyPath}`)
+ comfyProcess = spawn(executable, ['main.py', '--listen', '127.0.0.1', '--port', '8188', '--enable-cors-header', '*'], {
cwd: comfyPath,
stdio: ['ignore', 'pipe', 'pipe'],
shell: false,
@@ -293,8 +311,14 @@ function comfyLauncher(): Plugin {
// 3. Strict Origin Validation (Defense in Depth)
const origin = req.headers.origin;
if (origin) {
- const allowedOrigins = ['http://localhost:5173', 'http://127.0.0.1:5173', 'tauri://localhost', 'http://tauri.localhost'];
- if (!allowedOrigins.includes(origin)) {
+ // Allow any loopback origin on any port — Vite may bind 5174+ when
+ // 5173 is busy, which previously 403'd ComfyUI-path setup (issue
+ // #51, adhney). Also accept the request's own host header.
+ const host = req.headers.host;
+ const allowedOrigins = ['tauri://localhost', 'http://tauri.localhost'];
+ if (host) allowedOrigins.push(`http://${host}`, `https://${host}`);
+ const isLoopback = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(origin);
+ if (!allowedOrigins.includes(origin) && !isLoopback) {
res.writeHead(403, { 'Content-Type': 'text/plain' });
res.end('Forbidden: Invalid Origin (CSRF Protection)');
return;
@@ -527,28 +551,44 @@ function comfyLauncher(): Plugin {
const doRequest = (requestUrl: string, redirectCount = 0) => {
if (redirectCount > 5) { promiseReject(new Error('Too many redirects')); return }
+
+ // Resume support (issue #51, adhney): if a partial file exists, ask
+ // the server for the remaining bytes via Range instead of restarting
+ // from 0. Packaged mode (download.rs) already does this; this is the
+ // dev-server parity.
+ let existingSize = 0
+ const headers: Record<string, string> = { 'User-Agent': 'LocallyUncensored/1.1' }
+ if (existsSync(destPath)) {
+ try {
+ existingSize = statSync(destPath).size
+ if (existingSize > 0) headers['Range'] = `bytes=${existingSize}-`
+ } catch { /* ignore — fall back to a full download */ }
+ }
+
const proto = requestUrl.startsWith('https') ? https : http
- proto.get(requestUrl, { headers: { 'User-Agent': 'LocallyUncensored/1.1' } }, (response) => {
+ proto.get(requestUrl, { headers }, (response) => {
if (response.statusCode && response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
doRequest(response.headers.location, redirectCount + 1)
return
}
- if (response.statusCode !== 200) {
+ const isPartial = response.statusCode === 206
+ if (response.statusCode !== 200 && !isPartial) {
activeDownloads.set(id, { ...activeDownloads.get(id)!, status: 'error', error: `HTTP ${response.statusCode}` })
promiseReject(new Error(`HTTP ${response.statusCode}`))
return
}
- const total = parseInt(response.headers['content-length'] || '0', 10)
- let downloaded = 0
+ const contentLength = parseInt(response.headers['content-length'] || '0', 10)
+ const total = isPartial ? contentLength + existingSize : contentLength
+ let downloaded = isPartial ? existingSize : 0
let lastTime = Date.now()
- let lastBytes = 0
+ let lastBytes = downloaded
const dir = dirname(destPath)
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
- const file = createWriteStream(destPath)
+ const file = createWriteStream(destPath, { flags: isPartial ? 'a' : 'w' })
- activeDownloads.set(id, { progress: 0, total, speed: 0, filename, status: 'downloading' })
+ activeDownloads.set(id, { progress: downloaded, total, speed: 0, filename, status: 'downloading' })
response.on('data', (chunk: Buffer) => {
downloaded += chunk.length
@@ -628,6 +668,14 @@ function comfyLauncher(): Plugin {
}
const id = filename
+ // Don't restart an in-flight download from 0 if the UI re-fires the
+ // start (issue #51, adhney).
+ const active = activeDownloads.get(id)
+ if (active && (active.status === 'downloading' || active.status === 'connecting')) {
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ status: 'started', id }))
+ return
+ }
console.log(`[Download] Starting: ${filename} → ${destDir}`)
downloadFile(url, destPath, id).catch(err => console.error(`[Download] Failed: ${err.message}`))
@@ -780,6 +828,12 @@ function comfyLauncher(): Plugin {
}
}
const id = filename
+ const active = activeDownloads.get(id)
+ if (active && (active.status === 'downloading' || active.status === 'connecting')) {
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ status: 'started', id }))
+ return
+ }
console.log(`[Download] Starting to path: ${filename} → ${destDir}`)
downloadFile(url, destPath, id).catch(err => console.error(`[Download] Failed: ${err.message}`))
res.writeHead(200, { 'Content-Type': 'application/json' })