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
fix(models): a bundle card announces what Get will really fetch
purple31fee1a2b7ea
diff --git a/src/api/__tests__/download-integrity.test.ts b/src/api/__tests__/download-integrity.test.tsindex 556bd313..40c2543f 100644--- a/src/api/__tests__/download-integrity.test.ts+++ b/src/api/__tests__/download-integrity.test.ts@@ -19,10 +19,11 @@*/import { describe, it, expect } from 'vitest'import {- bundleBytesToFetch, isPermanentDownloadError, lfsSha256, orphanFilename,+ isPermanentDownloadError, lfsSha256, orphanFilename,planModelDownload, selectGgufFromTree, getVideoBundles, getImageBundles,type ModelBundle, type DiscoverModel,} from '../discover'+import { bundleBytesToFetch } from '../../lib/bundle-state'const GIB = 1_073_741_824diff --git a/src/api/discover.ts b/src/api/discover.tsindex b9c20e68..4ebd40b4 100644--- a/src/api/discover.ts+++ b/src/api/discover.ts@@ -7,6 +7,7 @@ import type { ProviderId } from "./providers/types"import { log } from "../lib/logger"import { useWorkflowStore } from "../stores/workflowStore"import { waitForModelsVisible } from "../lib/bundle-install"+import { bundleBytesToFetch } from "../lib/bundle-state"import type { DownloadProgress } from "../types/downloads"import { asNumber, asRecordArray, asString, isRecord, prop, propPath } from "../types/json-guards"import type { DiscoverModel, ModelBundle } from "./model-bundles"@@ -329,7 +330,17 @@ export async function checkBundleInstalled(bundle: ModelBundle): Promise<boolean/** Check multiple bundles at once, returns map of bundle name → installed status */export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Record<string, boolean>> {+ return (await checkBundlesOnDisk(bundles)).installed+}++/** What the disk says about a list of bundles: which bundles are installed, and+ * which of their files are there already. The second half is what a card needs+ * to announce only what it will really fetch: bundles share files, so "Get"+ * on a three file bundle is often one file (the box, 03.10.2026). A file+ * counts by the same rule `installBundleComplete` skips it by. */+export async function checkBundlesOnDisk(bundles: ModelBundle[]): Promise<{ installed: Record<string, boolean>; files: Set<string> }> {const result: Record<string, boolean> = {}+ const files = new Set<string>()// Collect ALL files from ALL bundles into a single batch requestconst allFiles: Array<{ subfolder: string; filename: string; expectedBytes: number; bundleName: string }> = []for (const bundle of bundles) {@@ -343,7 +354,7 @@ export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Rec})}}- if (allFiles.length === 0) return result+ if (allFiles.length === 0) return { installed: result, files }try {const checkFiles = allFiles.map(f => ({ subfolder: f.subfolder, filename: f.filename, expectedBytes: f.expectedBytes }))@@ -354,6 +365,9 @@ export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Recconst fileStatus = new Map(results.map(r => [r.filename, r]))for (const bundle of bundles) {const bundleFiles = bundle.files.filter(f => f.filename)+ for (const f of bundleFiles) {+ if (onDiskMatchesCatalog(f, fileStatus.get(f.filename!))) files.add(f.filename!)+ }result[bundle.name] = bundleFiles.length > 0 && bundleFiles.every(f => onDiskMatchesCatalog(f, fileStatus.get(f.filename!)))}} catch {@@ -442,7 +456,7 @@ export async function checkBundlesInstalled(bundles: ModelBundle[]): Promise<Rec}}- return result+ return { installed: result, files }}/** Base identity of a model file: basename only (ComfyUI enums can carry@@ -674,33 +688,6 @@ async function runVisibilityConfirmation(filename: string): Promise<void> {}}-/** One gibibyte, the unit the catalog's `sizeGB` and every size message use. */-const GIB = 1_073_741_824--/**- * How many bytes this bundle still has to fetch, and where they land.- *- * Pure, so the sum can be tested without a drive. Files already on disk are- * left out — re-checking space for a file that is not going to be fetched would- * refuse installs that fit perfectly well. `totalSizeGB` is the fallback when- * the per-file sizes are missing: a rough number is a far better plan than- * planning for nothing, and it is only ever used to refuse, never to promise.- */-export function bundleBytesToFetch(- bundle: ModelBundle,- installed: Set<string>,-): { bytes: number; subfolder?: string; files: number } {- const pending = bundle.files.filter(- f => f.downloadUrl && f.filename && f.subfolder && !installed.has(f.filename),- )- if (pending.length === 0) return { bytes: 0, files: 0 }- const known = pending.reduce((sum, f) => sum + (f.sizeGB ? f.sizeGB * GIB : 0), 0)- // Not one file states a size: fall back to the bundle total, minus nothing,- // because we cannot tell which part of it is already there.- const bytes = known > 0 ? known : (bundle.totalSizeGB || 0) * GIB- return { bytes: Math.round(bytes), subfolder: pending[0].subfolder, files: pending.length }-}-export async function installBundleComplete(bundle: ModelBundle): Promise<{ remote?: RemoteBundleReport }> {const errors: string[] = []// GH #143: a ComfyUI on another machine. The files land here for the user@@ -1660,7 +1647,7 @@ export function lookupFileMeta(filename: string): FileMeta | null {return {url: m.downloadUrl,subfolder: m.subfolder,- expectedBytes: m.sizeGB ? Math.round(m.sizeGB * GIB) : undefined,+ expectedBytes: m.sizeGB ? Math.round(m.sizeGB * 1_073_741_824) : undefined,sha256: m.sha256,}}diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsxindex efd14fc0..c54fba0b 100644--- a/src/components/models/DiscoverModels.tsx+++ b/src/components/models/DiscoverModels.tsx@@ -10,7 +10,7 @@ import {getUncensoredTextModels, getMainstreamTextModels,detectProviderModelPath, startModelDownloadToPath, luEngineDownloadDir,startModelDownload,- installBundleComplete, remoteBundleNotice, checkBundlesInstalled, resolveHfGgufFiles, planModelDownload,+ installBundleComplete, remoteBundleNotice, checkBundlesOnDisk, resolveHfGgufFiles, planModelDownload,type DiscoverModel, type DownloadProgress, type ModelBundle, type HfGgufFile,} from '../../api/discover'import { sortByTier, tierGroup } from '../../lib/render/model-tier'@@ -270,6 +270,9 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:// Check which bundles are REALLY installed (file size validated, not just file existence)const [bundleStatuses, setBundleStatuses] = useState<Record<string, boolean>>({})+ // Which bundle files are there already, so a card announces only what Get+ // will really fetch (bundles share their text encoders and VAEs).+ const [bundleFilesOnDisk, setBundleFilesOnDisk] = useState<ReadonlySet<string>>(() => new Set())// Memoised so the two effects below can name it as the dependency it is// instead of hiding it from the dep array. It only closes over `category`,// so its identity changes exactly when the effects had to re-run anyway —@@ -277,7 +280,10 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:const refreshBundleStatuses = useCallback(() => {if (category !== 'image' && category !== 'video') returnconst allBundles = [...getImageBundles(), ...getVideoBundles(), ...getAudioBundles(), ...getLipsyncBundles(), ...getMotionBundles()]- checkBundlesInstalled(allBundles).then(statuses => setBundleStatuses(statuses))+ checkBundlesOnDisk(allBundles).then(({ installed, files }) => {+ setBundleStatuses(installed)+ setBundleFilesOnDisk(files)+ })}, [category])useEffect(() => {refreshBundleStatuses()@@ -982,6 +988,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:vramGb={systemVRAM}sharedMemory={isMacOS()}complete={isBundleComplete(bundle)}+ filesOnDisk={bundleFilesOnDisk}downloading={isBundleDownloading(bundle) || installingBundle === bundle.name}hasErrors={hasBundleErrors(bundle)}onInstall={() => handleBundleInstall(bundle)}diff --git a/src/components/models/ModelTiles.tsx b/src/components/models/ModelTiles.tsxindex 7bbc20c1..19e3b4ea 100644--- a/src/components/models/ModelTiles.tsx+++ b/src/components/models/ModelTiles.tsx@@ -16,6 +16,7 @@ import { formatBytes, countLabel } from '../../lib/formatters'import { vramFit, vramFitLine, vramNeedTitle, type VramFit } from '../../lib/vram-fit'import { tierMarks } from '../../lib/render/model-tier'import { modelTileAction } from '../../lib/model-tile-action'+import { bundleGetPlan } from '../../lib/bundle-state'import { ICON_SM } from '../ui/icon-size'// ─── Hardware fit ───────────────────────────────────────────────────@@ -144,11 +145,11 @@ const TILE_STATE =/** ANZEIGE. Bleibt bewusst flach und ohne Hover: sie ist die Groesse, nicht* die Wahl der Groesse. Wo es etwas zu waehlen gibt, steht an derselben* Stelle das Control (siehe `ModelTile`). */-export function SizePill({ sizeGB }: { sizeGB?: number }) {- if (!sizeGB) return null+export function SizePill({ sizeGB, bytes }: { sizeGB?: number; bytes?: number }) {+ if (!sizeGB && !bytes) return nullreturn (<span className="t-micro px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-white/[0.06] text-gray-600 dark:text-gray-300 font-medium tabular-nums">- {sizeGB} GB+ {bytes ? formatBytes(bytes) : `${sizeGB} GB`}</span>)}@@ -546,6 +547,9 @@ export interface BundleTileProps {* There is no card to name there, so the tile keeps the general hint. */sharedMemory?: booleancomplete: boolean+ /** The bundle's files that are on disk already (bundles share files). The+ * card announces only what Get will really fetch. */+ filesOnDisk?: ReadonlySet<string>downloading: booleanhasErrors: booleanonInstall: () => void@@ -554,7 +558,9 @@ export interface BundleTileProps {onOpenUrl: (url: string) => void}-export function BundleTile({ bundle, lane, vramGb, sharedMemory = false, complete, downloading, hasErrors, onInstall, onRetry, onClear, onOpenUrl }: BundleTileProps) {+const NO_FILES: ReadonlySet<string> = new Set()++export function BundleTile({ bundle, lane, vramGb, sharedMemory = false, complete, filesOnDisk = NO_FILES, downloading, hasErrors, onInstall, onRetry, onClear, onOpenUrl }: BundleTileProps) {// No COMING SOON overlay any more (2026-07-24). It was driven by// `!bundle.verified && !complete`, a hand-set boolean, and it dimmed the tile// behind a full-cover "COMING SOON" pill while that tile's own working@@ -576,6 +582,12 @@ export function BundleTile({ bundle, lane, vramGb, sharedMemory = false, complet// owner's 12 GB box sat five minutes in a load the old "10-16 GB" never// announced. Shared memory has no card to name and keeps the general hint.const cardLine = sharedMemory ? '' : vramFitLine(fit, vramGb)+ // Sizes come from the files' own byte counts, and Get names what is still+ // missing: the box, 03.10.2026, read "Get · 16.1 GB" on a card whose click+ // fetched one file of 8.7 GB, the other two being shared and already there.+ const plan = bundleGetPlan(bundle, filesOnDisk)+ const fetchSize = formatBytes(plan.fetchBytes)+ const alreadyHere = plan.present > 0 ? `, ${plan.present} already here` : ''return (<div@@ -621,7 +633,7 @@ export function BundleTile({ bundle, lane, vramGb, sharedMemory = false, complet</div><div className="flex items-center gap-2 mt-2.5 min-h-[var(--control-h-sm)]">- <SizePill sizeGB={bundle.totalSizeGB} />+ <SizePill bytes={plan.totalBytes} /><span className="text-[0.55rem] text-gray-400 dark:text-gray-500">{countLabel(bundle.files.length, 'file')}</span>{!cardLine && <FitHint fit={fit} />}@@ -659,9 +671,9 @@ export function BundleTile({ bundle, lane, vramGb, sharedMemory = false, complet<buttononClick={onInstall}className={TILE_ACTION}- title={`Install ${countLabel(bundle.files.length, 'file')} (${bundle.totalSizeGB} GB)`}+ title={`Install ${countLabel(plan.fetchFiles, 'file')} (${fetchSize})${alreadyHere}`}>- <Download size={ICON_SM} /> Get · {bundle.totalSizeGB} GB+ <Download size={ICON_SM} /> Get · {fetchSize}</button>)}</div>diff --git a/src/components/models/__tests__/bundle-tile-announces-what-it-fetches.test.tsx b/src/components/models/__tests__/bundle-tile-announces-what-it-fetches.test.tsxnew file mode 100644index 00000000..742ead42--- /dev/null+++ b/src/components/models/__tests__/bundle-tile-announces-what-it-fetches.test.tsx@@ -0,0 +1,84 @@+import { describe, it, expect } from 'vitest'+import { renderToStaticMarkup } from 'react-dom/server'+import { BundleTile } from '../ModelTiles'+import { getImageBundles, getVideoBundles } from '../../../api/model-bundles'+import { bundleGetPlan, catalogFileBytes } from '../../../lib/bundle-state'+import { formatBytes } from '../../../lib/formatters'++// The box, 03.10.2026: "Qwen-Image 2.1 (No Refusals)" and "Noct Q" read+// "Get · 16.1 GB" and "Install 3 files (16.1 GB)". Two of the three files are+// shared with the official bundle and were there already; the click fetched+// one file of 8.7 GB. A card announces what the click will fetch.++const all = () => [...getImageBundles(), ...getVideoBundles()]+const bundle = (name: string) => all().find((b) => b.name === name)!++function tile(name: string, filesOnDisk?: Set<string>): string {+ return renderToStaticMarkup(+ <BundleTile+ bundle={bundle(name)} vramGb={12} complete={false} filesOnDisk={filesOnDisk}+ downloading={false} hasErrors={false}+ onInstall={() => {}} onRetry={() => {}} onClear={() => {}} onOpenUrl={() => {}}+ />,+ )+}++const SHARED = new Set(['qwen_image_2.1_int8_convrot.safetensors', 'qwen3vl_8b_int8_convrot.safetensors', 'qwen_image_2.1_vae_bf16.safetensors'])++describe('a bundle card announces what Get will fetch', () => {+ it('No Refusals with the official bundle installed: one file, the encoder', () => {+ const html = tile('Qwen-Image 2.1 (No Refusals)', SHARED)+ expect(html).toContain('Get · 8.7 GB')+ expect(html).toContain('title="Install 1 file (8.7 GB), 2 already here"')+ expect(html).not.toContain('Get · 16.1 GB')+ })++ it('Noct Q with the official bundle installed: one file, the image model', () => {+ const html = tile('Noct Q (Qwen-Image 2.1, Unfiltered)', SHARED)+ expect(html).toContain('Get · 6.8 GB')+ expect(html).toContain('title="Install 1 file (6.8 GB), 2 already here"')+ })++ it('with nothing on disk the whole bundle is announced', () => {+ const html = tile('Qwen-Image 2.1 (No Refusals)')+ expect(html).toContain('Get · 16.1 GB')+ expect(html).toContain('title="Install 3 files (16.1 GB)"')+ expect(html).not.toContain('already here')+ })++ it('the card still names the size of the whole bundle next to the file count', () => {+ const html = tile('Qwen-Image 2.1 (No Refusals)', SHARED)+ expect(html).toMatch(/16\.1 GB<\/span><span[^>]*>3 files/)+ })++ it('LTX 2.5 Small with two of five files there: the three missing ones, 27.1 GB', () => {+ const onDisk = new Set(['ltx-2.5-audio-vae-bf16.safetensors', 'ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors'])+ const html = tile('LTX 2.5 · Small (GGUF Q4)', onDisk)+ expect(html).toContain('Get · 27.1 GB')+ expect(html).toContain('title="Install 3 files (27.1 GB), 2 already here"')+ })+})++describe('sizes are summed from the files, in bytes', () => {+ it('LTX 2.5 Small is the sum of its five byte counts, not a rounded total', () => {+ const b = bundle('LTX 2.5 · Small (GGUF Q4)')+ const sum = b.files.reduce((n, f) => n + catalogFileBytes(f), 0)+ expect(bundleGetPlan(b, new Set()).totalBytes).toBe(sum)+ expect(b.files.every((f) => f.sizeBytes != null)).toBe(true)+ expect(tile(b.name)).toContain(`Get · ${formatBytes(sum)}`)+ })++ it('an exact byte count wins over the rounded sizeGB', () => {+ expect(catalogFileBytes({ sizeGB: 11.38, sizeBytes: 12220864608 })).toBe(12220864608)+ expect(catalogFileBytes({ sizeGB: 0.5 })).toBe(536870912)+ expect(catalogFileBytes({})).toBe(0)+ })++ it('files on disk that ComfyUI does not list: Get names the whole bundle again', () => {+ const b = bundle('Qwen-Image 2.1 (No Refusals)')+ const everything = new Set(b.files.map((f) => f.filename!))+ const plan = bundleGetPlan(b, everything)+ expect(plan.fetchFiles).toBe(3)+ expect(plan.present).toBe(0)+ })+})diff --git a/src/components/models/__tests__/lora-addons-ein-klick.test.tsx b/src/components/models/__tests__/lora-addons-ein-klick.test.tsxindex a40ccec5..899a9273 100644--- a/src/components/models/__tests__/lora-addons-ein-klick.test.tsx+++ b/src/components/models/__tests__/lora-addons-ein-klick.test.tsx@@ -61,7 +61,7 @@ describe('the list', () => {expect(screen.getByText('Ready to install')).toBeTruthy()expect(tile(TURBO)).toBeTruthy()expect(tile('Pixel Art XL · SDXL LoRA')).toBeTruthy()- expect(tile(TURBO).textContent).toMatch(/1\.82 GB/)+ expect(tile(TURBO).textContent).toMatch(/1\.8 GB/)expect(tile(TURBO).textContent).toMatch(/LoRA stack/)})diff --git a/src/components/models/__tests__/vier-glyphen-ein-chip-ein-schatten.test.ts b/src/components/models/__tests__/vier-glyphen-ein-chip-ein-schatten.test.tsindex 9a7bd937..ed9be669 100644--- a/src/components/models/__tests__/vier-glyphen-ein-chip-ein-schatten.test.ts+++ b/src/components/models/__tests__/vier-glyphen-ein-chip-ein-schatten.test.ts@@ -228,7 +228,7 @@ describe('D-S24 · der Schatten, den niemand je gesehen hat', () => {onInstall: () => {}, onRetry: () => {}, onClear: () => {}, onOpenUrl: () => {},}))expect(html).not.toContain('shadow')- expect(html).toContain('Get · 6 GB')+ expect(html).toContain('Get · 6.0 GB')// EIN Rezept, zwei Call-Sites — nicht zwei handgeschriebene Ketten.expect((TILES.match(/className=\{TILE_ACTION\}/g) ?? []).length).toBe(2)})diff --git a/src/lib/bundle-state.ts b/src/lib/bundle-state.tsindex 22992323..f2071be4 100644--- a/src/lib/bundle-state.ts+++ b/src/lib/bundle-state.ts@@ -99,3 +99,77 @@ export function bundleHasErrors(return row !== undefined && row.status !== 'complete'})}++/** One gibibyte, the unit the catalog's `sizeGB` and every size message use. */+const GIB = 1_073_741_824++/** The fields of a catalog file the sums below read. */+export interface SizedFile {+ downloadUrl?: string+ filename?: string+ subfolder?: string+ sizeGB?: number+ sizeBytes?: number+}++/** A catalog file's size in bytes: the exact count where the catalog has it,+ * the rounded `sizeGB` otherwise, 0 when it states neither. */+export function catalogFileBytes(file: SizedFile): number {+ if (file.sizeBytes != null) return file.sizeBytes+ return file.sizeGB ? Math.round(file.sizeGB * GIB) : 0+}++/**+ * How many bytes this bundle still has to fetch, and where they land.+ *+ * Pure, so the sum can be tested without a drive. Files already on disk are+ * left out: re-checking space for a file that is not going to be fetched would+ * refuse installs that fit perfectly well, and a card that announces them+ * promises a download three times the real one (the box, 03.10.2026: "Get ·+ * 16.1 GB" for one file of 8.7 GB). The sum is taken over the files' own byte+ * counts, not over the bundle's hand-written total. `totalSizeGB` is the+ * fallback when the per-file sizes are missing: a rough number is a far better+ * plan than planning for nothing.+ */+export function bundleBytesToFetch(+ bundle: { files: SizedFile[]; totalSizeGB: number },+ installed: ReadonlySet<string>,+): { bytes: number; subfolder?: string; files: number } {+ const pending = bundle.files.filter(+ f => f.downloadUrl && f.filename && f.subfolder && !installed.has(f.filename),+ )+ if (pending.length === 0) return { bytes: 0, files: 0 }+ const known = pending.reduce((sum, f) => sum + catalogFileBytes(f), 0)+ // Not one file states a size: fall back to the bundle total, minus nothing,+ // because we cannot tell which part of it is already there.+ const bytes = known > 0 ? known : (bundle.totalSizeGB || 0) * GIB+ return { bytes: Math.round(bytes), subfolder: pending[0].subfolder, files: pending.length }+}++const NOTHING_ON_DISK: ReadonlySet<string> = new Set()++/** What a bundle card announces: the whole bundle, and the part of it a click+ * on Get will really fetch. `present` counts the files that are there already. */+export function bundleGetPlan(+ bundle: { files: SizedFile[]; totalSizeGB: number },+ onDisk: ReadonlySet<string>,+): { totalBytes: number; totalFiles: number; fetchBytes: number; fetchFiles: number; present: number } {+ const sized = bundleBytesToFetch(bundle, NOTHING_ON_DISK)+ // A bundle whose files carry no download address has nothing to sum: the+ // catalog's own total and file count are all there is to say.+ const total = sized.files > 0+ ? sized+ : { bytes: Math.round((bundle.totalSizeGB || 0) * GIB), files: bundle.files.length }+ const pending = bundleBytesToFetch(bundle, onDisk)+ // Nothing left to fetch and the card still offers Get: the files are on disk+ // and ComfyUI does not list them. The click re-checks all of them, so the+ // card names the whole bundle.+ const fetch = pending.files > 0 ? pending : total+ return {+ totalBytes: total.bytes,+ totalFiles: total.files,+ fetchBytes: fetch.bytes,+ fetchFiles: fetch.files,+ present: total.files - fetch.files,+ }+}