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(create): das Standbild bekommt einen ehrlichen Decode-Text

Davidccba07d0da63
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 64438bc2..31054193 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -41,9 +41,9 @@ import {
import { cpuCauseSuffix } from '../lib/render-budget'
import {
comfyWS, CLIENT_ID,
- LOADER_NODES, CLIP_LOADER_NODES, VAE_LOADER_NODES, SAMPLER_NODES, DECODE_NODES,
type ComfyWSEvent,
} from '../api/comfyui-ws'
+import { phaseForExecutingNode, phaseForProgressStep } from '../lib/render-phase-labels'
import { buildDynamicWorkflow, buildLocalOpWorkflow, checkVideoOutputCapability } from '../api/dynamic-workflow'
import { getAllNodeInfo, clearNodeCache } from '../api/comfyui-nodes'
import { restartComfyForNewNodes } from '../api/comfy-restart'
@@ -1193,29 +1193,20 @@ export function useCreate() {
break
}
const classType = nodeClassMap.get(nodeId) || ''
- if (LOADER_NODES.has(classType)) {
- st.setProgressPhase('loading-model')
- setPhase(15, 'Loading model...')
- } else if (CLIP_LOADER_NODES.has(classType)) {
- st.setProgressPhase('loading-clip')
- setPhase(25, 'Loading text encoder...')
- } else if (VAE_LOADER_NODES.has(classType)) {
- st.setProgressPhase('loading-vae')
- setPhase(30, 'Loading VAE...')
- } else if (SAMPLER_NODES.has(classType)) {
- st.setProgressPhase('sampling')
- setPhase(35, 'Sampling...')
- } else if (DECODE_NODES.has(classType)) {
- st.setProgressPhase('decoding')
- setPhase(90, 'Decoding frames, the last long stretch...')
+ const step = phaseForExecutingNode(classType, mode === 'video' ? 'video' : 'image')
+ if (step) {
+ st.setProgressPhase(step.phase)
+ setPhase(step.pct, step.label)
}
break
}
case 'progress': {
const { value, max } = event.data
- const stepPct = 35 + (value / max) * 55 // 35% to 90%
- st.setProgressPhase('sampling')
- setPhase(Math.round(stepPct), `Sampling step ${value}/${max}...`)
+ const step = phaseForProgressStep(value, max, st.progressPhase)
+ if (step) {
+ st.setProgressPhase(step.phase)
+ setPhase(step.pct, step.label)
+ }
break
}
case 'execution_complete': {
diff --git a/src/lib/__tests__/render-phase-labels.test.ts b/src/lib/__tests__/render-phase-labels.test.ts
new file mode 100644
index 00000000..e9b337a5
--- /dev/null
+++ b/src/lib/__tests__/render-phase-labels.test.ts
@@ -0,0 +1,57 @@
+/**
+ * R16 Befund 3, measured on the Windows box (2026-08-30, 12 GB GPU, 16 GB RAM,
+ * z_image_bf16 at 11.46 GB), five image runs: a STILL IMAGE was told "Decoding
+ * frames, the last long stretch...". It has no frames, and that section ran
+ * 2.5 s to 3.7 s, the shortest of the whole render, not the longest.
+ *
+ * Run: npx vitest run src/lib/__tests__/render-phase-labels.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 { phaseForExecutingNode } from '../render-phase-labels'
+
+const here = dirname(fileURLToPath(import.meta.url))
+const repo = resolve(here, '../../..')
+const read = (rel: string) => readFileSync(resolve(repo, rel), 'utf8')
+
+describe('the decode phase (Befund 3)', () => {
+ it('an image decodes an image, not frames', () => {
+ const step = phaseForExecutingNode('VAEDecode', 'image')
+ expect(step).toEqual({ phase: 'decoding', pct: 90, label: 'Decoding image...' })
+ expect(phaseForExecutingNode('VAEDecodeTiled', 'image')?.label).toBe('Decoding image...')
+ })
+
+ it('a video still decodes frames, because a video has them', () => {
+ expect(phaseForExecutingNode('VAEDecode', 'video')?.label).toBe('Decoding frames...')
+ })
+
+ it('NEGATIVE: no lane claims this is the long stretch', () => {
+ // Never measured, and measured false for image: 2.5 s to 3.7 s, the
+ // shortest section of all five runs.
+ for (const mode of ['image', 'video'] as const) {
+ const label = phaseForExecutingNode('VAEDecode', mode)!.label
+ expect(label).not.toMatch(/long|longest|last|slow|almost there/i)
+ }
+ })
+
+ it('NEGATIVE: an image is never told about frames', () => {
+ expect(phaseForExecutingNode('VAEDecode', 'image')!.label).not.toMatch(/frame/i)
+ })
+})
+
+describe('the Create tab uses this module and holds no labels of its own', () => {
+ it('useCreate asks for the phase instead of writing one', () => {
+ const src = read('src/hooks/useCreate.ts')
+ expect(src).toMatch(/import \{ phaseForExecutingNode, phaseForProgressStep \} from '\.\.\/lib\/render-phase-labels'/)
+ expect(src).toMatch(/phaseForExecutingNode\(classType, mode === 'video' \? 'video' : 'image'\)/)
+ expect(src).toMatch(/phaseForProgressStep\(value, max, st\.progressPhase\)/)
+ })
+
+ it('NEGATIVE: the wrong line is gone from the hook', () => {
+ const src = read('src/hooks/useCreate.ts')
+ expect(src).not.toContain('Decoding frames, the last long stretch')
+ })
+})
diff --git a/src/lib/render-phase-labels.ts b/src/lib/render-phase-labels.ts
new file mode 100644
index 00000000..8f9ac48a
--- /dev/null
+++ b/src/lib/render-phase-labels.ts
@@ -0,0 +1,73 @@
+/**
+ * What the Create tab is allowed to say a local render is doing right now.
+ *
+ * The waiting area used to name its phases straight from ComfyUI's `executing`
+ * events, and one of those names was wrong on the machine it was shown on.
+ * R16 Befund 3, re-measured on the Windows box (2026-08-30, 12 GB GPU, 16 GB
+ * RAM, z_image_bf16 at 11.46 GB): a still image showed "Decoding frames, the
+ * last long stretch". There are no frames in a still image, and that stretch
+ * was not long: it ran 2.5 s to 3.7 s and was the SHORTEST section of every
+ * one of the five runs. Two claims, both false, in one line.
+ *
+ * This is text and phase policy, nothing else, so it lives here as plain
+ * functions instead of inside useCreate's 300 line WS closure where the only
+ * way to test it is to drive a whole render.
+ */
+
+import type { ProgressPhase } from '../stores/createStore'
+import {
+ LOADER_NODES, CLIP_LOADER_NODES, VAE_LOADER_NODES, SAMPLER_NODES, DECODE_NODES,
+} from '../api/comfyui-ws'
+
+/** Which of the two Create lanes a render belongs to. */
+export type RenderMode = 'image' | 'video'
+
+/** One settled statement about the render: the phase, the bar, the words. */
+export interface RenderPhaseStep {
+ phase: ProgressPhase
+ pct: number
+ label: string
+}
+
+/**
+ * The phase a node ComfyUI just entered puts the render in, or null when the
+ * node says nothing worth a label (a text encode, a save, a resize).
+ */
+export function phaseForExecutingNode(classType: string, mode: RenderMode): RenderPhaseStep | null {
+ if (LOADER_NODES.has(classType)) {
+ return { phase: 'loading-model', pct: 15, label: 'Loading model...' }
+ }
+ if (CLIP_LOADER_NODES.has(classType)) {
+ return { phase: 'loading-clip', pct: 25, label: 'Loading text encoder...' }
+ }
+ if (VAE_LOADER_NODES.has(classType)) {
+ return { phase: 'loading-vae', pct: 30, label: 'Loading VAE...' }
+ }
+ if (SAMPLER_NODES.has(classType)) {
+ return { phase: 'sampling', pct: 35, label: 'Sampling...' }
+ }
+ if (DECODE_NODES.has(classType)) {
+ // Befund 3. A still image has no frames, and nothing here is known to be
+ // the longest stretch: on the box it was the shortest one measured. The
+ // video wording keeps "frames" because a video decode does produce them,
+ // and drops the superlative, which was never measured for video either.
+ return {
+ phase: 'decoding',
+ pct: 90,
+ label: mode === 'video' ? 'Decoding frames...' : 'Decoding image...',
+ }
+ }
+ return null
+}
+
+/** The phase a reported sampling step puts the render in. */
+export function phaseForProgressStep(
+ value: number,
+ max: number,
+ current: ProgressPhase,
+): RenderPhaseStep | null {
+ void current
+ if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) return null
+ const pct = Math.round(35 + (value / max) * 55) // 35% to 90%
+ return { phase: 'sampling', pct, label: `Sampling step ${value}/${max}...` }
+}