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(community-2.5.6): web video gallery (konata), models-missing hint (#3 deeper), picker poll perf (#70)

purple0e8ac3d67836
diff --git a/src/api/__tests__/backend-urls.test.ts b/src/api/__tests__/backend-urls.test.ts
index 2cce1ed7..6a2c2ecd 100644
--- a/src/api/__tests__/backend-urls.test.ts
+++ b/src/api/__tests__/backend-urls.test.ts
@@ -12,6 +12,7 @@ import {
isTauri,
ollamaUrl,
comfyuiUrl,
+ comfyAbsoluteFallback,
comfyuiWsUrl,
setComfyPort,
getComfyPort,
@@ -366,6 +367,46 @@ describe('backend — URL helpers', () => {
})
})
+ // ─── comfyAbsoluteFallback (konata web video-gallery fix, 2026-06-25) ───
+
+ describe('comfyAbsoluteFallback', () => {
+ it('rewrites a relative /comfyui/view path to an absolute host URL', () => {
+ setComfyHost('localhost')
+ setComfyPort(8188)
+ expect(comfyAbsoluteFallback('/comfyui/view?filename=out.mp4&type=output'))
+ .toBe('http://localhost:8188/view?filename=out.mp4&type=output')
+ })
+
+ it('rewrites a bare /view path (no /comfyui prefix) too', () => {
+ setComfyHost('localhost')
+ setComfyPort(8188)
+ expect(comfyAbsoluteFallback('/view?filename=out.webm'))
+ .toBe('http://localhost:8188/view?filename=out.webm')
+ })
+
+ it('honours a custom host + port (remote ComfyUI via tunnel)', () => {
+ setComfyHost('192.168.1.50')
+ setComfyPort(9999)
+ expect(comfyAbsoluteFallback('/comfyui/view?filename=clip.mp4'))
+ .toBe('http://192.168.1.50:9999/view?filename=clip.mp4')
+ })
+
+ it('leaves an already-absolute URL untouched (Tauri path)', () => {
+ setComfyHost('localhost')
+ setComfyPort(8188)
+ const abs = 'http://localhost:8188/view?filename=x.png'
+ expect(comfyAbsoluteFallback(abs)).toBe(abs)
+ })
+
+ it('only strips the leading /comfyui segment, not an inner one', () => {
+ setComfyHost('localhost')
+ setComfyPort(8188)
+ // subfolder happening to contain the word should not be mangled
+ expect(comfyAbsoluteFallback('/comfyui/view?filename=a&subfolder=comfyui_out'))
+ .toBe('http://localhost:8188/view?filename=a&subfolder=comfyui_out')
+ })
+ })
+
// ─── isComfyLocal ───
describe('isComfyLocal', () => {
diff --git a/src/api/backend.ts b/src/api/backend.ts
index ea61d435..f1120d72 100644
--- a/src/api/backend.ts
+++ b/src/api/backend.ts
@@ -557,6 +557,25 @@ export function comfyuiUrl(path: string): string {
return `/comfyui${path}`;
}
+/**
+ * Web-build fallback for a relative ComfyUI media URL (konata 2026-06-08 chat,
+ * 2026-06-25 Create page). In the browser build, media URLs are the RELATIVE
+ * Vite-proxy path (`/comfyui/view?…`). That loads fine under `npm run dev`, but
+ * a static host — or a reverse-proxy / SSH tunnel in front of a remote ComfyUI —
+ * can mishandle the `<video>` byte-range subrequest and never paint it, while a
+ * plain `<img>` GET and a direct top-level navigation to the same URL still work
+ * (exactly konata's "video not in gallery, direct link works" report). When the
+ * relative load fires onError, retry with an ABSOLUTE URL straight to the
+ * ComfyUI host — `<img>`/`<video>` display is not CORS-gated, so it needs no
+ * proxy. Tauri URLs are already absolute (never start with '/') and pass through
+ * untouched. The chat path (ToolCallBlock) has shipped this since 2026-06-08;
+ * this is the same logic, shared so the Create-page renderers match it. */
+export function comfyAbsoluteFallback(url: string): string {
+ if (!url.startsWith('/')) return url;
+ const path = url.startsWith('/comfyui/') ? url.slice('/comfyui'.length) : url;
+ return `http://${_comfyHost}:${_comfyPort}${path}`;
+}
+
/** Get the WebSocket URL for ComfyUI */
export function comfyuiWsUrl(): string {
return `ws://${_comfyHost}:${_comfyPort}/ws`;
diff --git a/src/components/create/Gallery.tsx b/src/components/create/Gallery.tsx
index 242df975..79f93a19 100644
--- a/src/components/create/Gallery.tsx
+++ b/src/components/create/Gallery.tsx
@@ -2,7 +2,7 @@ import { useState } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { Trash2, Download, ChevronDown, ChevronUp } from 'lucide-react'
import { getImageUrl } from '../../api/comfyui'
-import { downloadComfyFile } from '../../api/backend'
+import { downloadComfyFile, comfyAbsoluteFallback } from '../../api/backend'
import { useCreateStore, type GalleryItem } from '../../stores/createStore'
import { MediaViewer } from './MediaViewer'
@@ -13,6 +13,12 @@ export function Gallery() {
const [expanded, setExpanded] = useState(true)
const [page, setPage] = useState(0)
const [viewerIndex, setViewerIndex] = useState<number | null>(null)
+ // konata 2026-06-25: in the web build, a video tile's relative /comfyui/view
+ // URL can fail to paint through a reverse-proxy/tunnel while the raw URL works.
+ // Track tiles whose primary load errored and retry them with an absolute URL.
+ const [failedIds, setFailedIds] = useState<Set<string>>(new Set())
+ const markFailed = (id: string) =>
+ setFailedIds((prev) => (prev.has(id) ? prev : new Set(prev).add(id)))
if (gallery.length === 0) {
return (
@@ -65,7 +71,8 @@ export function Gallery() {
<div className="flex gap-2 overflow-x-auto scrollbar-thin px-4 pb-3">
{visible.map((item, i) => {
// Stable URL (item's createdAt token) → no per-render refetch.
- const url = getImageUrl(item.filename, item.subfolder, 'output', item.createdAt)
+ const rawUrl = getImageUrl(item.filename, item.subfolder, 'output', item.createdAt)
+ const url = failedIds.has(item.id) ? comfyAbsoluteFallback(rawUrl) : rawUrl
return (
<motion.div
key={item.id}
@@ -82,11 +89,13 @@ export function Gallery() {
className="w-20 h-20 object-cover"
muted
playsInline
+ preload="metadata"
+ onError={() => markFailed(item.id)}
onMouseEnter={(e) => e.currentTarget.play()}
onMouseLeave={(e) => { e.currentTarget.pause(); e.currentTarget.currentTime = 0 }}
/>
) : (
- <img src={url} alt="" className="w-20 h-20 object-cover" loading="lazy" />
+ <img src={url} alt="" className="w-20 h-20 object-cover" loading="lazy" onError={() => markFailed(item.id)} />
)}
<div className="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-1">
<button
diff --git a/src/components/create/MediaViewer.tsx b/src/components/create/MediaViewer.tsx
index edd521ec..7ae03f6b 100644
--- a/src/components/create/MediaViewer.tsx
+++ b/src/components/create/MediaViewer.tsx
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom'
import { motion, AnimatePresence } from 'framer-motion'
import { X, Download, ChevronLeft, ChevronRight, ZoomIn, ZoomOut, Info } from 'lucide-react'
import { getImageUrl } from '../../api/comfyui'
-import { downloadComfyFile } from '../../api/backend'
+import { downloadComfyFile, comfyAbsoluteFallback } from '../../api/backend'
import type { GalleryItem } from '../../stores/createStore'
interface Props {
@@ -78,7 +78,11 @@ export function MediaViewer({ gallery, initialIndex, onClose }: Props) {
// Stable URL: keyed on the item's immutable createdAt, so the string is
// identical across every re-render (zoom/pan/mouse-move) → no refetch, no
// flicker. Empty when the gallery has emptied out.
- const url = item ? getImageUrl(item.filename, item.subfolder, 'output', item.createdAt) : ''
+ const rawUrl = item ? getImageUrl(item.filename, item.subfolder, 'output', item.createdAt) : ''
+ // konata 2026-06-25: web build — fall back to an absolute host URL if the
+ // relative /comfyui/view path fails to paint (reverse-proxy/tunnel).
+ const [failedId, setFailedId] = useState<string | null>(null)
+ const url = item && failedId === item.id ? comfyAbsoluteFallback(rawUrl) : rawUrl
const ready = !!url && loadedUrl === url
const resetView = useCallback(() => { setZoom(1); setPan({ x: 0, y: 0 }) }, [])
@@ -228,6 +232,7 @@ export function MediaViewer({ gallery, initialIndex, onClose }: Props) {
playsInline
className="max-w-[92vw] max-h-[82vh] rounded-lg shadow-2xl bg-black"
onLoadedData={() => setLoadedUrl(url)}
+ onError={() => { if (item && failedId !== item.id) setFailedId(item.id) }}
onClick={(e) => e.stopPropagation()}
style={{ opacity: ready ? 1 : 0, transition: 'opacity 0.2s ease-out' }}
/>
@@ -237,6 +242,7 @@ export function MediaViewer({ gallery, initialIndex, onClose }: Props) {
src={url}
alt={item.prompt}
onLoad={() => setLoadedUrl(url)}
+ onError={() => { if (item && failedId !== item.id) setFailedId(item.id) }}
draggable={false}
onMouseDown={onMouseDown}
className="max-w-[92vw] max-h-[82vh] object-contain rounded-lg shadow-2xl"
diff --git a/src/components/create/OutputDisplay.tsx b/src/components/create/OutputDisplay.tsx
index f8b13212..08ef9f11 100644
--- a/src/components/create/OutputDisplay.tsx
+++ b/src/components/create/OutputDisplay.tsx
@@ -2,7 +2,7 @@ import { useState } from 'react'
import { motion } from 'framer-motion'
import { Download, Maximize2, Copy, Check, RefreshCw, HardDrive, Brain, Cpu, Zap } from 'lucide-react'
import { getImageUrl } from '../../api/comfyui'
-import { downloadComfyFile } from '../../api/backend'
+import { downloadComfyFile, comfyAbsoluteFallback } from '../../api/backend'
import { useCreateStore, type GalleryItem } from '../../stores/createStore'
import { MediaViewer } from './MediaViewer'
@@ -14,6 +14,9 @@ export function OutputDisplay() {
// generation never shows a half-painted frame. Keyed by item id so it
// auto-resets when a new result arrives.
const [loadedId, setLoadedId] = useState<string | null>(null)
+ // konata 2026-06-25: web build — if the relative /comfyui/view URL fails to
+ // paint (reverse-proxy/tunnel), retry once with an absolute URL to the host.
+ const [failedId, setFailedId] = useState<string | null>(null)
const latest = gallery[0]
const handleDownload = (item: GalleryItem) => {
@@ -136,7 +139,8 @@ export function OutputDisplay() {
// Show latest result — stable URL (item's createdAt as cache token) so the
// element never refetches across re-renders.
- const url = getImageUrl(latest.filename, latest.subfolder, 'output', latest.createdAt)
+ const rawUrl = getImageUrl(latest.filename, latest.subfolder, 'output', latest.createdAt)
+ const url = failedId === latest.id ? comfyAbsoluteFallback(rawUrl) : rawUrl
const ready = loadedId === latest.id
return (
@@ -156,6 +160,7 @@ export function OutputDisplay() {
loop
playsInline
onLoadedData={() => setLoadedId(latest.id)}
+ onError={() => { if (failedId !== latest.id) setFailedId(latest.id) }}
className="max-w-full max-h-full rounded-xl border border-gray-200 dark:border-white/10 object-contain cursor-pointer bg-black"
style={{ opacity: ready ? 1 : 0, transition: 'opacity 0.25s ease-out' }}
onClick={() => setViewerIndex(0)}
@@ -166,6 +171,7 @@ export function OutputDisplay() {
src={url}
alt={latest.prompt}
onLoad={() => setLoadedId(latest.id)}
+ onError={() => { if (failedId !== latest.id) setFailedId(latest.id) }}
className="max-w-full max-h-full rounded-xl border border-gray-200 dark:border-white/10 object-contain cursor-pointer"
style={{ opacity: ready ? 1 : 0, transition: 'opacity 0.25s ease-out' }}
onClick={() => setViewerIndex(0)}
diff --git a/src/components/models/ModelManager.tsx b/src/components/models/ModelManager.tsx
index 9fe88821..1a80c0cb 100644
--- a/src/components/models/ModelManager.tsx
+++ b/src/components/models/ModelManager.tsx
@@ -13,6 +13,7 @@ import { DiscoverModels } from './DiscoverModels'
import { Modal } from '../ui/Modal'
import { GlowButton } from '../ui/GlowButton'
import { showModel } from '../../api/ollama'
+import { checkComfyConnection } from '../../api/comfyui'
import type { ModelCategory, AIModel } from '../../types/models'
// Three-mode filter shared by both Installed and Discover banners. There is no
@@ -87,6 +88,25 @@ export function ModelManager() {
const filteredModels = models.filter((m: AIModel) => m.type === installedMode)
+ // d37d7bf5 + neejuh (2.5.5): "models show installed in Discover but the
+ // Installed tab is empty and I can't select them." Image/video models are
+ // enumerated live from ComfyUI's /object_info — when ComfyUI isn't running,
+ // fetchModels gets zero of them, so the Installed section looks empty even
+ // though the files are on disk (the Discover "installed" badge comes from the
+ // download record, a different source — hence the mismatch). Detect that case
+ // with a ONE-SHOT reachability check (never a poll — keep the app light, #70)
+ // so we can show the real reason instead of a misleading "no models installed".
+ const [comfyReachable, setComfyReachable] = useState<boolean | null>(null)
+ const imageOrVideo = installedMode === 'image' || installedMode === 'video'
+ useEffect(() => {
+ if (!(tab === 'installed' && imageOrVideo && filteredModels.length === 0)) return
+ let alive = true
+ checkComfyConnection()
+ .then((ok) => { if (alive) setComfyReachable(ok) })
+ .catch(() => { if (alive) setComfyReachable(false) })
+ return () => { alive = false }
+ }, [tab, imageOrVideo, filteredModels.length])
+
// ── Render ──────────────────────────────────────────────────────
return (
@@ -216,7 +236,25 @@ export function ModelManager() {
<div className="max-w-4xl mx-auto">
{tab === 'installed' && (
<>
- {models.length === 0 ? (
+ {imageOrVideo && filteredModels.length === 0 && comfyReachable === false ? (
+ <div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
+ <div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
+ {installedMode === 'video' ? <Video size={22} className="text-gray-400 dark:text-gray-500" /> : <Image size={22} className="text-gray-400 dark:text-gray-500" />}
+ </div>
+ <div className="space-y-1">
+ <p className="text-[0.75rem] font-medium text-gray-800 dark:text-gray-200">Start ComfyUI to see your {installedMode} models</p>
+ <p className="text-[0.6rem] text-gray-500 max-w-[300px] leading-relaxed">
+ {installedMode === 'image' ? 'Image' : 'Video'} models are served by ComfyUI, which isn't running right now — so the ones you've downloaded can't be listed yet. Open the Create tab and start ComfyUI (the power button next to the model picker), then come back.
+ </p>
+ </div>
+ <button
+ onClick={() => setView('create')}
+ className="flex items-center gap-1.5 mt-1 px-3 py-1.5 rounded-md bg-gray-900 dark:bg-white/10 hover:bg-gray-800 dark:hover:bg-white/15 text-white text-[0.65rem] font-medium transition-colors"
+ >
+ <Sparkles size={11} /> Go to Create
+ </button>
+ </div>
+ ) : models.length === 0 ? (
<div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
<div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
<PackageOpen size={22} className="text-gray-400 dark:text-gray-500" />
diff --git a/src/components/models/ModelSelector.tsx b/src/components/models/ModelSelector.tsx
index d6127c61..626558d1 100644
--- a/src/components/models/ModelSelector.tsx
+++ b/src/components/models/ModelSelector.tsx
@@ -11,6 +11,17 @@ import { listLoadedLmStudioModels, loadLmStudioModel, unloadLmStudioModel } from
import { isLmStudioProvider } from '../../lib/hf-to-provider'
import type { AIModel } from '../../types/models'
+// True when `prev` already holds exactly the names in `next`. Lets the 1.5 s
+// loaded-state poll bail out of a state update (return the SAME Set ref) when
+// nothing changed, so React skips the re-render instead of reconciling the whole
+// dropdown every tick — the common case once the user has stopped loading models
+// (vedaiorobotics GH #70: "interface laggy, even when loading models").
+function sameStringSet(prev: Set<string>, next: string[]): boolean {
+ if (prev.size !== next.length) return false
+ for (const n of next) if (!prev.has(n)) return false
+ return true
+}
+
// ── Bug Q (v2.4.7 — wakeywakeynow GH #41) ─────────────────────
//
// Symptom: user has LM Studio installed with models on disk, opens LU's
@@ -379,6 +390,10 @@ export function ModelSelector() {
setSelectError(null) // fresh open — drop any stale auto-load error
let cancelled = false
const refresh = () => {
+ // Skip the tick entirely while the window is hidden/minimized — there's
+ // nothing to repaint and we re-sync the moment it's visible again. Stops a
+ // backgrounded app from hitting Ollama / LM Studio every 1.5 s (#70).
+ if (typeof document !== 'undefined' && document.hidden) return
// Only probe LM Studio's loaded-state when LM Studio models are actually
// listed. When its server is down there are NO LM Studio rows, so this
// skips the probe entirely — removing the last frontend reason the
@@ -389,17 +404,22 @@ export function ModelSelector() {
isLmStudioProvider(('providerName' in m && (m as any).providerName) as string | undefined),
)
if (hasLmsRows) {
- void listLoadedLmStudioModels().then((list) => { if (!cancelled) setLmsLoaded(new Set(list)) }).catch(() => {})
+ void listLoadedLmStudioModels().then((list) => { if (!cancelled) setLmsLoaded((prev) => sameStringSet(prev, list) ? prev : new Set(list)) }).catch(() => {})
} else if (!cancelled) {
setLmsLoaded((prev) => (prev.size ? new Set() : prev))
}
- void listRunningModels().then((list) => { if (!cancelled) setOllamaLoaded(new Set(list)) }).catch(() => {})
+ void listRunningModels().then((list) => { if (!cancelled) setOllamaLoaded((prev) => sameStringSet(prev, list) ? prev : new Set(list)) }).catch(() => {})
}
refresh()
const id = setInterval(refresh, 1500)
+ // Re-sync immediately when the user comes back to the window (the hidden
+ // ticks above were skipped, so the loaded-state could be stale).
+ const onVisible = () => { if (typeof document !== 'undefined' && !document.hidden) refresh() }
+ document.addEventListener('visibilitychange', onVisible)
return () => {
cancelled = true
clearInterval(id)
+ document.removeEventListener('visibilitychange', onVisible)
}
}, [open])