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(models): a bundle card compares itself with your graphics card
purpleec63eef3674f
diff --git a/src/api/__tests__/h3-turbo-lora-is-one-click.test.ts b/src/api/__tests__/h3-turbo-lora-is-one-click.test.tsindex 887288d6..02ca2c78 100644--- a/src/api/__tests__/h3-turbo-lora-is-one-click.test.ts+++ b/src/api/__tests__/h3-turbo-lora-is-one-click.test.ts@@ -23,7 +23,6 @@ import { lookupFileMeta, checkBundlesInstalled, onDiskMatchesCatalog } from '../import { bundleForVideoIntent, classifyModel, subfolderForSource } from '../comfyui'import { backendCall } from '../backend'import { defaultLoraStrength } from '../../lib/lora-strength'-import { bundleVramNeedGb } from '../../lib/hardware'const FILE = 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors'const SHA = '2339acdf19bfe123f46b971ea35d367a84adb85de43627e1eceafa5a5b2b111e'@@ -80,7 +79,8 @@ describe('where it shows', () => {// The first minimaxh3 entry stays the model itself.expect(all.find((x) => x.workflow === 'minimaxh3')!.name).toBe('MiniMax H3 · Video with Sound')// It needs the model next to it, so it is sized like the model.- expect(bundleVramNeedGb(b)).toBe(bundleVramNeedGb(all.find((x) => x.workflow === 'minimaxh3')!))+ const model = all.find((x) => x.workflow === 'minimaxh3')!+ expect([b.vramMinGB, b.vramComfortGB]).toEqual([model.vramMinGB, model.vramComfortGB])})it('on Models, LoRAs, Get new, next to the other catalog LoRA', () => {diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsxindex 1c9005cd..efd14fc0 100644--- a/src/components/models/DiscoverModels.tsx+++ b/src/components/models/DiscoverModels.tsx@@ -13,10 +13,11 @@ import {installBundleComplete, remoteBundleNotice, checkBundlesInstalled, resolveHfGgufFiles, planModelDownload,type DiscoverModel, type DownloadProgress, type ModelBundle, type HfGgufFile,} from '../../api/discover'-import { getSystemVRAM } from '../../api/comfyui'import { sortByTier, tierGroup } from '../../lib/render/model-tier'-import { getMaxVramGb, getTotalRamGb, bundleVramNeedGb } from '../../lib/hardware'-import { openExternal } from '../../api/backend'+import { getTotalRamGb } from '../../lib/hardware'+import { vramFit } from '../../lib/vram-fit'+import { useGraphicsMemoryGb } from '../../hooks/useGraphicsMemory'+import { openExternal, isMacOS } from '../../api/backend'import { useModels } from '../../hooks/useModels'import { useDownloadStore } from '../../stores/downloadStore'import { ModelGridSkeleton } from '../layout/ViewSkeletons'@@ -219,7 +220,7 @@ export function awaitDownloadedFile(export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }: Props) {const [loading, setLoading] = useState(false)- const [systemVRAM, setSystemVRAM] = useState<number | null>(null)+ const systemVRAM = useGraphicsMemoryGb()const [ramGb, setRamGb] = useState<number | null>(null)// Mainstream is the default + first tab (David 2026-07-17) — Unfiltered is// one click away but new users land on the neutral list.@@ -260,16 +261,10 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:detectProviderModelPath(providerName).then(path => setHfModelPath(path))}, [category, hfOverride, providers.openai?.name])- // Detect hardware for the "runs on your PC" hints. Two probes, best wins:- // detect_gpus (nvidia-smi/rocm-smi/wmic — works WITHOUT ComfyUI running)- // and ComfyUI's /system_stats (the pre-redesign source, kept as fallback).+ // The graphics memory behind the "runs on your PC" hints comes from+ // useGraphicsMemoryGb above (detect_gpus and ComfyUI's /system_stats, best+ // wins), the same reading Create uses. RAM is asked here.useEffect(() => {- getMaxVramGb().then(v => {- if (v > 0) setSystemVRAM(prev => Math.max(prev ?? 0, Math.round(v)))- }).catch(() => {})- getSystemVRAM().then(v => {- if (v) setSystemVRAM(prev => Math.max(prev ?? 0, v))- })getTotalRamGb().then(r => { if (r > 0) setRamGb(r) }).catch(() => {})}, [])@@ -317,12 +312,14 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:? getImageBundles(): isVideo ? [...getVideoBundles(), ...getAudioBundles(), ...getLipsyncBundles(), ...getMotionBundles()] : []- // How much VRAM a bundle wants, read by the ONE shared parser in- // lib/hardware. The local copy that used to live here answered 99 GB to the- // add-on bundles, whose requirement reads "any", so the sort buried them,- // the tier filter hid them and the tile called a 0.17 GB LoRA too big for a- // 12 GB card.- const parseVRAM = (b: ModelBundle): number => bundleVramNeedGb(b)+ // How much graphics memory a bundle wants to run without offloading, from the+ // ONE rule in lib/vram-fit. The companion files name no number, their+ // download size stands in so they keep a place in the sort and the buckets.+ const parseVRAM = (b: ModelBundle): number => b.vramComfortGB ?? b.totalSizeGB+ const fitsCard = (b: ModelBundle): boolean => {+ const fit = vramFit(b, systemVRAM)+ return fit === 'fits' || fit === 'unknown'+ }// Sort bundles: verified first, then HOT, then fits VRAM, then by size// Then the tier, stable: Best on top, Older gathered at the bottom under its@@ -335,8 +332,8 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:if (a.hot && !b.hot) return -1if (!a.hot && b.hot) return 1if (systemVRAM) {- const aFits = parseVRAM(a) <= systemVRAM- const bFits = parseVRAM(b) <= systemVRAM+ const aFits = fitsCard(a)+ const bFits = fitsCard(b)if (aFits && !bFits) return -1if (!aFits && bFits) return 1}@@ -349,7 +346,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:const vramFilteredBundles = tabFilteredBundles.filter(b => {if (vramTier === 'all') return trueconst vram = parseVRAM(b)- if (vramTier === 'fit') return systemVRAM ? vram <= systemVRAM + 2 : true+ if (vramTier === 'fit') return vramFit(b, systemVRAM) !== 'big'if (vramTier === 'ultra') return vram <= 4if (vramTier === 'light') return vram > 4 && vram <= 10if (vramTier === 'middle') return vram > 10 && vram <= 20@@ -983,6 +980,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:bundle={bundle}lane={laneOf.get(bundle.name)}vramGb={systemVRAM}+ sharedMemory={isMacOS()}complete={isBundleComplete(bundle)}downloading={isBundleDownloading(bundle) || installingBundle === bundle.name}hasErrors={hasBundleErrors(bundle)}diff --git a/src/components/models/ModelTiles.tsx b/src/components/models/ModelTiles.tsxindex 9602d923..7bbc20c1 100644--- a/src/components/models/ModelTiles.tsx+++ b/src/components/models/ModelTiles.tsx@@ -13,14 +13,14 @@ import {import type { LucideIcon } from 'lucide-react'import type { DiscoverModel, DownloadProgress, ModelBundle } from '../../api/discover'import { formatBytes, countLabel } from '../../lib/formatters'-import { bundleVramNeedGb } from '../../lib/hardware'+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 { ICON_SM } from '../ui/icon-size'// ─── Hardware fit ───────────────────────────────────────────────────-export type Fit = 'fits' | 'tight' | 'big' | 'unknown'+export type Fit = VramFit// GGUF weights ≈ VRAM need; leave headroom for KV-cache/context. Never used// to BLOCK a download — purely an honest hint.@@ -542,6 +542,9 @@ export interface BundleTileProps {/** Which Create lane a non-video bundle belongs to (Music, Lip sync, Motion). */lane?: stringvramGb: number | null+ /** True where graphics unit and processor share one memory pool (a Mac).+ * There is no card to name there, so the tile keeps the general hint. */+ sharedMemory?: booleancomplete: booleandownloading: booleanhasErrors: boolean@@ -551,7 +554,7 @@ export interface BundleTileProps {onOpenUrl: (url: string) => void}-export function BundleTile({ bundle, lane, vramGb, complete, downloading, hasErrors, onInstall, onRetry, onClear, onOpenUrl }: BundleTileProps) {+export function BundleTile({ bundle, lane, vramGb, sharedMemory = false, complete, 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@@ -564,10 +567,15 @@ export function BundleTile({ bundle, lane, vramGb, complete, downloading, hasErr// wrapper-node-names pins every node name the builder emits against real// wrapper registries. A lane that cannot run gets pulled (see the CogVideoX// and Pyramid Flow removals) rather than shipped behind a badge.- // bundleVramNeedGb, not a local parser: the add-on bundles say "any" and the- // old local one answered 99 GB to that, which painted a 0.17 GB LoRA red.- const need = bundleVramNeedGb(bundle)- const fit: Fit = !vramGb ? 'unknown' : need <= vramGb ? 'fits' : need <= vramGb + 2 ? 'tight' : 'big'+ // One rule for every bundle (lib/vram-fit): below the catalogue's minimum the+ // card needs more, from the comfortable value up it fits, between the two it+ // is tight. The add-ons say "any" and fit every card, the companion files+ // name no number and get no verdict.+ const fit: Fit = vramFit(bundle, vramGb)+ // With a detected card the tile names it and says what tight costs: the+ // 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)return (<div@@ -589,6 +597,16 @@ export function BundleTile({ bundle, lane, vramGb, complete, downloading, hasErr{bundle.description && (<p className="t-micro text-gray-500 dark:text-gray-400 leading-snug mt-0.5 line-clamp-2">{bundle.description}</p>)}+ {cardLine && (+ <p+ className="flex items-center gap-1.5 mt-1.5 t-micro text-gray-500 dark:text-gray-400"+ data-bundle-fit={fit}+ title={vramNeedTitle(bundle)}+ >+ <span className={`w-1.5 h-1.5 shrink-0 rounded-full ${FIT_META[fit].dot}`} />+ <span>{cardLine}</span>+ </p>+ )}</div>{bundle.url && (<button@@ -605,7 +623,7 @@ export function BundleTile({ bundle, lane, vramGb, complete, downloading, hasErr<div className="flex items-center gap-2 mt-2.5 min-h-[var(--control-h-sm)]"><SizePill sizeGB={bundle.totalSizeGB} /><span className="text-[0.55rem] text-gray-400 dark:text-gray-500">{countLabel(bundle.files.length, 'file')}</span>- <FitHint fit={fit} />+ {!cardLine && <FitHint fit={fit} />}<div className="flex items-center gap-1 shrink-0 ml-auto">{complete ? (diff --git a/src/components/models/__tests__/bundle-tile-names-the-card.test.tsx b/src/components/models/__tests__/bundle-tile-names-the-card.test.tsxnew file mode 100644index 00000000..b1212bc4--- /dev/null+++ b/src/components/models/__tests__/bundle-tile-names-the-card.test.tsx@@ -0,0 +1,78 @@+import { describe, it, expect } from 'vitest'+import { renderToStaticMarkup } from 'react-dom/server'+import { BundleTile } from '../ModelTiles'+import { getImageBundles } from '../../../api/model-bundles'++// October 2026, the owner's 12 GB box: the catalogue said "10-16 GB" about+// Z-Image and the card stood five minutes in the load. The tile now compares+// the bundle with the detected card, in the place the fit hint always had.++const bundle = (name: string) => getImageBundles().find((b) => b.name === name)!++function tile(name: string, vramGb: number | null, sharedMemory = false): string {+ return renderToStaticMarkup(+ <BundleTile+ bundle={bundle(name)} vramGb={vramGb} sharedMemory={sharedMemory}+ complete={false} downloading={false} hasErrors={false}+ onInstall={() => {}} onRetry={() => {}} onClear={() => {}} onOpenUrl={() => {}}+ />,+ )+}++describe('a bundle tile compares itself with the detected card', () => {+ it('fits: says so and names the card', () => {+ const html = tile('Juggernaut XL V9 (Photorealistic)', 12)+ expect(html).toContain('data-bundle-fit="fits"')+ expect(html).toContain('Fits your 12 GB card')+ expect(html).toContain('bg-emerald-500/80')+ })++ it('tight: says it runs and what it costs', () => {+ const html = tile('Z-Image Turbo (Unfiltered, Fast)', 12)+ expect(html).toContain('data-bundle-fit="tight"')+ expect(html).toContain('Tight on your 12 GB card: runs, but loading takes minutes')+ expect(html).toContain('title="Runs from 10 GB. Loads fully into graphics memory from 16 GB."')+ expect(html).toContain('bg-sky-500/80')+ // Never red: a tight model is slow, not broken.+ expect(html).not.toMatch(/bg-red|text-red/)+ })++ it('needs more: says so, in the tone of slower and not of broken', () => {+ const html = tile('ERNIE-Image Turbo', 12)+ expect(html).toContain('data-bundle-fit="big"')+ expect(html).toContain('Needs more than your 12 GB card')+ expect(html).toContain('bg-orange-500/80')+ expect(html).not.toMatch(/bg-red|text-red/)+ })++ it('the same bundle reads differently on another card', () => {+ expect(tile('Z-Image Turbo (Unfiltered, Fast)', 8)).toContain('Needs more than your 8 GB card')+ expect(tile('Z-Image Turbo (Unfiltered, Fast)', 16)).toContain('Fits your 16 GB card')+ })++ it('exactly one hint per tile: the card line replaces the general one', () => {+ const html = tile('Z-Image Turbo (Unfiltered, Fast)', 12)+ expect(html).not.toContain('Tight fit')+ expect(html.match(/rounded-full bg-sky-500\/80/g)).toHaveLength(1)+ })++ it('without a detected card the tile stays as it was: no word about a card', () => {+ const html = tile('Z-Image Turbo (Unfiltered, Fast)', null)+ expect(html).not.toContain('data-bundle-fit')+ expect(html).not.toMatch(/card/)+ expect(html).toContain('Get · 19.3 GB')+ })++ it('shared memory (a Mac) has no card to name and keeps the general hint', () => {+ const html = tile('Z-Image Turbo (Unfiltered, Fast)', 32, true)+ expect(html).not.toContain('data-bundle-fit')+ expect(html).not.toMatch(/your 32 GB card/)+ expect(html).toContain('Runs on your PC')+ })++ it('a bundle whose text names no number claims nothing', () => {+ const html = tile('Krea 2 Companion Files (Text Encoder + VAE)', 12)+ expect(html).not.toContain('data-bundle-fit')+ expect(html).not.toMatch(/your 12 GB card/)+ })+})diff --git a/src/hooks/useGraphicsMemory.ts b/src/hooks/useGraphicsMemory.tsnew file mode 100644index 00000000..dd51487f--- /dev/null+++ b/src/hooks/useGraphicsMemory.ts@@ -0,0 +1,53 @@+/**+ * How much graphics memory this machine has, for the hints that compare a+ * model with it. One reading for the Model Manager and for Create, so the two+ * cannot name different cards.+ *+ * Two probes, best wins, exactly as the Model Manager always did it:+ * `detect_gpus` (nvidia-smi, rocm-smi, the Windows registry; works without+ * ComfyUI running) and the running ComfyUI's own /system_stats.+ *+ * The answer is kept for the life of the app. A card does not change while it+ * runs, `detect_gpus` shells out, and the waiting area mounts this on every+ * render. Nothing is kept while both probes come back empty, so a ComfyUI that+ * starts later is still asked.+ */+import { useEffect, useState } from 'react'+import { getMaxVramGb } from '../lib/hardware'+import { getSystemVRAM } from '../api/comfyui'+import { isMacOS } from '../api/backend'++let known: number | null = null++/** Forget the kept reading. Tests only. */+export function forgetGraphicsMemory(): void {+ known = null+}++/** Graphics memory in whole GB, null until a probe has answered. */+export function useGraphicsMemoryGb(): number | null {+ const [gb, setGb] = useState<number | null>(known)+ useEffect(() => {+ if (known !== null) return+ let alive = true+ const take = (v: number | null) => {+ if (!v || v <= 0) return+ known = Math.max(known ?? 0, Math.round(v))+ if (alive) setGb(known)+ }+ getMaxVramGb().then(take).catch(() => {})+ getSystemVRAM().then(take).catch(() => {})+ return () => { alive = false }+ }, [])+ return gb+}++/**+ * The same number, but only where it is a graphics card of its own. On a Mac+ * the figure is the memory pool the processor shares, and a line that says+ * "your 32 GB card" about it would name a card nobody owns.+ */+export function useGraphicsCardGb(): number | null {+ const gb = useGraphicsMemoryGb()+ return isMacOS() ? null : gb+}diff --git a/src/lib/__tests__/bundle-vram-need.test.ts b/src/lib/__tests__/bundle-vram-need.test.tsdeleted file mode 100644index 921f8ab9..00000000--- a/src/lib/__tests__/bundle-vram-need.test.ts+++ /dev/null@@ -1,67 +0,0 @@-import { describe, it, expect } from 'vitest'-import { bundleVramNeedGb } from '../hardware'-import { getImageBundles, getVideoBundles } from '../../api/discover'--// Counter-check on the Windows box, 2026-08-29, 12 GB card: "SDXL VAE-// (fp16-fix) · addon" (0.33 GB) and "Pixel Art XL · SDXL LoRA" (0.17 GB) both-// carried the red dot and the label "Too big for your GPU". Their requirement-// string is "any", the old parser found no digit in it and answered 99 GB.-//-// The tile's own verdict is `!vram ? unknown : need <= vram ? fits : need <=-// vram + 2 ? tight : big`, so these cases pin the number that verdict reads.--const fitOnGpu = (needGb: number, vramGb: number) =>- needGb <= vramGb ? 'fits' : needGb <= vramGb + 2 ? 'tight' : 'big'--describe('bundleVramNeedGb: what a bundle really asks of the GPU', () => {- it('reads the upper bound of a range', () => {- expect(bundleVramNeedGb({ vramRequired: '6-8 GB', totalSizeGB: 2.8 })).toBe(8)- expect(bundleVramNeedGb({ vramRequired: '10-12 GB', totalSizeGB: 14 })).toBe(12)- })-- it('reads a plus as two GB more than the number', () => {- expect(bundleVramNeedGb({ vramRequired: '12+ GB', totalSizeGB: 16.6 })).toBe(14)- expect(bundleVramNeedGb({ vramRequired: '24+ GB', totalSizeGB: 40 })).toBe(26)- })-- it('reads a plain number, prose around it included', () => {- expect(bundleVramNeedGb({ vramRequired: '24 GB', totalSizeGB: 24 })).toBe(24)- expect(bundleVramNeedGb({ vramRequired: '16 GB best, offloads on less', totalSizeGB: 20 })).toBe(16)- })-- it('"any" falls back to the download size, not to a made up ceiling', () => {- expect(bundleVramNeedGb({ vramRequired: 'any', totalSizeGB: 0.33 })).toBe(0.33)- expect(bundleVramNeedGb({ vramRequired: 'any', totalSizeGB: 0.17 })).toBe(0.17)- })-- it('a missing requirement and a missing size still yield a number', () => {- expect(bundleVramNeedGb({})).toBe(0)- expect(bundleVramNeedGb({ vramRequired: '' })).toBe(0)- })-- it('the two add-ons stop reading "Too big for your GPU" on a 12 GB card', () => {- const image = getImageBundles()- const vae = image.find(b => b.name === 'SDXL VAE (fp16-fix) · addon')!- const lora = image.find(b => b.name === 'Pixel Art XL · SDXL LoRA')!- expect(vae).toBeTruthy()- expect(lora).toBeTruthy()- expect(fitOnGpu(bundleVramNeedGb(vae), 12)).toBe('fits')- expect(fitOnGpu(bundleVramNeedGb(lora), 12)).toBe('fits')- // And on the smallest card we ship hints for.- expect(fitOnGpu(bundleVramNeedGb(vae), 4)).toBe('fits')- expect(fitOnGpu(bundleVramNeedGb(lora), 4)).toBe('fits')- })-- it('a genuinely huge bundle still reads big on a 12 GB card', () => {- const all = [...getImageBundles(), ...getVideoBundles()]- const heavy = all.find(b => b.vramRequired.includes('24'))!- expect(heavy).toBeTruthy()- expect(fitOnGpu(bundleVramNeedGb(heavy), 12)).toBe('big')- })-- it('no catalogue bundle answers with the old 99 GB placeholder', () => {- for (const b of [...getImageBundles(), ...getVideoBundles()]) {- expect(bundleVramNeedGb(b), b.name).toBeLessThan(99)- }- })-})diff --git a/src/lib/hardware.ts b/src/lib/hardware.tsindex ba0e522c..fc2634a9 100644--- a/src/lib/hardware.ts+++ b/src/lib/hardware.ts@@ -60,41 +60,6 @@ export async function isImageGenCapable(): Promise<boolean> {return meetsImageGenThreshold(vram, ram);}-// ─── Bundle VRAM requirement ────────────────────────────────────────--/** What a media bundle's `vramRequired` string is worth in GB.- *- * The catalogue writes this field for humans: "6-8 GB", "12+ GB",- * "16 GB best, offloads on less", and for the small add-ons simply "any".- * The old reader took the first number it found and fell back to 99 when it- * found none, so "any" meant 99 GB and the two add-ons (a 0.33 GB SDXL VAE- * and a 0.17 GB LoRA) were stamped "Too big for your GPU" on a 12 GB card- * (counter-check on the Windows box, 2026-08-29). A number the catalogue- * never wrote is not a reason to call a 170 MB LoRA too big.- *- * Order of trust: the number in the string, then the bundle's own download- * size (weights on disk are the honest floor for weights in VRAM), then 0,- * which reads as "nothing here says this will not fit" and only ever drives- * a hint, never a gate.- *- * - "6-8 GB" -> 8 (the upper bound is what it really wants)- * - "12+ GB" -> 14 (a plus means more than the number)- * - "8 GB" -> 8- * - "any" -> the bundle size, e.g. 0.33- */-export function bundleVramNeedGb(bundle: { vramRequired?: string; totalSizeGB?: number }): number {- const s = bundle.vramRequired ?? ''- if (s.includes('+')) {- const plus = s.match(/(\d+)\+/)- if (plus) return parseInt(plus[1]) + 2- }- const range = s.match(/(\d+)\s*-\s*(\d+)/)- if (range) return parseInt(range[2])- const single = s.match(/(\d+)/)- if (single) return parseInt(single[1])- return bundle.totalSizeGB ?? 0-}-// ─── AMD compute architecture ───────────────────────────────────────let cachedAmdArch: string | null | undefined = undefined;