The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(create): a model that is tight on your card says so where you pick it
purple281b16da6f27
diff --git a/e2e/model-fits-the-card.spec.ts b/e2e/model-fits-the-card.spec.tsnew file mode 100644index 00000000..fb613ebb--- /dev/null+++ b/e2e/model-fits-the-card.spec.ts@@ -0,0 +1,145 @@+import { test, expect, type Page } from '@playwright/test'+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'+import { seedOnboardingDone } from './support/cloud-mock'++/**+ * October 2026, the owner's box (RTX 3060, 12 GB): Z-Image stood more than+ * 300 s in "Loading the model into memory" and nothing had said beforehand+ * that the model is a tight fit there. A nachgebautes ComfyUI lists Z-Image+ * Turbo next to an SDXL checkpoint, and the Rust probe reports the card.+ *+ * (a) Models: every bundle card compares itself with the detected card.+ * (b) Without a detected card the cards say nothing about one.+ * (c) Create: the tight model says so on its row in the model picker, never at+ * the prompt field, and a load that runs past a minute names the reason.+ */++const ZIMAGE = 'z_image_turbo_bf16.safetensors'+const SDXL = 'Juggernaut-XL_v9.safetensors'++async function boot(page: Page, cardMib: number | null) {+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows' as const })+ await seedOnboardingDone(page)+ await page.addInitScript(([zimage, sdxl, mib]) => {+ const w = window as unknown as { __TAURI_INTERNALS__: { invoke: (c: string, a: { url?: string }) => Promise<unknown> } }+ if (!localStorage.getItem('create-store')) {+ localStorage.setItem('create-store', JSON.stringify({ state: { backend: 'local', imageModel: zimage }, version: 2 }))+ }+ const bridge = w.__TAURI_INTERNALS__+ const invoke = bridge.invoke+ const combo = (v: string[]) => [v]+ const nodes: Record<string, unknown> = {+ UNETLoader: { input: { required: { unet_name: combo([zimage as string]) } } },+ CheckpointLoaderSimple: { input: { required: { ckpt_name: combo([sdxl as string]) } } },+ CLIPLoader: { input: { required: { clip_name: combo(['qwen_3_4b.safetensors']) } } },+ VAELoader: { input: { required: { vae_name: combo(['ae.safetensors']) } } },+ KSampler: { input: { required: { sampler_name: combo(['euler']), scheduler: combo(['simple']) } } },+ }+ bridge.invoke = (command, args) => {+ if (command === 'detect_gpus') {+ return Promise.resolve(mib ? [{ index: 0, vendor: 'nvidia', name: 'RTX 3060', memory_mib: mib, source: 'fixture' }] : [])+ }+ if (command === 'sniff_model_files') return Promise.resolve([])+ if (command !== 'proxy_localhost' || !args?.url?.includes(':8188')) return invoke(command, args)+ const url = args.url+ // The card comes from the Rust probe alone, so (b) really has none.+ if (url.includes('/system_stats')) return Promise.resolve(JSON.stringify({ devices: [] }))+ const one = /\/object_info\/([^/?]+)/.exec(url)+ if (one) return Promise.resolve(JSON.stringify(one[1] in nodes ? { [one[1]]: nodes[one[1]] } : {}))+ if (url.includes('/object_info')) return Promise.resolve(JSON.stringify(nodes))+ return Promise.resolve('{}')+ }+ }, [ZIMAGE, SDXL, cardMib] as const)+}++const tile = (page: Page, name: string) => page.locator(`[data-bundle-tile="${name}"]`)++async function openImageCatalogue(page: Page) {+ await page.goto('/')+ await page.getByRole('button', { name: /^Models$/ }).first().click()+ await page.getByRole('button', { name: /^Image \d+$/ }).click()+}++test('Models: each bundle card compares itself with the detected 12 GB card', async ({ page }) => {+ await boot(page, 12288)+ await openImageCatalogue(page)++ const fits = tile(page, 'FLUX 2 Klein 4B (Next Gen)')+ await expect(fits).toBeVisible({ timeout: 20_000 })+ await expect(fits.locator('[data-bundle-fit="fits"]')).toHaveText('Fits your 12 GB card')+ // The companion files name no number, so their card claims nothing.+ const companion = tile(page, 'Krea 2 Companion Files (Text Encoder + VAE)')+ await expect(companion).toBeVisible()+ await expect(companion.locator('[data-bundle-fit]')).toHaveCount(0)++ const big = tile(page, 'ERNIE-Image Turbo')+ await expect(big.locator('[data-bundle-fit="big"]')).toHaveText('Needs more than your 12 GB card')++ await page.getByRole('button', { name: 'Unfiltered', exact: true }).click()+ const tight = tile(page, 'Z-Image Turbo (Unfiltered, Fast)')+ await expect(tight.locator('[data-bundle-fit="tight"]')).toHaveText('Tight on your 12 GB card: runs, but loading takes minutes')+ await expect(tight.locator('[data-bundle-fit]')).toHaveAttribute('title', 'Runs from 10 GB. Loads fully into graphics memory from 16 GB.')+ // The promise that did not hold on this card is gone from the card.+ await expect(tight).not.toContainText(/seconds per image/)++ // The line fits its card: nothing is cut off and nothing runs out of the tile.+ const inside = await tight.locator('[data-bundle-fit]').evaluate((el) => {+ const line = el.getBoundingClientRect()+ const box = el.closest('[data-bundle-tile]')!.getBoundingClientRect()+ return line.left >= box.left && line.right <= box.right && line.bottom <= box.bottom+ })+ expect(inside).toBe(true)+})++test('Models: without a detected card no bundle card names one', async ({ page }) => {+ await boot(page, null)+ await openImageCatalogue(page)+ await expect(tile(page, 'FLUX 2 Klein 4B (Next Gen)')).toBeVisible({ timeout: 20_000 })+ await expect(page.locator('[data-bundle-fit]')).toHaveCount(0)+ await expect(page.getByText(/your \d+ GB card/)).toHaveCount(0)+})++test('Create: the tight model says so in the picker, and a load past a minute names the reason', async ({ page }) => {+ await boot(page, 12288)+ await page.goto('/')+ await page.getByRole('button', { name: /^Create$/ }).click()+ await page.getByRole('radio', { name: 'Image', exact: true }).click()++ const picker = page.locator('button[aria-haspopup="listbox"]').first()+ await expect(picker).toContainText('z image turbo bf16', { timeout: 20_000 })+ // Closed: no word about the card anywhere, least of all at the prompt field.+ await expect(page.getByText(/your 12 GB card/)).toHaveCount(0)++ await picker.click()+ const list = page.locator('.lu-elevated')+ await expect(list).toBeVisible()+ await expect(list.getByRole('option', { name: /z image turbo bf16/ })).toContainText('Tight on your 12 GB card')+ const sdxlRow = list.getByRole('option', { name: /Juggernaut-XL v9/ })+ await expect(sdxlRow).toBeVisible()+ await expect(sdxlRow).not.toContainText(/card/)+ await expect(list.getByText(/your 12 GB card/)).toHaveCount(1)++ const prompt = page.locator('textarea').first()+ const around = await prompt.evaluate((el) => (el.closest('.rounded-\\[var\\(--radius-panel\\)\\]') ?? el.parentElement)?.textContent ?? '')+ expect(around).not.toMatch(/card|graphics memory/)+ await page.keyboard.press('Escape')+ await expect(list).toBeHidden()++ // The waiting area, in the load phase, on the app's own store.+ await page.clock.install()+ await page.evaluate(async () => {+ const path = '/src/stores/createStore.ts'+ const { useCreateStore } = await import(/* @vite-ignore */ path)+ const s = useCreateStore.getState()+ s.setIsGenerating(true)+ s.setProgressPhase('loading-model')+ s.setProgress(15, 'Loading model...')+ })+ await expect(page.getByText('Loading model...')).toBeVisible()+ await page.clock.runFor(13_000)+ await expect(page.getByText('Loading the model into memory...')).toBeVisible()+ await expect(page.getByTestId('slow-load-hint')).toHaveCount(0)+ await page.clock.runFor(48_000)+ await expect(page.getByTestId('slow-load-hint')).toHaveText('This model is a tight fit for your graphics memory, so loading is slow.')+ await expect(page.getByText('Loading the model into memory...')).toBeVisible()+})diff --git a/src/components/create/experimental/ModelChip.tsx b/src/components/create/experimental/ModelChip.tsxindex 78999ebe..63ff156e 100644--- a/src/components/create/experimental/ModelChip.tsx+++ b/src/components/create/experimental/ModelChip.tsx@@ -15,7 +15,9 @@ import { useUIStore } from '../../../stores/uiStore'import { useContentPolicy } from '../../../hooks/useContentPolicy'import { Select, type SelectOption } from '../ui/Select'import { TYPE_BADGE } from './badges'-import { resolveLocalOpPick, videoLaneModels } from '../../../api/comfyui'+import { useLocalPick } from './localPick'+import { useLocalModelFits } from '../../../hooks/useLocalModelFit'+import { vramFitLabel } from '../../../lib/vram-fit'// Portplan P7: lipsync/music/extend/motion reach the Studio track through the// SAME picker as their classic op-specialized twins, one list, matching what@@ -51,6 +53,9 @@ const NO_REFUSALS_COLOR = {// Local-mode discovery (2.5.8): hosted models ride at the bottom of the local// picker as teaser rows — picking one opens the Cloud sheet instead of// changing the selection. Value prefix keeps them apart from real checkpoints.+// The card mark on a local row wears the same quiet tone as "Open weights".+const FIT_MARK_COLOR = 'text-gray-500 dark:text-gray-600'+const TEASER_PREFIX = 'lu-cloud-teaser:'const TEASER_ROWS = 4@@ -196,16 +201,6 @@ function CloudModelChip() {}function LocalModelChip() {- const mode = useCreateStore((s) => s.mode)- const intent = useCreateStore((s) => s.intent())- const imageModel = useCreateStore((s) => s.imageModel)- const videoModel = useCreateStore((s) => s.videoModel)- const localOpModel = useCreateStore((s) => s.localOpModel)- const imageModelList = useCreateStore((s) => s.imageModelList)- const videoModelList = useCreateStore((s) => s.videoModelList)- const audioModelList = useCreateStore((s) => s.audioModelList)- const lipsyncModelList = useCreateStore((s) => s.lipsyncModelList)- const motionModelList = useCreateStore((s) => s.motionModelList)const setImageModel = useCreateStore((s) => s.setImageModel)const setVideoModel = useCreateStore((s) => s.setVideoModel)const setLocalOpModel = useCreateStore((s) => s.setLocalOpModel)@@ -213,28 +208,16 @@ function LocalModelChip() {const setCloudTeaser = useUIStore((s) => s.setCloudTeaser)const catalogModels = useCloudCatalogStore((s) => s.models)- const isVideo = mode === 'video'- // The 2.5.8 lanes with their own local model families. Extend is NOT here:- // it rides the regular i2v-capable video list (last-frame continue).- const laneList =- intent === 'music' ? audioModelList- : intent === 'lipsync' ? lipsyncModelList- : intent === 'motion' ? motionModelList- : null-- // Mirror the cloud picker's op-gating (David 2026-07-17: "only offer models- // that can actually do it"): Animate/Extend list i2v-capable local models,- // Video lists t2v-capable ones (SVD/FramePack are i2v-only and drop there).- // Shared with Stage's missing-models gate so card and picker cannot drift.- const rawList = isVideo ? videoModelList : imageModelList- const list = laneList ?? (!isVideo ? rawList : videoLaneModels(rawList, intent))- const stored = laneList ? localOpModel : (isVideo ? videoModel : imageModel)- // Reflect the model the run will really use — a leftover pick the current- // op can't perform must not show as "selected". Lanes share the submit-side- // rule (resolveLocalOpPick) so chip, meter and run always agree.- const value = laneList- ? resolveLocalOpPick(stored, list)- : list.some((m) => m.name === stored) ? stored : (list[0]?.name ?? stored)+ // Which model a run takes lives in localPick, shared with the waiting area.+ const { isVideo, laneList, list, value } = useLocalPick()+ // A model that does not sit comfortably on the detected card says so on its+ // row, here, where it is picked. Never at the prompt field. A model that+ // fits, and a machine without a detected card, add nothing.+ const { cardGb, fitOf } = useLocalModelFits(list)+ const fitMarks = (name: string) => {+ const fit = fitOf(name)+ return fit === 'tight' || fit === 'big' ? [{ label: vramFitLabel(fit, cardGb), color: FIT_MARK_COLOR }] : []+ }// Beste oben mit der Marke "Best", Aeltere gesammelt unten unter "Older// models", der Rest in gewohnter Reihenfolge. Wie im Cloud-Waehler; nichts@@ -245,7 +228,7 @@ function LocalModelChip() {label: prettyName(m.name),badge: TYPE_BADGE[m.type],group: tierGroup({ tier }),- tags: tierMarks({ tier }),+ tags: [...tierMarks({ tier }), ...fitMarks(m.name)],}))// Discovery rows: a few hosted models of this kind at the list's tail.// Picking one opens the Cloud sheet; the local selection stays untouched.diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsxindex 45f0b162..6a385444 100644--- a/src/components/create/experimental/OutputView.tsx+++ b/src/components/create/experimental/OutputView.tsx@@ -1,8 +1,11 @@import { itemHasAlpha } from '../../../lib/transparent-image'-import { useEffect, useState } from 'react'+import { useEffect, useMemo, useState } 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'+import { slowLoadHint } from '../../../lib/vram-fit'+import { useLocalModelFits } from '../../../hooks/useLocalModelFit'+import { useLocalPick } from './localPick'import { useCreateStore, type GalleryItem, type ProgressPhase } from '../../../stores/createStore'import { isMlxImageHost } from '../../../api/mlx-image'import { ICON_LG, ICON_STROKE_MARK } from '../../ui/icon-size'@@ -61,9 +64,22 @@ function ColdLoadLine() {const id = setInterval(() => setElapsedMs((ms) => ms + 1000), 1000)return () => clearInterval(id)}, [])+ // After a minute a model that does not sit comfortably on the card gets the+ // reason for the wait (the owner's 12 GB box, October 2026: Z-Image stood+ // here for more than 300 s and the line said nothing about why). Same clock,+ // same place, and silent for a model that fits or a card nobody detected.+ const { list, value } = useLocalPick()+ const picked = useMemo(() => list.filter((m) => m.name === value), [list, value])+ const { fitOf } = useLocalModelFits(picked)const hint = coldLoadHint(true, elapsedMs)if (!hint) return null- return <p className="t-body text-gray-500 text-center max-w-[22rem]">{hint}</p>+ const slow = slowLoadHint(fitOf(value), elapsedMs)+ return (+ <div className="space-y-1 text-center max-w-[22rem]">+ <p className="t-body text-gray-500">{hint}</p>+ {slow && <p className="t-body text-gray-500" data-testid="slow-load-hint">{slow}</p>}+ </div>+ )}// Generation progress — phase-aware animation.diff --git a/src/components/create/experimental/localPick.ts b/src/components/create/experimental/localPick.tsnew file mode 100644index 00000000..ebbb14eb--- /dev/null+++ b/src/components/create/experimental/localPick.ts@@ -0,0 +1,52 @@+// Which local model a run will really use, read once for the picker and for+// the waiting area, so the two cannot disagree about the model on the card.+import { useCreateStore } from '../../../stores/createStore'+import { resolveLocalOpPick, videoLaneModels, type ClassifiedModel } from '../../../api/comfyui'++export interface LocalPick {+ isVideo: boolean+ /** The lane's own model family (Music, Lip sync, Motion), null on the regular lists. */+ laneList: ClassifiedModel[] | null+ /** The models this intent can run, in the store's order. */+ list: ClassifiedModel[]+ /** The model a run takes now. */+ value: string+}++export function useLocalPick(): LocalPick {+ const mode = useCreateStore((s) => s.mode)+ const intent = useCreateStore((s) => s.intent())+ const imageModel = useCreateStore((s) => s.imageModel)+ const videoModel = useCreateStore((s) => s.videoModel)+ const localOpModel = useCreateStore((s) => s.localOpModel)+ const imageModelList = useCreateStore((s) => s.imageModelList)+ const videoModelList = useCreateStore((s) => s.videoModelList)+ const audioModelList = useCreateStore((s) => s.audioModelList)+ const lipsyncModelList = useCreateStore((s) => s.lipsyncModelList)+ const motionModelList = useCreateStore((s) => s.motionModelList)++ const isVideo = mode === 'video'+ // The 2.5.8 lanes with their own local model families. Extend is NOT here:+ // it rides the regular i2v-capable video list (last-frame continue).+ const laneList =+ intent === 'music' ? audioModelList+ : intent === 'lipsync' ? lipsyncModelList+ : intent === 'motion' ? motionModelList+ : null++ // Mirror the cloud picker's op-gating (David 2026-07-17: "only offer models+ // that can actually do it"): Animate/Extend list i2v-capable local models,+ // Video lists t2v-capable ones (SVD/FramePack are i2v-only and drop there).+ // Shared with Stage's missing-models gate so card and picker cannot drift.+ const rawList = isVideo ? videoModelList : imageModelList+ const list = laneList ?? (!isVideo ? rawList : videoLaneModels(rawList, intent))+ const stored = laneList ? localOpModel : (isVideo ? videoModel : imageModel)+ // Reflect the model the run will really use: a leftover pick the current+ // op can't perform must not show as "selected". Lanes share the submit-side+ // rule (resolveLocalOpPick) so chip, meter and run always agree.+ const value = laneList+ ? resolveLocalOpPick(stored, list)+ : list.some((m) => m.name === stored) ? stored : (list[0]?.name ?? stored)++ return { isVideo, laneList, list, value }+}diff --git a/src/hooks/useLocalModelFit.ts b/src/hooks/useLocalModelFit.tsnew file mode 100644index 00000000..6dd10604--- /dev/null+++ b/src/hooks/useLocalModelFit.ts@@ -0,0 +1,69 @@+/**+ * How each installed local media model stands on the user's graphics card, for+ * the model picker in Create and for the waiting area.+ *+ * The verdict is the catalogue's wherever the catalogue knows the file (a+ * bundle lists it, lib/vram-fit reads the bundle). A file no bundle names, or+ * one two bundles disagree about, is judged by its own size on the disk+ * against the card. Without a detected card (a Mac, or no vendor tool) every+ * answer is 'unknown' and nothing is asked of the disk.+ */+import { useEffect, useMemo, useState } from 'react'+import { useGraphicsCardGb } from './useGraphicsMemory'+import { readModelDiskSizes, type ClassifiedModel } from '../api/comfyui'+import {+ getImageBundles, getVideoBundles, getAudioBundles, getLipsyncBundles, getMotionBundles,+} from '../api/model-bundles'+import { needForInstalledFile, vramFit, fileVramFit, type VramFit } from '../lib/vram-fit'++const GIB = 1_073_741_824++let catalogue: ReturnType<typeof getImageBundles> | null = null+function allBundles() {+ catalogue ??= [+ ...getImageBundles(), ...getVideoBundles(), ...getAudioBundles(), ...getLipsyncBundles(), ...getMotionBundles(),+ ]+ return catalogue+}++export interface LocalModelFits {+ /** The detected card in GB, null when there is none to name. */+ cardGb: number | null+ fitOf: (name: string) => VramFit+}++export function useLocalModelFits(models: readonly ClassifiedModel[]): LocalModelFits {+ const cardGb = useGraphicsCardGb()+ const [diskGb, setDiskGb] = useState<Record<string, number>>({})++ // Only the files the catalogue cannot answer for are weighed.+ const unknown = useMemo(+ () => (cardGb === null ? [] : models.filter((m) => !needForInstalledFile(m.name, allBundles()))),+ [models, cardGb],+ )+ const unknownKey = unknown.map((m) => m.name).join('\n')+ useEffect(() => {+ if (unknown.length === 0) return+ let alive = true+ void readModelDiskSizes([...unknown]).then((sizes) => {+ if (!alive || sizes.size === 0) return+ setDiskGb((prev) => {+ const next = { ...prev }+ for (const [name, bytes] of sizes) next[name] = bytes / GIB+ return next+ })+ })+ return () => { alive = false }+ // The list is a new array on every store update; its names are what matter.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [unknownKey])++ return useMemo(() => ({+ cardGb,+ fitOf: (name: string): VramFit => {+ if (cardGb === null) return 'unknown'+ const need = needForInstalledFile(name, allBundles())+ return need ? vramFit(need, cardGb) : fileVramFit(diskGb[name], cardGb)+ },+ }), [cardGb, diskGb])+}