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): the Cutout stage names its model, its download and its result as they are

purpleae97f4bbe445
diff --git a/src/api/__tests__/cutout-model.test.ts b/src/api/__tests__/cutout-model.test.ts
new file mode 100644
index 00000000..c3eb9632
--- /dev/null
+++ b/src/api/__tests__/cutout-model.test.ts
@@ -0,0 +1,79 @@
+/**
+ * The box, 04.10.2026: the Cutout card said "~300 MB", the node fetched
+ * 884 878 856 bytes, and it did so inside the first run while the Stage said
+ * "Queued...". One module now holds the model, its measured size and the
+ * question whether it is on the drive.
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+const backendCall = vi.hoisted(() => vi.fn())
+const target = vi.hoisted(() => ({ remote: false }))
+vi.mock('../backend', () => ({ backendCall }))
+vi.mock('../discover', () => ({ comfyModelTarget: async () => target }))
+
+import { cutoutDownloadLine, cutoutModelOf, DEFAULT_CUTOUT_MODEL, DEFAULT_CUTOUT_MODEL_SIZE } from '../cutout-model'
+
+const LINE = 'Downloading the cutout model (885 MB), first run only...'
+const graph = (model?: unknown) => ({
+ '1': { class_type: 'LoadImage', inputs: { image: 'a.png' } },
+ '2': { class_type: 'RMBG', inputs: { image: ['1', 0], ...(model === undefined ? {} : { model }) } },
+ '3': { class_type: 'SaveImage', inputs: { images: ['2', 0] } },
+})
+
+beforeEach(() => {
+ backendCall.mockReset()
+ target.remote = false
+})
+
+describe('the size the card names', () => {
+ it('is the measured one', () => {
+ expect(DEFAULT_CUTOUT_MODEL).toBe('RMBG-2.0')
+ expect(DEFAULT_CUTOUT_MODEL_SIZE).toBe('885 MB')
+ })
+})
+
+describe('cutoutModelOf', () => {
+ it('reads the model off the RMBG node', () => {
+ expect(cutoutModelOf(graph('RMBG-2.0') as never)).toBe('RMBG-2.0')
+ expect(cutoutModelOf(graph('BEN2') as never)).toBe('BEN2')
+ })
+ it('is undefined without the node or without a model widget', () => {
+ expect(cutoutModelOf(graph() as never)).toBeUndefined()
+ expect(cutoutModelOf({ '1': { class_type: 'KSampler', inputs: { model: ['4', 0] } } } as never)).toBeUndefined()
+ })
+})
+
+describe('cutoutDownloadLine', () => {
+ it('says the download when the model file is not on the drive', async () => {
+ backendCall.mockResolvedValue([{ filename: 'RMBG-2.0/model.safetensors', exists: false, complete: false }])
+ expect(await cutoutDownloadLine('RMBG-2.0')).toBe(LINE)
+ expect(backendCall).toHaveBeenCalledWith('check_model_sizes', {
+ files: [{ subfolder: 'RMBG', filename: 'RMBG-2.0/model.safetensors', expectedBytes: 884_878_856 }],
+ })
+ })
+ it('says it for a file that broke off early too', async () => {
+ backendCall.mockResolvedValue([{ exists: true, complete: false }])
+ expect(await cutoutDownloadLine('RMBG-2.0')).toBe(LINE)
+ })
+ it('says nothing when the file is there', async () => {
+ backendCall.mockResolvedValue([{ exists: true, complete: true }])
+ expect(await cutoutDownloadLine('RMBG-2.0')).toBeNull()
+ })
+ it('says nothing about a model it has no measured size for, and does not ask', async () => {
+ expect(await cutoutDownloadLine('BEN2')).toBeNull()
+ expect(await cutoutDownloadLine(undefined)).toBeNull()
+ expect(backendCall).not.toHaveBeenCalled()
+ })
+ it('says nothing for a ComfyUI on another machine, whose drive it cannot see', async () => {
+ target.remote = true
+ expect(await cutoutDownloadLine('RMBG-2.0')).toBeNull()
+ expect(backendCall).not.toHaveBeenCalled()
+ })
+ it('says nothing when the backend does not answer', async () => {
+ backendCall.mockRejectedValue(new Error('no such command'))
+ expect(await cutoutDownloadLine('RMBG-2.0')).toBeNull()
+ })
+ it('carries no dash', () => {
+ expect(LINE).not.toMatch(/[–—]/)
+ })
+})
diff --git a/src/api/cutout-model.ts b/src/api/cutout-model.ts
new file mode 100644
index 00000000..08457538
--- /dev/null
+++ b/src/api/cutout-model.ts
@@ -0,0 +1,63 @@
+// The model behind Cutout (Remove Background), and whether it is on the drive.
+//
+// The ComfyUI-RMBG node fetches its model itself, inside the first run, and
+// says nothing while it does. On the box (04.10.2026) that was 160 seconds of
+// "Queued... Ns" for an 885 MB file the card had announced as "~300 MB".
+// One place for the name, the size and the question, so the setup card, the
+// waiting line and the result footer cannot disagree again.
+
+import { backendCall } from './backend'
+import { comfyModelTarget } from './discover'
+import { apiNodes, type ComfyApiGraph } from '../types/comfy-graph'
+
+interface CutoutModelFile {
+ /** Folder under ComfyUI's models directory, and the file inside it. */
+ subfolder: string
+ file: string
+ bytes: number
+}
+
+/** Measured: models\RMBG\RMBG-2.0\model.safetensors, 884 878 856 bytes
+ * (04.10.2026, the box). Only models with a measured size are listed; for
+ * any other the app says nothing about a download it cannot size. */
+const CUTOUT_MODEL_FILES: Record<string, CutoutModelFile> = {
+ 'RMBG-2.0': { subfolder: 'RMBG', file: 'RMBG-2.0/model.safetensors', bytes: 884_878_856 },
+}
+
+/** The model the node picks when nobody chooses: the one the setup card names. */
+export const DEFAULT_CUTOUT_MODEL = 'RMBG-2.0'
+
+const megabytes = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`
+
+/** "885 MB", for the setup card. */
+export const DEFAULT_CUTOUT_MODEL_SIZE = megabytes(CUTOUT_MODEL_FILES[DEFAULT_CUTOUT_MODEL].bytes)
+
+/** The model a cutout graph runs on: the RMBG node's own `model` widget. */
+export function cutoutModelOf(workflow: ComfyApiGraph): string | undefined {
+ for (const [, node] of apiNodes(workflow)) {
+ if (node.class_type !== 'RMBG') continue
+ const model = node.inputs?.model
+ return typeof model === 'string' && model ? model : undefined
+ }
+ return undefined
+}
+
+/**
+ * The line for the wait while the node fetches its model, or null when the
+ * model is on the drive, is one the app has no size for, or cannot be looked
+ * at from here (a ComfyUI on another machine, a backend that does not answer).
+ */
+export async function cutoutDownloadLine(model: string | undefined): Promise<string | null> {
+ const known = model ? CUTOUT_MODEL_FILES[model] : undefined
+ if (!known) return null
+ try {
+ if ((await comfyModelTarget()).remote) return null
+ const [found] = await backendCall<Array<{ exists: boolean; complete: boolean }>>('check_model_sizes', {
+ files: [{ subfolder: known.subfolder, filename: known.file, expectedBytes: known.bytes }],
+ })
+ if (!found || (found.exists && found.complete)) return null
+ return `Downloading the cutout model (${megabytes(known.bytes)}), first run only...`
+ } catch {
+ return null
+ }
+}
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsx
index b8070708..98c81e11 100644
--- a/src/components/create/experimental/CreateExperimental.tsx
+++ b/src/components/create/experimental/CreateExperimental.tsx
@@ -1,4 +1,4 @@
-import { Suspense, lazy, useCallback, useEffect, useRef, useState } from 'react'
+import { Suspense, lazy, useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'
import { AnimatePresence, motion } from 'framer-motion'
import { AlertTriangle, Cloud, Cpu } from 'lucide-react'
import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
@@ -7,6 +7,8 @@ import { useComfyNoticeStore } from '../../../stores/comfyNoticeStore'
import { loadComfyCorsSignature, shouldShowCorsNotice } from '../../../lib/comfy-cors-notice'
import { comfyIdleNotice, shouldWatchComfyIdle, IDLE_WATCH_INTERVAL_MS, IDLE_STARTING } from '../../../lib/comfy-idle-watch'
import type { ComfyGuardStatus } from '../../../lib/comfy-restart-guard'
+import { anyInstallRunning, subscribeInstallRuns } from '../../../lib/model-install-runs'
+import { useComfyInstallStore } from '../../../stores/comfyInstallStore'
import { useWorkflowStore } from '../../../stores/workflowStore'
import { CreateExpProvider, useCreateExp } from './CreateContext'
import { IntentBar } from './IntentBar'
@@ -161,6 +163,12 @@ function CreateExperimentalInner() {
// A glance every 30s while this tab is open and idle, no restart of its own:
// holding an engine warm for work nobody asked for costs RAM and VRAM, and
// the render path already fixes it on demand. Wording in lib/comfy-idle-watch.
+ //
+ // Silent while LU restarts ComfyUI itself: the setup card or the update line
+ // is already saying what happens, and the look comes back when it is done.
+ const setupRunning = useSyncExternalStore(subscribeInstallRuns, anyInstallRunning)
+ const comfyUpdating = useComfyInstallStore((s) => s.phase !== 'idle' && s.phase !== 'error')
+ const luIsRestartingComfy = setupRunning || comfyUpdating || corsFixing
const [idleNotice, setIdleNotice] = useState('')
const idleTimerRef = useRef<(() => void) | null>(null)
useEffect(() => {
@@ -169,7 +177,7 @@ function CreateExperimentalInner() {
void (async () => {
const { isMacOS } = await import('../../../api/backend')
if (cancelled) return
- if (!shouldWatchComfyIdle(backend === 'local', isMacOS(), isGenerating)) { clear(); return }
+ if (!shouldWatchComfyIdle(backend === 'local', isMacOS(), isGenerating, luIsRestartingComfy)) { clear(); return }
const { backendCall } = await import('../../../api/backend')
const look = async () => {
const st = await backendCall<ComfyGuardStatus>('comfyui_status').catch(() => null)
@@ -180,7 +188,7 @@ function CreateExperimentalInner() {
idleTimerRef.current = () => clearInterval(timer)
})()
return () => { cancelled = true; idleTimerRef.current?.(); idleTimerRef.current = null }
- }, [backend, isGenerating])
+ }, [backend, isGenerating, luIsRestartingComfy])
const fixCorsForMe = useCallback(async () => {
setCorsFixing(true)
diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsx
index 6a385444..8f272434 100644
--- a/src/components/create/experimental/OutputView.tsx
+++ b/src/components/create/experimental/OutputView.tsx
@@ -1,5 +1,5 @@
import { itemHasAlpha } from '../../../lib/transparent-image'
-import { useEffect, useMemo, useState } from 'react'
+import { Fragment, useEffect, useMemo, useState, type ReactNode } from 'react'
import { motion } from 'framer-motion'
import { Cpu, Sparkles, ImageDown, Maximize2, Download, Wand2, MonitorOff, AudioLines, Film, Trash2, UserRoundPlus } from 'lucide-react'
import { coldLoadHint } from '../../../lib/cold-load-notice'
@@ -13,6 +13,7 @@ import { PromptDetails } from './PromptDetails'
import { markGalleryItemAvailable } from './galleryUrl'
import { downloadGalleryItem } from './galleryDownload'
import { galleryLabel } from '../../../lib/render/gallery-label'
+import { resultFacts } from '../../../lib/render/result-facts'
import { useComfyMedia } from './useComfyMedia'
import { BatchQueue } from './BatchStrip'
import { cn } from '../ui/cn'
@@ -143,6 +144,9 @@ interface ResultProps {
onAnimate?: () => void
/** Pick frames of this finished video and save them as a character. */
onSaveCharacter?: () => void
+ /** Under the result, in the same column: on a tool that works from a source
+ * image, the way to the next image (Stage's ResultSourceActions). */
+ footer?: ReactNode
}
@@ -159,7 +163,7 @@ function reconcileDims(item: GalleryItem, w: number, h: number) {
}
}
-export function ResultView({ item, onFullscreen, onSendToEditor, onAnimate, onSaveCharacter }: ResultProps) {
+export function ResultView({ item, onFullscreen, onSendToEditor, onAnimate, onSaveCharacter, footer }: ResultProps) {
const { src: url, onError } = useComfyMedia(item)
const download = () => void downloadGalleryItem(item)
const isVideo = item.type === 'video'
@@ -232,16 +236,13 @@ export function ResultView({ item, onFullscreen, onSendToEditor, onAnimate, onSa
</IconBtn>
</div>
</div>
- <div className="flex items-center gap-3 mt-3 t-mono text-gray-600">
- {!isAudio && (
- <>
- <span>{item.width}×{item.height}</span>
- <span>·</span>
- <span>seed {item.seed}</span>
- <span>·</span>
- </>
- )}
- <span className="truncate max-w-[280px]">{prettyModel(item.model)}</span>
+ <div className="flex items-center gap-3 mt-3 t-mono text-gray-600" data-testid="result-facts">
+ {resultFacts(item).map((fact, i, all) => (
+ <Fragment key={fact}>
+ <span className={i === all.length - 1 ? 'truncate max-w-[280px]' : undefined}>{fact}</span>
+ {i < all.length - 1 && <span>·</span>}
+ </Fragment>
+ ))}
</div>
{item.sourceName && (
<div className="mt-1 t-mono text-gray-500 truncate max-w-[420px]" data-testid="source-name">from {item.sourceName}</div>
@@ -250,6 +251,7 @@ export function ResultView({ item, onFullscreen, onSendToEditor, onAnimate, onSa
<div className="mt-1 t-mono text-gray-500" data-testid="run-note">{item.runNote}</div>
)}
<PromptDetails item={item} className="mt-2" />
+ {footer}
</div>
</div>
)
@@ -271,4 +273,3 @@ function IconBtn({ children, title, onClick, disabled }: { children: React.React
)
}
-function prettyModel(f: string): string { return f.replace(/\.(safetensors|ckpt|pt)$/i, '').replace(/[_]+/g, ' ') }
diff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsx
index ad74648a..ee517c60 100644
--- a/src/components/create/experimental/Stage.tsx
+++ b/src/components/create/experimental/Stage.tsx
@@ -28,6 +28,7 @@ import { ReferenceStrip } from './ReferenceStrip'
import { BatchStrip, useBatchPickers } from './BatchStrip'
import { addBatchFiles, useBatchOffered } from './batchRun'
import { filesFromDrop } from './batchFiles'
+import { DEFAULT_CUTOUT_MODEL_SIZE } from '../../../api/cutout-model'
import { useReferenceSlots } from './referenceSlots'
import { SavedCharacterChips } from './SavedCharacters'
import { loadPhotosAsReferences, sendPhotosToStudio } from './characterPhotos'
@@ -143,6 +144,7 @@ export function Stage({ displayed, onOpenMaskEditor, onEditResult, onAnimateResu
onSendToEditor={displayed.type === 'image' && onEditResult ? () => onEditResult(displayed) : undefined}
onAnimate={displayed.type === 'image' && onAnimateResult ? () => onAnimateResult(displayed) : undefined}
onSaveCharacter={displayed.type === 'video' && onSaveCharacter ? () => onSaveCharacter(displayed) : undefined}
+ footer={meta.needsSource && source ? <ResultSourceActions /> : undefined}
/>
)
} else {
@@ -442,6 +444,25 @@ function SourcePreview({ onOpenMaskEditor }: { onOpenMaskEditor: () => void }) {
)
}
+/**
+ * Under a finished result on a tool that works from a source image: the same
+ * way to the next image that the source preview offers before the run. The
+ * box, 04.10.2026: after a cutout the only way to load another image was to
+ * leave the tool and come back. "Change image" puts the new image on the
+ * Stage; the list under it adds more for one run over all of them.
+ */
+function ResultSourceActions() {
+ const setSource = useCreateStore((s) => s.setSource)
+ const batchCount = useCreateStore((s) => s.batchSources.length)
+ const batchOn = useBatchOffered() && batchCount > 1
+ return (
+ <div className="flex flex-col items-center mt-3" data-testid="result-source-actions">
+ {!batchOn && <ChangeImageButton onChange={(r) => setSource(r)} />}
+ <BatchStrip />
+ </div>
+ )
+}
+
function ChangeImageButton({ onChange }: { onChange: (r: Awaited<ReturnType<typeof loadImageRef>>) => void }) {
const setError = useCreateStore((s) => s.setError)
const inputRef = useRef<HTMLInputElement>(null)
@@ -520,7 +541,7 @@ const CAP_COPY = {
rmbg: {
icon: Scissors,
title: 'Background removal needs a one-time download',
- description: 'The AI cutout runs fully locally (ComfyUI-RMBG). This installs the node now. The ~300 MB cutout model downloads automatically on your first cutout.',
+ description: `The AI cutout runs fully locally (ComfyUI-RMBG). This installs the node now. The ${DEFAULT_CUTOUT_MODEL_SIZE} cutout model downloads automatically on your first cutout.`,
},
'inpaint-nodes': {
icon: Wand2,
diff --git a/src/components/create/experimental/__tests__/cutout-stage.test.tsx b/src/components/create/experimental/__tests__/cutout-stage.test.tsx
new file mode 100644
index 00000000..281b61db
--- /dev/null
+++ b/src/components/create/experimental/__tests__/cutout-stage.test.tsx
@@ -0,0 +1,145 @@
+// @vitest-environment jsdom
+/**
+ * The Cutout stage after the box run of 04.10.2026:
+ * - the setup card named "~300 MB" for a model that is 885 MB,
+ * - after a result there was no way to load another image but leaving the
+ * tool, while Edit's source preview has "Change image" and the list,
+ * - the line under the result repeated the Image tab's seed and model.
+ */
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
+import { render, cleanup, screen, fireEvent, waitFor } from '@testing-library/react'
+
+vi.mock('../CreateContext', () => ({
+ useCreateExp: () => ({
+ generate: vi.fn(), cancel: vi.fn(), makeVoice: vi.fn(), quota: null,
+ samplerList: [], schedulerList: [], loraList: [], vaeList: [], refreshModelLists: vi.fn(),
+ connected: true, modelsLoaded: true, mlxMissing: false,
+ installCapability: vi.fn(), installModelBundle: vi.fn(),
+ }),
+}))
+vi.mock('../loadImage', () => ({
+ loadImageRef: vi.fn(async (f: File) => ({ filename: `up_${f.name}`, url: `data:image/png;base64,${btoa(f.name)}`, width: 64, height: 64 })),
+}))
+vi.mock('../../../../api/mlx-image', () => ({ isMlxImageHost: () => false }))
+vi.mock('../../../../api/backend', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('../../../../api/backend')>()),
+ openExternal: vi.fn(),
+}))
+vi.mock('../../../../hooks/useCloudCreate', () => ({
+ resolveCharacterModel: () => undefined,
+ takeCloudRunStop: () => null,
+ dataUrlToBlob: (url: string) => new Blob([url], { type: 'image/png' }),
+}))
+
+import { Stage } from '../Stage'
+import { useCreateStore, type GalleryItem } from '../../../../stores/createStore'
+import { useCloudCatalogStore } from '../../../../stores/cloudCatalogStore'
+import { neuerServer } from '../../../../lib/render/__tests__/fixtures/test-catalogs'
+import { resetInstallRuns } from '../../../../lib/model-install-runs'
+
+const png = (name: string) => new File([name], name, { type: 'image/png' })
+const SOURCE = { filename: 'woman-b.png', url: 'data:image/png;base64,AA', width: 512, height: 512 }
+let minted = 0
+
+const result = (over: Partial<GalleryItem>): GalleryItem => ({
+ id: 'r1', type: 'image', filename: 'locally_uncensored_cfc2ss_00001_.png', subfolder: '', prompt: '', negativePrompt: '',
+ model: 'sd_turbo.safetensors', modelType: 'sd15', seed: 697334996, steps: 4, cfgScale: 1, sampler: '', scheduler: '',
+ width: 512, height: 512, batchSize: 1, createdAt: Date.now(), dataUrl: 'data:image/png;base64,AA', ...over,
+})
+
+function start(backend: 'local' | 'cloud', intent: 'edit' | 'removebg' | 'upscale', rmbg = true) {
+ useCreateStore.setState({ backend, caps: { rmbg, 'inpaint-nodes': true } as never })
+ useCreateStore.getState().setIntent(intent)
+}
+const stage = (displayed?: GalleryItem) =>
+ render(<Stage displayed={displayed} onOpenMaskEditor={() => {}} onFullscreen={() => {}} />)
+
+beforeEach(() => {
+ minted = 0
+ vi.stubGlobal('URL', Object.assign(URL, {
+ createObjectURL: vi.fn(() => `blob:test/${++minted}`),
+ revokeObjectURL: vi.fn(),
+ }))
+ resetInstallRuns()
+ useCloudCatalogStore.setState({ models: neuerServer() })
+ useCreateStore.setState({
+ backend: 'local', isGenerating: false, error: null, source: null, mask: null, references: [],
+ batchSources: [], batchRun: null, gallery: [], cloudStudioOptions: {}, cloudStudioCredits: null, cloudImageCount: 1,
+ imageModelList: [{ name: 'sd_turbo.safetensors', type: 'sd15' }] as never, videoModelList: [],
+ })
+})
+afterEach(() => { cleanup() })
+
+describe('the setup card', () => {
+ it('names the size the cutout model really has', () => {
+ start('local', 'removebg', false)
+ stage()
+ const text = document.body.textContent ?? ''
+ expect(text).toContain('The 885 MB cutout model downloads automatically on your first cutout.')
+ expect(text).not.toContain('300 MB')
+ })
+})
+
+describe('after a cutout', () => {
+ const shown = () => {
+ start('local', 'removebg')
+ useCreateStore.getState().setSource(SOURCE as never)
+ const item = result({ intent: 'removebg', toolModel: 'RMBG-2.0', sourceName: 'woman-b.png' })
+ stage(item)
+ }
+
+ it('the line under it says size and cutout model, no seed and no image model', () => {
+ shown()
+ const facts = screen.getByTestId('result-facts').textContent ?? ''
+ expect(facts).toBe('512×512·RMBG-2.0')
+ expect(facts).not.toMatch(/seed|sd turbo/)
+ expect(screen.getByTestId('source-name').textContent).toBe('from woman-b.png')
+ })
+
+ it('offers "Change image" and the list, the way the source preview does', () => {
+ shown()
+ const actions = screen.getByTestId('result-source-actions')
+ expect(actions.textContent).toContain('Change image')
+ expect(actions.textContent).toContain('Add more images')
+ expect(actions.textContent).toContain('Add a folder')
+ })
+
+ it('"Change image" puts the new image on the Stage, ready for the next cutout', async () => {
+ shown()
+ // The result is the newer of the two until the next image arrives.
+ await new Promise((r) => setTimeout(r, 5))
+ const input = screen.getByTestId('result-source-actions').querySelector('input[type="file"]:not([multiple])') as HTMLInputElement
+ fireEvent.change(input, { target: { files: [png('woman-c.png')] } })
+ await waitFor(() => expect(useCreateStore.getState().source?.filename).toBe('up_woman-c.png'))
+ await waitFor(() => expect(document.body.textContent).toContain('Hit Create to cut out the subject'))
+ expect(screen.queryByTestId('result-facts')).toBeNull()
+ })
+
+ it('"Add more images" starts a list for one run over all of them', async () => {
+ shown()
+ const input = screen.getByTestId('batch-files-input') as HTMLInputElement
+ fireEvent.change(input, { target: { files: [png('woman-c.png'), png('woman-d.png')] } })
+ await waitFor(() => expect(useCreateStore.getState().batchSources.length).toBe(3))
+ expect(screen.getByTestId('batch-count').textContent).toContain('3 images')
+ // With a list the single "Change image" steps aside, as under the source.
+ expect(screen.getByTestId('result-source-actions').textContent).not.toContain('Change image')
+ })
+})
+
+describe('the same way on the other tools that work from an image', () => {
+ it('Enhance in the cloud', () => {
+ start('cloud', 'upscale')
+ useCreateStore.getState().setSource(SOURCE as never)
+ stage(result({ intent: 'upscale', jobId: 'j1', width: 2048, height: 2048 }))
+ expect(screen.getByTestId('result-source-actions').textContent).toContain('Change image')
+ expect(screen.getByTestId('result-source-actions').textContent).toContain('Add more images')
+ expect(screen.getByTestId('result-facts').textContent).toBe('2048×2048')
+ })
+
+ it('a rendered image keeps size, seed and model, and has no source actions', () => {
+ start('local', 'image' as never)
+ stage(result({ intent: 'image' }))
+ expect(screen.getByTestId('result-facts').textContent).toBe('512×512·seed 697334996·sd turbo')
+ expect(screen.queryByTestId('result-source-actions')).toBeNull()
+ })
+})
diff --git a/src/hooks/__tests__/useCreate-cutout-says-its-model.test.ts b/src/hooks/__tests__/useCreate-cutout-says-its-model.test.ts
new file mode 100644
index 00000000..894e596f
--- /dev/null
+++ b/src/hooks/__tests__/useCreate-cutout-says-its-model.test.ts
@@ -0,0 +1,122 @@
+// @vitest-environment jsdom
+/**
+ * The box, 04.10.2026, the first cutout after the node pack install: the node
+ * fetched its 885 MB model for 160 s inside the run and the Stage said
+ * "Queued... Ns". And the result read "512×512 · seed 697334996 · sd turbo".
+ * Through the real generate path of useCreate: the wait names the download
+ * when the model is not on the drive, and the result records the cutout model.
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+import { renderHook, waitFor } from '@testing-library/react'
+
+type Listener = (event: { type: string; data: Record<string, unknown> }) => void
+const ws = vi.hoisted(() => ({ listener: null as Listener | null }))
+const disk = vi.hoisted(() => ({ modelThere: false }))
+
+vi.mock('../../api/mlx-image', () => ({
+ isMlxImageHost: () => false,
+ isMlxImageModel: () => false,
+ mlxStatus: vi.fn(async () => ({ installed: false })),
+ listMlxImageModels: vi.fn(async () => []),
+ buildMlxImageModels: vi.fn(() => []),
+ mergeImageModels: vi.fn((a: unknown[]) => a),
+ mlxModelIdFor: vi.fn(() => ''),
+ generateMlxImageDataUrl: vi.fn(),
+}))
+vi.mock('../../api/cutout-model', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ cutoutDownloadLine: vi.fn(async () => (disk.modelThere ? null : 'Downloading the cutout model (885 MB), first run only...')),
+}))
+vi.mock('../../api/comfyui', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ checkComfyConnection: vi.fn(async () => true),
+ submitWorkflow: vi.fn(async () => 'p1'),
+ isPromptQueued: vi.fn(async () => true),
+ getHistory: vi.fn(async () => ({
+ status: { status_str: 'success', completed: true, messages: [] },
+ outputs: { '3': { images: [{ filename: 'cut_00001_.png', subfolder: '', type: 'output' }] } },
+ })),
+}))
+vi.mock('../../api/comfyui-ws', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ CLIENT_ID: 'lu-test',
+ comfyWS: {
+ connect: vi.fn(async () => {}),
+ mark: () => 0,
+ on: (l: Listener) => { ws.listener = l; return () => { ws.listener = null } },
+ },
+}))
+vi.mock('../../api/vram-handoff', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ evictChatBackendsForRender: vi.fn(async () => null),
+ restoreChatBackendsAfterRender: vi.fn(),
+}))
+vi.mock('../../api/dynamic-workflow', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ buildDynamicWorkflow: vi.fn(async () => ({
+ '1': { class_type: 'LoadImage', inputs: { image: 'woman-b.png' } },
+ '2': { class_type: 'RMBG', inputs: { image: ['1', 0], model: 'RMBG-2.0' } },
+ '3': { class_type: 'SaveImage', inputs: { images: ['2', 0] } },
+ })),
+}))
+
+import { useCreate } from '../useCreate'
+import { useCreateStore } from '../../stores/createStore'
+
+const MODEL = 'sd_turbo.safetensors'
+const line = () => useCreateStore.getState().progressText
+
+beforeEach(() => {
+ ws.listener = null
+ disk.modelThere = false
+ useCreateStore.setState({
+ backend: 'local', isGenerating: false, error: null, gallery: [], promptHistory: [],
+ improvePrompt: false, cloudOp: null, utilityOp: null, mask: null, references: [],
+ selectedLoras: [], hiresFixEnabled: false, transparentBackground: false, seed: 42,
+ imageModel: MODEL, imageModelList: [{ name: MODEL, type: 'sd15' }],
+ caps: { rmbg: true },
+ } as never)
+ const s = useCreateStore.getState()
+ s.setIntent('removebg')
+ s.setSource({ filename: 'woman-b.png', url: 'data:image/png;base64,AA', width: 512, height: 512 } as never)
+})
+
+async function runUntilNode() {
+ const { result } = renderHook(() => useCreate())
+ const done = result.current.generate()
+ await waitFor(() => {
+ const st = useCreateStore.getState()
+ if (st.error) throw new Error(`run ended: ${st.error}`)
+ expect(ws.listener).not.toBeNull()
+ })
+ expect(line()).toMatch(/^Queued\.\.\. \d+s$/)
+ ws.listener!({ type: 'executing', data: { node: '2', prompt_id: 'p1' } })
+ return { done }
+}
+
+describe('a local cutout', () => {
+ it('first run, model not on the drive: the wait says the download and its size', async () => {
+ const { done } = await runUntilNode()
+ expect(line()).toMatch(/^Downloading the cutout model \(885 MB\), first run only\.\.\. \d+s$/)
+ ws.listener!({ type: 'execution_complete', data: { prompt_id: 'p1' } })
+ await done
+ }, 15_000)
+
+ it('model on the drive: the wait says what the node does, not "Queued"', async () => {
+ disk.modelThere = true
+ const { done } = await runUntilNode()
+ expect(line()).toMatch(/^Removing the background\.\.\. \d+s$/)
+ ws.listener!({ type: 'execution_complete', data: { prompt_id: 'p1' } })
+ await done
+ }, 15_000)
+
+ it('the result records the cutout model and that it is a cutout', async () => {
+ const { done } = await runUntilNode()
+ ws.listener!({ type: 'execution_complete', data: { prompt_id: 'p1' } })
+ await done
+ const [made] = useCreateStore.getState().gallery
+ expect(made.filename).toBe('cut_00001_.png')
+ expect(made.toolModel).toBe('RMBG-2.0')
+ expect(made.intent).toBe('removebg')
+ }, 15_000)
+})
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index a2f48cf4..6bfad52d 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -54,6 +54,7 @@ import {
import { phaseForExecutingNode, phaseForProgressStep } from '../lib/render-phase-labels'
import { buildDynamicWorkflow, buildLocalOpWorkflow, checkVideoOutputCapability } from '../api/dynamic-workflow'
import { getAllNodeInfo, clearNodeCache } from '../api/comfyui-nodes'
+import { cutoutModelOf, cutoutDownloadLine } from '../api/cutout-model'
import { apiNodes, type ComfyApiGraph, type ComfyExecutionMessage, type ComfyHistoryEntry } from '../types/comfy-graph'
import { restartComfyForNewNodes } from '../api/comfy-restart'
import { installCustomNodes } from '../api/discover'
@@ -1310,6 +1311,12 @@ export function useCreate() {
console.warn('[useCreate] WebSocket unavailable, using polling fallback')
}
+ // A cutout runs on the node's own model, which the node fetches inside
+ // its first run. Asked before the submit, so the wait can say so.
+ const cutoutModel = isRemoveBg ? cutoutModelOf(workflow) : undefined
+ const cutoutDownload = cutoutModel ? await cutoutDownloadLine(cutoutModel) : null
+ const toolFields = cutoutModel ? { toolModel: cutoutModel } : {}
+
setProgress(10, 'Submitting to ComfyUI...')
let promptId: string
try {
@@ -1420,7 +1427,7 @@ export function useCreate() {
modelType: mode === 'image' ? imageModelType : (videoModelsList.find(m => m.name === activeModel)?.type ?? 'wan'),
seed: runSeed,
steps, cfgScale, sampler, scheduler, width: outputWidth, height: outputHeight, batchSize,
- createdAt: Date.now(), builderUsed, intent, ...(skippedNote ? { runNote: skippedNote } : {}),
+ createdAt: Date.now(), builderUsed, intent, ...toolFields, ...(skippedNote ? { runNote: skippedNote } : {}),
})
}
}
@@ -1465,7 +1472,7 @@ export function useCreate() {
break
}
const classType = nodeClassMap.get(nodeId) || ''
- const step = phaseForExecutingNode(classType, mode === 'video' ? 'video' : 'image')
+ const step = phaseForExecutingNode(classType, mode === 'video' ? 'video' : 'image', cutoutDownload)
if (step) {
st.setProgressPhase(step.phase)
setPhase(step.pct, step.label)
@@ -1511,7 +1518,7 @@ export function useCreate() {
modelType: mode === 'image' ? imageModelType : (videoModelsList.find(m => m.name === activeModel)?.type ?? 'wan'),
seed: runSeed,
steps, cfgScale, sampler, scheduler, width: outputWidth, height: outputHeight, batchSize,
- createdAt: Date.now(), builderUsed, ...(skippedNote ? { runNote: skippedNote } : {}),
+ createdAt: Date.now(), builderUsed, intent, ...toolFields, ...(skippedNote ? { runNote: skippedNote } : {}),
})
}
}
@@ -1618,7 +1625,7 @@ export function useCreate() {
modelType: mode === 'image' ? imageModelType : (videoModelsList.find(m => m.name === activeModel)?.type ?? 'wan'),
seed: runSeed,
steps, cfgScale, sampler, scheduler, width: outputWidth, height: outputHeight, batchSize,
- createdAt: Date.now(), builderUsed, intent, ...(skippedNote ? { runNote: skippedNote } : {}),
+ createdAt: Date.now(), builderUsed, intent, ...toolFields, ...(skippedNote ? { runNote: skippedNote } : {}),
})
}
}
diff --git a/src/lib/__tests__/comfy-idle-watch.test.ts b/src/lib/__tests__/comfy-idle-watch.test.ts
index 510629e0..7825075f 100644
--- a/src/lib/__tests__/comfy-idle-watch.test.ts
+++ b/src/lib/__tests__/comfy-idle-watch.test.ts
@@ -18,13 +18,20 @@ const CARCASS_DOWN = { running: false, starting: false, isLocal: true, found: tr
describe('shouldWatchComfyIdle', () => {
it('watches while the local Create tab sits idle', () => {
- expect(shouldWatchComfyIdle(true, false, false)).toBe(true)
+ expect(shouldWatchComfyIdle(true, false, false, false)).toBe(true)
+ })
+
+ // The box, 04.10.2026: during the Cutout setup the line "ComfyUI stopped.
+ // It will restart with your next render." stood right above "Waiting for
+ // ComfyUI to come back". LU was restarting it itself.
+ it('does not watch while LU itself restarts ComfyUI', () => {
+ expect(shouldWatchComfyIdle(true, false, false, true)).toBe(false)
})
it('does not watch on cloud, on a Mac, or during a render', () => {
- expect(shouldWatchComfyIdle(false, false, false)).toBe(false)
- expect(shouldWatchComfyIdle(true, true, false)).toBe(false)
- expect(shouldWatchComfyIdle(true, false, true)).toBe(false)
+ expect(shouldWatchComfyIdle(false, false, false, false)).toBe(false)
+ expect(shouldWatchComfyIdle(true, true, false, false)).toBe(false)
+ expect(shouldWatchComfyIdle(true, false, true, false)).toBe(false)
})
it('asks rarely enough not to be a poller on port 8188', () => {
@@ -83,12 +90,18 @@ describe('the Create tab actually watches and shows it', () => {
)
it('polls comfyui_status only while idle, and renders the line', () => {
- expect(src).toMatch(/shouldWatchComfyIdle\(backend === 'local', isMacOS\(\), isGenerating\)/)
+ expect(src).toMatch(/shouldWatchComfyIdle\(backend === 'local', isMacOS\(\), isGenerating, luIsRestartingComfy\)/)
expect(src).toMatch(/backendCall<ComfyGuardStatus>\('comfyui_status'\)/)
expect(src).toMatch(/setIdleNotice\(comfyIdleNotice\(st\)\)/)
expect(src).toMatch(/\{idleNotice && \(/)
})
+ it('counts a Create setup, a ComfyUI update and the CORS fix as LU restarting it, and looks again when they end', () => {
+ expect(src).toMatch(/useSyncExternalStore\(subscribeInstallRuns, anyInstallRunning\)/)
+ expect(src).toMatch(/const luIsRestartingComfy = setupRunning \|\| comfyUpdating \|\| corsFixing/)
+ expect(src).toMatch(/\}, \[backend, isGenerating, luIsRestartingComfy\]\)/)
+ })
+
it('starts nothing on its own from the idle watch', () => {
const watch = src.slice(src.indexOf('R18 Befund 2'), src.indexOf('const fixCorsForMe'))
expect(watch).not.toMatch(/start_comfyui|ensureComfyForRender|restartComfy/)
diff --git a/src/lib/__tests__/model-install-runs.test.ts b/src/lib/__tests__/model-install-runs.test.ts
index e1046fba..f709b8cb 100644
--- a/src/lib/__tests__/model-install-runs.test.ts
+++ b/src/lib/__tests__/model-install-runs.test.ts
@@ -133,3 +133,19 @@ describe('cancel and subscription', () => {
expect(isInstalling('lipsync')).toBe(false)
})
})
+
+describe('anyInstallRunning', () => {
+ it('is true exactly while a run is going, whichever lane started it', async () => {
+ const { anyInstallRunning } = await import('../model-install-runs')
+ resetInstallRuns()
+ expect(anyInstallRunning()).toBe(false)
+ let fail: (e: Error) => void = () => {}
+ startInstallRun('capability:rmbg', () => new Promise<void>((_, reject) => { fail = reject }))
+ expect(anyInstallRunning()).toBe(true)
+ fail(new Error('git clone failed'))
+ await new Promise((r) => setTimeout(r, 0))
+ // The error stays readable, but nothing is running any more.
+ expect(getInstallRun('capability:rmbg').err).toBe('git clone failed')
+ expect(anyInstallRunning()).toBe(false)
+ })
+})
diff --git a/src/lib/__tests__/render-phase-labels.test.ts b/src/lib/__tests__/render-phase-labels.test.ts
index 1e064d1b..d6690eaf 100644
--- a/src/lib/__tests__/render-phase-labels.test.ts
+++ b/src/lib/__tests__/render-phase-labels.test.ts
@@ -103,7 +103,7 @@ 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(/phaseForExecutingNode\(classType, mode === 'video' \? 'video' : 'image', cutoutDownload\)/)
expect(src).toMatch(/phaseForProgressStep\(value, max, st\.progressPhase\)/)
})
@@ -113,3 +113,19 @@ describe('the Create tab uses this module and holds no labels of its own', () =>
expect(src).not.toContain("setPhase(35, 'Sampling...')")
})
})
+
+describe('the cutout node', () => {
+ // The box, 04.10.2026: the RMBG node fetched its 885 MB model for 160 s and
+ // the waiting area said "Queued..." throughout, the node had no label.
+ it('has its own line instead of leaving "Queued..." up', () => {
+ expect(phaseForExecutingNode('RMBG', 'image')).toEqual({ phase: 'sampling', pct: 40, label: 'Removing the background...' })
+ expect(phaseForExecutingNode('RMBG', 'image', null)?.label).toBe('Removing the background...')
+ })
+ it('says the model download when the run was told the model is not on the drive', () => {
+ const line = 'Downloading the cutout model (885 MB), first run only...'
+ expect(phaseForExecutingNode('RMBG', 'image', line)?.label).toBe(line)
+ })
+ it('the download line belongs to that node alone', () => {
+ expect(phaseForExecutingNode('SaveImage', 'image', 'Downloading the cutout model (885 MB), first run only...')).toBeNull()
+ })
+})
diff --git a/src/lib/comfy-idle-watch.ts b/src/lib/comfy-idle-watch.ts
index d176ee38..b6d5caa8 100644
--- a/src/lib/comfy-idle-watch.ts
+++ b/src/lib/comfy-idle-watch.ts
@@ -65,9 +65,15 @@ export const IDLE_STARTING = 'ComfyUI is starting up.'
* `isGenerating` waehrend eines Renders erzaehlt der Fortschritt die Lage, und
* der Render-Pfad heilt sie ohnehin. Der Leerlaufwaechter hat
* dort nichts zu suchen und wuerde nur doppelt reden.
+ * `luIsRestarting` LU itself is stopping and starting ComfyUI right now (a
+ * node pack install from Create, a ComfyUI update, the CORS
+ * fix). The setup that does it tells its own story, and "ComfyUI
+ * stopped. It will restart with your next render." above
+ * "Waiting for ComfyUI to come back" is two voices saying
+ * opposite things (the box, 04.10.2026).
*/
-export function shouldWatchComfyIdle(local: boolean, isMac: boolean, isGenerating: boolean): boolean {
- return local && !isMac && !isGenerating
+export function shouldWatchComfyIdle(local: boolean, isMac: boolean, isGenerating: boolean, luIsRestarting: boolean): boolean {
+ return local && !isMac && !isGenerating && !luIsRestarting
}
/**
diff --git a/src/lib/model-install-runs.ts b/src/lib/model-install-runs.ts
index ee4c53dd..411662ff 100644
--- a/src/lib/model-install-runs.ts
+++ b/src/lib/model-install-runs.ts
@@ -45,6 +45,13 @@ export function isInstalling(kind: string): boolean {
return runs.get(kind)?.running === true
}
+/** True while any install started from Create is going. Each of them may
+ * stop and start ComfyUI on its own (a node pack, a rescan that needs it). */
+export function anyInstallRunning(): boolean {
+ for (const r of runs.values()) if (r.running) return true
+ return false
+}
+
/**
* Start an install for a lane, or do nothing if one is already going. Pressing
* the button twice, or a remounted card auto-resuming, must never mean two
diff --git a/src/lib/render-phase-labels.ts b/src/lib/render-phase-labels.ts
index 6f3f43cb..ea82651c 100644
--- a/src/lib/render-phase-labels.ts
+++ b/src/lib/render-phase-labels.ts
@@ -29,6 +29,9 @@ import {
LOADER_NODES, CLIP_LOADER_NODES, VAE_LOADER_NODES, SAMPLER_NODES, DECODE_NODES,
} from '../api/comfyui-ws'
+/** ComfyUI-RMBG's node class, the one node a cutout graph runs. */
+const CUTOUT_NODE = 'RMBG'
+
/** Which of the two Create lanes a render belongs to. */
export type RenderMode = 'image' | 'video'
@@ -48,7 +51,18 @@ export interface RenderPhaseStep {
* not sampled anything. It reads as a load because that is what ComfyUI does
* there, and the first `progress` event is what proves sampling started.
*/
-export function phaseForExecutingNode(classType: string, mode: RenderMode): RenderPhaseStep | null {
+export function phaseForExecutingNode(
+ classType: string,
+ mode: RenderMode,
+ /** Set when the cutout node is about to fetch its model (api/cutout-model). */
+ cutoutDownloadLine?: string | null,
+): RenderPhaseStep | null {
+ if (classType === CUTOUT_NODE) {
+ // The box, 04.10.2026: the node spent 160 s fetching its model and the
+ // waiting area said "Queued..." for all of it, because this node had no
+ // label of its own. It is the whole run of a cutout.
+ return { phase: 'sampling', pct: 40, label: cutoutDownloadLine || 'Removing the background...' }
+ }
if (LOADER_NODES.has(classType)) {
return { phase: 'loading-model', pct: 15, label: 'Loading model...' }
}
diff --git a/src/lib/render/__tests__/result-facts.test.ts b/src/lib/render/__tests__/result-facts.test.ts
new file mode 100644
index 00000000..7110c619
--- /dev/null
+++ b/src/lib/render/__tests__/result-facts.test.ts
@@ -0,0 +1,46 @@
+/**
+ * The box, 04.10.2026: under a cutout stood "512×512 · seed 697334996 · sd
+ * turbo". A cutout has no seed and never ran on sd turbo.
+ */
+import { describe, it, expect, vi } from 'vitest'
+
+vi.mock('../preset-models', () => ({ modelLabel: (id: string) => (id === 'seedvr2-image' ? 'SeedVR2' : id) }))
+
+import { resultFacts } from '../result-facts'
+import type { GalleryItem } from '../../../stores/createStore'
+
+const item = (over: Partial<GalleryItem>): GalleryItem => ({
+ id: 'x', type: 'image', filename: 'x.png', subfolder: '', prompt: '', negativePrompt: '',
+ model: 'sd_turbo.safetensors', modelType: 'sd15', seed: 697334996, steps: 4, cfgScale: 1, sampler: '', scheduler: '',
+ width: 512, height: 512, batchSize: 1, createdAt: 1, ...over,
+})
+
+describe('the line under a result', () => {
+ it('a rendered image: size, seed, model', () => {
+ expect(resultFacts(item({ intent: 'image' }))).toEqual(['512×512', 'seed 697334996', 'sd turbo'])
+ expect(resultFacts(item({}))).toEqual(['512×512', 'seed 697334996', 'sd turbo'])
+ })
+
+ it('a cutout: its size and the cutout model, no seed, not the image model', () => {
+ const facts = resultFacts(item({ intent: 'removebg', toolModel: 'RMBG-2.0', width: 768, height: 1024 }))
+ expect(facts).toEqual(['768×1024', 'RMBG-2.0'])
+ })
+
+ it('a cutout from before the model was recorded, and a cloud cutout: the size alone', () => {
+ expect(resultFacts(item({ intent: 'removebg' }))).toEqual(['512×512'])
+ expect(resultFacts(item({ intent: 'removebg', jobId: 'j1', model: 'flux-schnell' }))).toEqual(['512×512'])
+ })
+
+ it('Enhance: no seed; the upscaler only when the run really used one', () => {
+ expect(resultFacts(item({ intent: 'upscale', model: 'flux-schnell', width: 4096, height: 4096 }))).toEqual(['4096×4096'])
+ expect(resultFacts(item({ intent: 'upscale', model: 'seedvr2-image', width: 4096, height: 4096 }))).toEqual(['4096×4096', 'SeedVR2'])
+ })
+
+ it('Erase: no seed and not the image tab model', () => {
+ expect(resultFacts(item({ intent: 'eraser', model: 'flux-schnell' }))).toEqual(['512×512'])
+ })
+
+ it('audio: the model alone', () => {
+ expect(resultFacts(item({ type: 'audio', model: 'ace_step_v1.safetensors' }))).toEqual(['ace step v1'])
+ })
+})
diff --git a/src/lib/render/result-facts.ts b/src/lib/render/result-facts.ts
new file mode 100644
index 00000000..85c4baa7
--- /dev/null
+++ b/src/lib/render/result-facts.ts
@@ -0,0 +1,36 @@
+// The line under a finished result: what it is, in the few facts that are true
+// of it.
+//
+// The box, 04.10.2026: a cutout read "512×512 · seed 697334996 · sd turbo".
+// A cutout has no seed and never touched sd turbo; the line repeated the Image
+// tab's picker. A tool that runs without the picker's model (Cutout, Enhance,
+// Erase) says its size and, where it is known, the model the tool itself ran
+// on, nothing else.
+import type { GalleryItem } from '../../stores/createStore'
+import { STUDIO_IMAGE_UPSCALERS } from './studio-roles'
+import { modelLabel } from './preset-models'
+
+/** Runs that take no seed and no model from the picker. */
+const TOOL_INTENTS: ReadonlySet<string> = new Set(['removebg', 'upscale', 'eraser'])
+
+function prettyModel(file: string): string {
+ return file.replace(/\.(safetensors|ckpt|pt)$/i, '').replace(/[_]+/g, ' ')
+}
+
+/** The model a tool run really used, when the entry knows it. */
+function toolModelName(item: GalleryItem): string | undefined {
+ if (item.toolModel) return item.toolModel
+ // Enhance on a studio upscaler: the entry's model is that upscaler itself.
+ if (item.intent === 'upscale' && STUDIO_IMAGE_UPSCALERS.includes(item.model)) return modelLabel(item.model)
+ return undefined
+}
+
+export function resultFacts(item: GalleryItem): string[] {
+ if (item.type === 'audio') return [prettyModel(item.model)]
+ const size = `${item.width}×${item.height}`
+ if (item.intent && TOOL_INTENTS.has(item.intent)) {
+ const model = toolModelName(item)
+ return model ? [size, model] : [size]
+ }
+ return [size, `seed ${item.seed}`, prettyModel(item.model)]
+}
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 4aef46cb..1b019c58 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -244,6 +244,9 @@ export interface GalleryItem {
intent?: CreateIntent
/** Several source images, one edit: the file this result was made from. */
sourceName?: string
+ /** A tool that runs on its own model (Cutout on RMBG-2.0): that model.
+ * `model` is then only the picker's choice, which had no part in the run. */
+ toolModel?: string
/** Kurze Ueberschrift, wenn der Prompt nicht sagt, was dabei herauskam: der
* Titel des Presets, die Beschreibung des Schrittes. Siehe gallery-label.ts. */
label?: string