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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(create): der kalte ComfyUI-Start erklaert sich im Wartebereich
purple556eb7eec4a4
diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsxindex e029b121..41971038 100644--- a/src/components/create/experimental/OutputView.tsx+++ b/src/components/create/experimental/OutputView.tsx@@ -1,5 +1,7 @@+import { useEffect, useState } from 'react'import { motion } from 'framer-motion'import { Cpu, Sparkles, ImageDown, Maximize2, Download, Wand2, MonitorOff, AudioLines } from 'lucide-react'+import { coldLoadHint } from '../../../lib/cold-load-notice'import { useCreateStore, type GalleryItem, type ProgressPhase } from '../../../stores/createStore'import { backendCall, downloadComfyFile, isTauri } from '../../../api/backend'import { isMlxImageHost } from '../../../api/mlx-image'@@ -22,6 +24,31 @@ function phaseIcon(phase: ProgressPhase) {return <Sparkles size={20} className="text-gray-400" />}+/**+ * The line that explains a long load phase (R14 Nebenbefund 3: the first+ * render after a ComfyUI start sat 57 s in `Loading model...` with nothing on+ * screen saying why).+ *+ * Its own component on purpose. It is mounted only while the load phase runs,+ * so its clock starts with the phase and is thrown away with it, and there is+ * no reset to get wrong. The three loader phases are one stretch to the parent,+ * so a checkpoint handing over to the text encoder does not restart the count.+ * coldLoadHint stays silent until the wait is long enough to be worth a word.+ *+ * The line names ComfyUI, so the Mac never draws it: local media there is MLX+ * in the app's own process, and its short load phase has no ComfyUI behind it.+ */+function ColdLoadLine() {+ const [elapsedMs, setElapsedMs] = useState(0)+ useEffect(() => {+ const id = setInterval(() => setElapsedMs((ms) => ms + 1000), 1000)+ return () => clearInterval(id)+ }, [])+ const hint = coldLoadHint(true, elapsedMs)+ if (!hint) return null+ return <p className="t-body text-gray-500 text-center max-w-[22rem]">{hint}</p>+}+// Generation progress — phase-aware animation.export function GeneratingView() {const progressPhase = useCreateStore((s) => s.progressPhase)@@ -55,6 +82,7 @@ export function GeneratingView() {)}</div><p className="t-body text-gray-400 tracking-wide">{progressText || 'Generating…'}</p>+ {isLoading && !isMlxImageHost() && <ColdLoadLine />}{progress > 0 && (<div className="w-56 h-1 bg-white/10 rounded-full overflow-hidden"><motion.div className="h-full rounded-full bg-lu-accent" initial={{ width: 0 }} animate={{ width: `${Math.min(progress, 100)}%` }} transition={{ duration: 0.3 }} />diff --git a/src/lib/__tests__/cold-load-notice.test.ts b/src/lib/__tests__/cold-load-notice.test.tsnew file mode 100644index 00000000..2d3e6d45--- /dev/null+++ b/src/lib/__tests__/cold-load-notice.test.ts@@ -0,0 +1,88 @@+/**+ * R14 Nebenbefund 3 (2026-08-30, ergebnis-r14-nachmessung.md): straight after a+ * ComfyUI restart, a healthy GPU render sat in `Loading model...` from 0 s to+ * 57 s, about 117 s to the finished picture, and the waiting area explained+ * none of it. R13 measured 0 s to 7 s for the same phase on a warm ComfyUI, so+ * the difference is the cold start and not the card.+ *+ * The load phase was already distinguishable from sampling: ComfyUI's WS+ * `executing` events drive createStore's `loading-model`, `loading-clip` and+ * `loading-vae` against `sampling`, and useCreate has mapped them for a long+ * time. No new channel, just a line in the waiting area once the load has run+ * long enough to be worth a word.+ *+ * Run: npx vitest run src/lib/__tests__/cold-load-notice.test.ts+ */+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'+import { fileURLToPath } from 'node:url'+import { dirname, resolve } from 'node:path'++import { coldLoadHint, COLD_LOAD_HINT, COLD_LOAD_HINT_AFTER_MS } from '../cold-load-notice'++const here = dirname(fileURLToPath(import.meta.url))+const repo = resolve(here, '../../..')+const read = (rel: string) => readFileSync(resolve(repo, rel), 'utf8')++describe('coldLoadHint', () => {+ it('explains a load that has run long enough to worry someone', () => {+ expect(coldLoadHint(true, 57_000)).toBe(COLD_LOAD_HINT)+ expect(coldLoadHint(true, COLD_LOAD_HINT_AFTER_MS)).toBe(COLD_LOAD_HINT)+ })++ it('NEGATIVE: says nothing while the wait is still ordinary', () => {+ // R13's warm range, 0 s to 7 s. Nobody needs a paragraph for that.+ expect(coldLoadHint(true, 0)).toBe('')+ expect(coldLoadHint(true, 7_000)).toBe('')+ expect(coldLoadHint(true, COLD_LOAD_HINT_AFTER_MS - 1)).toBe('')+ })++ it('NEGATIVE: says nothing outside the load phase, however long it runs', () => {+ // Sampling for ten minutes is a slow render, not a cold start, and the+ // line would be a false explanation there.+ expect(coldLoadHint(false, 600_000)).toBe('')+ expect(coldLoadHint(false, 0)).toBe('')+ // A broken clock cannot talk us into it either.+ expect(coldLoadHint(true, Number.NaN)).toBe('')+ })++ it('is English, promises nothing it cannot know, and carries no dash', () => {+ expect(COLD_LOAD_HINT).toMatch(/^Loading the model into memory\./)+ expect(COLD_LOAD_HINT).toContain('ComfyUI start')+ // It must not claim to count jobs. LU has no such counter in this view,+ // so "this is the first job" would be an invention.+ expect(COLD_LOAD_HINT).not.toMatch(/this is the first/i)+ // en dash and em dash, written as escapes so this file carries neither.+ expect(COLD_LOAD_HINT).not.toMatch(/[\u2013\u2014]/)+ })+})++describe('the Create tab waiting area', () => {+ it('times the load stretch and renders the line from the shared constant', () => {+ const view = read('src/components/create/experimental/OutputView.tsx')+ expect(view).toMatch(/import \{ coldLoadHint \} from '\.\.\/\.\.\/\.\.\/lib\/cold-load-notice'/)+ expect(view).toMatch(/const hint = coldLoadHint\(true, elapsedMs\)/)+ // Mounted only for the load stretch, which is where its clock comes from:+ // it starts with the phase and is discarded with it. The three loader+ // phases are one `isLoading`, so a checkpoint handing over to the text+ // encoder does not restart the count.+ expect(view).toMatch(/\{isLoading && !isMlxImageHost\(\) && <ColdLoadLine \/>\}/)+ expect(view).toMatch(/const isLoading = progressPhase === 'loading-model' \|\| progressPhase === 'loading-clip' \|\| progressPhase === 'loading-vae'/)+ })++ it('NEGATIVE: the line is not pasted into the component', () => {+ const view = read('src/components/create/experimental/OutputView.tsx')+ expect(view).not.toContain('Loading the model into memory')+ })++ it('NEGATIVE: the cloud and the Mac never see a sentence about ComfyUI', () => {+ // The Mac renders local media with MLX in the app's own process and has no+ // ComfyUI at all, so the line is gated off there.+ const view = read('src/components/create/experimental/OutputView.tsx')+ expect(view).toMatch(/!isMlxImageHost\(\)/)+ // A cloud job never enters a load phase: useCloudCreate only ever sets+ // queued, sampling and complete, so `isLoading` is false for all of them.+ const cloud = read('src/hooks/useCloudCreate.ts')+ expect(cloud).not.toMatch(/setProgressPhase\('loading-/)+ })+})diff --git a/src/lib/cold-load-notice.ts b/src/lib/cold-load-notice.tsnew file mode 100644index 00000000..18fcb937--- /dev/null+++ b/src/lib/cold-load-notice.ts@@ -0,0 +1,52 @@+/**+ * The line that explains a long load phase in the Create tab's waiting area.+ *+ * R14 Nebenbefund 3 (2026-08-30, ergebnis-r14-nachmessung.md): straight after a+ * ComfyUI restart, a healthy GPU render sat in `Loading model...` from 0 s to+ * 57 s and needed about 117 s in total. R13 measured 0 s to 7 s for the same+ * phase on a warm ComfyUI. Nothing was broken, the checkpoint was simply being+ * read from disk for the first time, and the waiting area said nothing about+ * it. Two minutes of silence on a working card reads as a hang.+ *+ * No new channel was needed. ComfyUI's own WS `executing` events already tell+ * the load phase from the sampling phase (createStore's `loading-model`,+ * `loading-clip` and `loading-vae` against `sampling`), and useCreate has+ * mapped them since long before this round.+ *+ * Honesty rules this file:+ *+ * - The line appears only AFTER the load has run long enough to be worth+ * explaining. A warm load finishes inside the R13 range and never shows a+ * word, so the notice cannot become background noise.+ * - It never claims to know that THIS is the first job after a start. LU has+ * no such counter here. It names the cold start as the usual reason for a+ * long load, which is what the user needs, and says what happens next.+ */++/**+ * How long the load phase may run before it gets explained.+ *+ * R13 measured 0 s to 7 s for a warm load, so 12 s is clear of a healthy warm+ * start and far below the 57 s that raised the finding.+ */+export const COLD_LOAD_HINT_AFTER_MS = 12_000++/** The line itself. Said once, so the component cannot drift from the test. */+export const COLD_LOAD_HINT =+ 'Loading the model into memory. The first render after a ComfyUI start waits the longest, later ones reuse the loaded model.'++/**+ * The notice for a waiting area, or '' when there is nothing to say.+ *+ * `loading` is true only in the model, text encoder and VAE load phases;+ * `elapsedMs` is how long that stretch has been running.+ */+export function coldLoadHint(+ loading: boolean,+ elapsedMs: number,+ afterMs: number = COLD_LOAD_HINT_AFTER_MS,+): string {+ if (!loading) return ''+ if (!Number.isFinite(elapsedMs) || elapsedMs < afterMs) return ''+ return COLD_LOAD_HINT+}