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): MiniMax H3 turbo LoRA as a one click download
purple3e9b6b8683e4
diff --git a/src/api/__tests__/comfyui-bundles.test.ts b/src/api/__tests__/comfyui-bundles.test.tsindex f3d702ec..e8b6ae97 100644--- a/src/api/__tests__/comfyui-bundles.test.ts+++ b/src/api/__tests__/comfyui-bundles.test.ts@@ -11,7 +11,7 @@ describe('Video Bundle Definitions', () => {bundles = getVideoBundles()})- it('has 17 video bundles', () => {+ it('has 18 video bundles', () => {// 14 original - Allegro (diffusers only) + CogVideoX 2B replaced by 5B I2V,// + Wan 2.2 TI2V-5B (unified T2V/I2V, 2026-06-11); 2.5.8 adds the two// uncensored GGUF finetunes (NSFW Wan 14B t2v + Wan 2.2 Rapid AIO i2v).@@ -19,7 +19,8 @@ describe('Video Bundle Definitions', () => {// (21 GB each) and Pyramid Flow, whose builders emitted node class names no// wrapper registers. See wrapper-node-names.test.ts. 2026-10-01 adds// MiniMax H3 (video with sound). 2026-10-02 adds LTX 2.5 and FastH3.- expect(bundles.length).toBe(17)+ // 2026-10-03 adds the MiniMax H3 turbo LoRA as an add-on.+ expect(bundles.length).toBe(18)})it('every bundle has required fields', () => {@@ -54,7 +55,7 @@ describe('Video Bundle Definitions', () => {it('every file has valid subfolder', () => {const validSubfolders = ['diffusion_models', 'vae', 'text_encoders', 'checkpoints', 'clip_vision',- 'latent_upscale_models', 'custom_nodes/ComfyUI-AnimateDiff-Evolved/models']+ 'latent_upscale_models', 'custom_nodes/ComfyUI-AnimateDiff-Evolved/models', 'loras']for (const b of bundles) {for (const f of b.files) {expect(validSubfolders).toContain(f.subfolder)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.tsnew file mode 100644index 00000000..887288d6--- /dev/null+++ b/src/api/__tests__/h3-turbo-lora-is-one-click.test.ts@@ -0,0 +1,129 @@+/**+ * The MiniMax H3 turbo LoRA is a catalog download (Discord 2026-10-03,+ * boromirofgeo: 3.0.4 said "put the turbo lora in the lora stack and it runs+ * at 8 steps", and he asked how the LoRA gets there).+ *+ * The file is the one the official Comfy-Org templates video_minimax_h3_t2v+ * and _i2v load. Read from the Hugging Face tree API and an anonymous HEAD on+ * 2026-10-03: Comfy-Org/MiniMax-H3, not gated, loras/minimax_h3_fl2v_turbo_+ * 8step_v1.0_comfyui_bf16.safetensors, 1956193000 bytes, and the origin repo+ * lightx2v/Minimax-h3-Turbo states the same sha256 for it.+ *+ * Run: npx vitest run src/api/__tests__/h3-turbo-lora-is-one-click.test.ts+ */+import { describe, it, expect, vi } from 'vitest'++vi.mock('../backend', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../backend')>()+ return { ...actual, backendCall: vi.fn(), localFetch: vi.fn(), comfyuiUrl: (p: string) => `http://test${p}` }+})++import { getVideoBundles, getLoraAddonBundles } from '../model-bundles'+import { lookupFileMeta, checkBundlesInstalled, onDiskMatchesCatalog } from '../discover'+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'+const BYTES = 1956193000+const GIB = 1024 ** 3++const turbo = () => getVideoBundles().find((b) => b.files.some((f) => f.filename === FILE))!++describe('the download entry is complete', () => {+ it('one file: URL, folder, size and sha256 as Hugging Face states them', () => {+ const b = turbo()+ expect(b).toBeDefined()+ expect(b.files).toHaveLength(1)+ const f = b.files[0]+ expect(f.downloadUrl).toBe(`https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/loras/${FILE}`)+ expect(f.filename).toBe(FILE)+ expect(f.subfolder).toBe('loras')+ expect(f.sizeBytes).toBe(BYTES)+ expect(f.sha256).toBe(SHA)+ // The shown size is the byte count in GiB, like the rest of the catalog.+ expect(f.sizeGB).toBeCloseTo(BYTES / GIB, 2)+ expect(b.totalSizeGB).toBe(f.sizeGB)+ })++ it('the folder is the one the LoRA stack reads', () => {+ expect(turbo().files[0].subfolder).toBe(subfolderForSource('lora'))+ })++ it('a retry or resume finds the same URL, folder and checksum', () => {+ const meta = lookupFileMeta(FILE)+ expect(meta).toMatchObject({ url: turbo().files[0].downloadUrl, subfolder: 'loras', sha256: SHA })+ })++ it('counts as installed only at exactly its size', async () => {+ const b = turbo()+ vi.mocked(backendCall).mockResolvedValueOnce([{ filename: FILE, exists: true, actualBytes: BYTES, complete: true }] as never)+ expect(await checkBundlesInstalled([b])).toEqual({ [b.name]: true })+ expect(vi.mocked(backendCall).mock.calls[0]).toEqual(['check_model_sizes', {+ files: [{ subfolder: 'loras', filename: FILE, expectedBytes: Math.round(1.82 * GIB) }],+ }])+ // The 4 step LoRA renamed by hand, or a cut download: not this file.+ expect(onDiskMatchesCatalog(b.files[0], { complete: true, actualBytes: BYTES - 8 })).toBe(false)+ })+})++describe('where it shows', () => {+ it('as an add-on of the H3 family, right behind the H3 bundle', () => {+ const all = getVideoBundles()+ const b = turbo()+ expect(b.name).toBe('MiniMax H3 Turbo LoRA · 8 Steps')+ expect(b.workflow).toBe('minimaxh3')+ expect(b.tier).toBe('best')+ expect(all[all.findIndex((x) => x.name === b.name) - 1].name).toBe('MiniMax H3 · Video with Sound')+ // 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')!))+ })++ it('on Models, LoRAs, Get new, next to the other catalog LoRA', () => {+ const names = getLoraAddonBundles().map((b) => b.name)+ expect(names).toContain('MiniMax H3 Turbo LoRA · 8 Steps')+ expect(names).toContain('Pixel Art XL · SDXL LoRA')+ for (const b of getLoraAddonBundles()) for (const f of b.files) expect(f.subfolder).toBe('loras')+ })++ it('is never the starter download of a video lane', () => {+ for (const intent of ['video', 'animate', 'extend']) {+ expect(bundleForVideoIntent(getVideoBundles(), intent)?.name).not.toBe(turbo().name)+ }+ expect(bundleForVideoIntent([turbo()], 'video')).toBeUndefined()+ })+})++describe('what the cards say', () => {+ it('the H3 bundle names the fastest way, in the two lines a card shows', () => {+ const h3 = getVideoBundles().find((b) => b.name === 'MiniMax H3 · Video with Sound')!+ expect(h3.description).toMatch(/Fastest way: add the MiniMax H3 Turbo LoRA, 8 steps instead of 20\./)+ expect(h3.description.length).toBeLessThanOrEqual(170)+ })++ it('the add-on says where to turn it on, FastH3 stays the prompt only route', () => {+ expect(turbo().description).toMatch(/LoRA stack/)+ expect(turbo().description).toMatch(/from a prompt or a first frame/)+ const fast = getVideoBundles().find((b) => b.name === 'FastH3 · MiniMax H3 in 8 Steps')!+ expect(fast.description).toMatch(/Text to video only/)+ })++ it('no dash characters in the new texts', () => {+ for (const text of [turbo().name, turbo().description, turbo().files[0].name, turbo().files[0].description]) {+ expect(text).not.toMatch(/[\u2013\u2014]/)+ }+ })+})++describe('once it is in the stack', () => {+ it('the name carries the step count the H3 builder reads, and it starts at strength 1', () => {+ expect(/turbo\D*?(\d+)\s*_?steps?/i.exec(FILE)?.[1]).toBe('8')+ expect(defaultLoraStrength(FILE)).toBe(1)+ // A LoRA file of the H3 family, not a second model in the video picker.+ expect(classifyModel(FILE)).toBe('minimaxh3')+ })+})diff --git a/src/api/model-bundles.ts b/src/api/model-bundles.tsindex fb1691b6..c8f6eee8 100644--- a/src/api/model-bundles.ts+++ b/src/api/model-bundles.ts@@ -683,6 +683,14 @@ const H3_SHARED_FILES: DiscoverModel[] = [},]+/** The catalog's LoRA add-ons: bundles that are nothing but files for+ * models/loras (Pixel Art XL, the MiniMax H3 turbo LoRA). Models, LoRAs,+ * Get new lists them, so a LoRA is found where LoRAs are. */+export function getLoraAddonBundles(): ModelBundle[] {+ return [...getImageBundles(), ...getVideoBundles()]+ .filter((b) => b.files.length > 0 && b.files.every((f) => f.subfolder === 'loras'))+}+export function getVideoBundles(): ModelBundle[] {return [{@@ -867,7 +875,7 @@ export function getVideoBundles(): ModelBundle[] {// the VRAM line.{name: 'MiniMax H3 · Video with Sound',- description: 'Video with its own sound track, speech, effects and music in one pass. From a prompt alone or from a first frame. Up to about 15 seconds at 24 fps.',+ description: 'Video with its own sound from a prompt or a first frame, up to about 15 seconds. Fastest way: add the MiniMax H3 Turbo LoRA, 8 steps instead of 20.',tags: ['MiniMax H3', 'Audio', '768p'],verified: true,totalSizeGB: 40.1,@@ -886,6 +894,35 @@ export function getVideoBundles(): ModelBundle[] {...H3_SHARED_FILES,],},+ // The 8 step turbo LoRA for MiniMax H3 (Discord 2026-10-03, boromirofgeo:+ // "how do I get the turbo lora into the stack"). The file is the one the+ // official templates video_minimax_h3_t2v and _i2v load with+ // LoraLoaderModelOnly at strength 1. Free to download, read from the+ // Hugging Face tree API and an anonymous HEAD on 2026-10-03: 1956193000+ // bytes, and lightx2v/Minimax-h3-Turbo (the origin) states the same digest.+ // It lands in models/loras, the LoRA stack lists it, and the H3 builder+ // reads the 8 steps from its name.+ {+ name: 'MiniMax H3 Turbo LoRA · 8 Steps',+ description: 'Add-on for MiniMax H3: 8 steps instead of 20, from a prompt or a first frame. After the download, turn it on in Create, Advanced settings, Expert, LoRA stack.',+ tags: ['MiniMax H3', 'LoRA', 'Addon'],+ totalSizeGB: 1.82,+ vramRequired: '24+ GB',+ workflow: 'minimaxh3',+ tier: 'best',+ url: 'https://huggingface.co/Comfy-Org/MiniMax-H3',+ files: [+ {+ name: 'MiniMax H3 Turbo LoRA (8 steps)',+ description: 'Step distillation LoRA for the MiniMax H3 fl2va model → models/loras.',+ pulls: '', tags: ['LoRA', '1.82 GB'], updated: 'New',+ downloadUrl: 'https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/loras/minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors',+ filename: 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors', subfolder: 'loras', sizeGB: 1.82,+ sizeBytes: 1956193000,+ sha256: '2339acdf19bfe123f46b971ea35d367a84adb85de43627e1eceafa5a5b2b111e',+ },+ ],+ },// FastH3 (FastVideo, 8 step distilled MiniMax H3). A full checkpoint of its// own, not a LoRA: FastVideo/FastVideo-FastH3-Comfy ships the distilled// weights as diffusion_models/fastvideo_fasth3_8step_v2_pruned_*.safetensors.diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsxindex fc9b20a1..fa20edd8 100644--- a/src/components/create/experimental/CreateContext.tsx+++ b/src/components/create/experimental/CreateContext.tsx@@ -235,6 +235,13 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {// twice on every connect.const charactersVersion = useCreateStore((s) => s.charactersVersion)useEffect(() => { void refreshModelLists() }, [charactersVersion, refreshModelLists])+ // A LoRA downloaded from Models while Create stays open (the MiniMax H3+ // turbo LoRA add-on, a CivitAI pick) shows up in the stack without a Rescan.+ useEffect(() => {+ const onDownloaded = () => { void refreshModelLists() }+ window.addEventListener('comfyui-model-downloaded', onDownloaded)+ return () => window.removeEventListener('comfyui-model-downloaded', onDownloaded)+ }, [refreshModelLists])// Rebuild the ComfyUI venv via the same status contract the installer uses,// narrating pip's progress (GH #98). Throws with the last log line on error.diff --git a/src/components/models/LoraAddons.tsx b/src/components/models/LoraAddons.tsxnew file mode 100644index 00000000..939755d1--- /dev/null+++ b/src/components/models/LoraAddons.tsx@@ -0,0 +1,102 @@+/**+ * The catalog's own LoRAs on Models, LoRAs, Get new: one click each, no search.+ *+ * Discord 2026-10-03 (boromirofgeo): 3.0.4 said "put the turbo lora in the+ * lora stack" and nobody said where the file comes from. The tiles are the+ * same ones the Image and Video tabs show for these add-ons, with the same+ * install path (size, sha256, models/loras), so there is one answer about+ * what is installed.+ */+import { useCallback, useEffect, useMemo, useState } from 'react'+import { getLoraAddonBundles, type ModelBundle } from '../../api/model-bundles'+import { checkBundlesInstalled, installBundleComplete, remoteBundleNotice } from '../../api/discover'+import { openExternal } from '../../api/backend'+import { bundleHasErrors, bundleIsComplete, bundleIsDownloading } from '../../lib/bundle-state'+import { useDownloadStore } from '../../stores/downloadStore'+import { BundleTile } from './ModelTiles'++const GIB = 1_073_741_824++export function LoraAddons({ search = '' }: { search?: string }) {+ const bundles = useMemo(() => getLoraAddonBundles(), [])+ const downloads = useDownloadStore((s) => s.downloads)+ const [onDisk, setOnDisk] = useState<Record<string, boolean>>({})+ const [starting, setStarting] = useState<string | null>(null)+ const [message, setMessage] = useState<{ text: string; failed: boolean } | null>(null)++ const refresh = useCallback(() => {+ void checkBundlesInstalled(bundles).then(setOnDisk)+ }, [bundles])+ useEffect(() => {+ refresh()+ window.addEventListener('comfyui-model-downloaded', refresh)+ return () => window.removeEventListener('comfyui-model-downloaded', refresh)+ }, [refresh])++ const install = async (bundle: ModelBundle) => {+ if (starting) return+ setStarting(bundle.name)+ setMessage(null)+ const store = useDownloadStore.getState()+ const names: string[] = []+ for (const f of bundle.files) {+ if (!f.downloadUrl || !f.filename || !f.subfolder) continue+ store.setMeta(f.filename, f.downloadUrl, f.subfolder, undefined, {+ expectedBytes: f.sizeGB ? Math.round(f.sizeGB * GIB) : undefined,+ sha256: f.sha256,+ })+ names.push(f.filename)+ }+ store.setBundleGroup(bundle.name, names)+ store.startPolling()+ try {+ const report = await installBundleComplete(bundle)+ if (report.remote) setMessage({ text: remoteBundleNotice(bundle.name, report.remote), failed: false })+ } catch (err) {+ setMessage({ text: `${bundle.name}: ${err instanceof Error ? err.message : String(err)}`, failed: true })+ }+ // The tile stays on "Installing" until the download row is in the store,+ // so it never flips back to Get for the length of one poll.+ await useDownloadStore.getState().refresh().catch(() => {})+ setStarting(null)+ }++ /** A failed row has to be cleared on the Rust side first, which the store's+ * retry does; anything else is a fresh start. */+ const retry = (bundle: ModelBundle) => {+ const failed = bundle.files.filter((f) => f.filename && downloads[f.filename]?.status === 'error')+ if (failed.length === 0) { void install(bundle); return }+ for (const f of failed) void useDownloadStore.getState().retry(f.filename!)+ }++ const q = search.trim().toLowerCase()+ const shown = q+ ? bundles.filter((b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q))+ : bundles+ if (shown.length === 0) return null++ return (+ <section className="space-y-1.5" data-testid="lora-addons">+ <h3 className="px-1 t-micro font-semibold uppercase tracking-[0.12em] text-gray-700 dark:text-gray-300">Ready to install</h3>+ <div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-2.5">+ {shown.map((bundle) => (+ <BundleTile+ key={bundle.name}+ bundle={bundle}+ vramGb={null}+ complete={bundleIsComplete(bundle.files, downloads, onDisk[bundle.name] === true)}+ downloading={bundleIsDownloading(bundle.files, downloads) || starting === bundle.name}+ hasErrors={bundleHasErrors(bundle.files, downloads, onDisk[bundle.name] === true)}+ onInstall={() => { void install(bundle) }}+ onRetry={() => retry(bundle)}+ onClear={() => { for (const f of bundle.files) if (f.filename) useDownloadStore.getState().dismiss(f.filename) }}+ onOpenUrl={(u) => { void openExternal(u) }}+ />+ ))}+ </div>+ {message && (+ <p className={`px-1 t-micro ${message.failed ? 'text-red-500' : 'text-gray-500 dark:text-gray-400'}`}>{message.text}</p>+ )}+ </section>+ )+}diff --git a/src/components/models/LoraManager.tsx b/src/components/models/LoraManager.tsxindex 0934ec69..7a1fbdd8 100644--- a/src/components/models/LoraManager.tsx+++ b/src/components/models/LoraManager.tsx@@ -52,7 +52,7 @@ export function LoraManager({ rows, total, searchQuery, onDelete, onGetNew }: Pr<div className="space-y-1"><p className="t-control text-gray-800 dark:text-gray-200">No LoRAs installed yet</p><p className="t-micro text-gray-500 max-w-[300px] leading-relaxed">- Get new searches CivitAI and puts what you pick into ComfyUI's models/loras folder. {LORA_USE_HINT}+ Get new has ready-made LoRAs and a CivitAI search. What you pick lands in ComfyUI's models/loras folder. {LORA_USE_HINT}</p></div><buttondiff --git a/src/components/models/ModelManager.tsx b/src/components/models/ModelManager.tsxindex 96da4918..a76e6635 100644--- a/src/components/models/ModelManager.tsx+++ b/src/components/models/ModelManager.tsx@@ -14,6 +14,7 @@ import { PullModelDialog } from './PullModelDialog'import { DiscoverModels } from './DiscoverModels'import { CivitaiSearchPanel } from './CivitaiSearchPanel'import { LoraManager, LORA_USE_HINT, type LoraRow } from './LoraManager'+import { LoraAddons } from './LoraAddons'import { Modal } from '../ui/Modal'import { GlowButton } from '../ui/GlowButton'import { showModel } from '../../api/ollama'@@ -630,6 +631,7 @@ export function ModelManager() {<p className="px-1 t-micro text-gray-500 dark:text-gray-500">Downloads land in ComfyUI's models/loras folder. {LORA_USE_HINT}</p>+ <LoraAddons search={searchQuery} /><CivitaiSearchPanelmodelType="LORA"title="Search CivitAI for LoRAs"diff --git a/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx b/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsxindex 61f543af..d3503bc2 100644--- a/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx+++ b/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx@@ -32,6 +32,7 @@ const searchCivitaiModels = vi.fn(const startModelDownload = vi.fn(async (_url: string, _subfolder: string, _filename: string) => ({ status: 'ok', id: '1' }),)+const installBundleComplete = vi.fn(async (_name: string) => ({}))const setActiveModel = vi.fn(async () => {})const fetchModels = vi.fn(async () => {})let macHost = false@@ -51,6 +52,11 @@ vi.mock('../../../api/discover', () => ({// that is exactly one startModelDownload (api/discover).startCivitaiDownload: (m: { downloadUrl: string; subfolder: string; filename: string }) =>startModelDownload(m.downloadUrl, m.subfolder, m.filename),+ // The catalog LoRAs above the search (LoraAddons) ask what is on disk and+ // install through the bundle path.+ checkBundlesInstalled: async () => ({}),+ installBundleComplete: (b: { name: string }) => installBundleComplete(b.name),+ remoteBundleNotice: () => '',}))vi.mock('../../../api/comfyui', () => ({checkComfyConnection: vi.fn(async () => comfyLaeuft),@@ -322,6 +328,21 @@ describe('Get new unter LoRAs', () => {expect(startModelDownload.mock.calls[0][1]).toBe('loras')expect(startModelDownload.mock.calls[0][2]).toBe('pixel_art_xl.safetensors')})++ // Discord 2026-10-03 (boromirofgeo): where does the H3 turbo LoRA come from.+ it('die Katalog-LoRAs stehen ueber der Suche, ein Klick installiert', async () => {+ render(createElement(ModelManager))+ fireEvent.click(screen.getByRole('button', { name: /^LoRAs/ }))+ fireEvent.click(screen.getByRole('button', { name: /^Get new/ }))+ const liste = await screen.findByTestId('lora-addons')+ const karte = liste.querySelector('[data-bundle-tile="MiniMax H3 Turbo LoRA · 8 Steps"]') as HTMLElement+ expect(karte).toBeTruthy()+ // Above the CivitAI card, not below it.+ const suche = screen.getByLabelText('Search CivitAI for LoRAs')+ expect(liste.compareDocumentPosition(suche) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()+ fireEvent.click(within(karte).getByRole('button', { name: /Get/ }))+ await waitFor(() => expect(installBundleComplete).toHaveBeenCalledWith('MiniMax H3 Turbo LoRA · 8 Steps'))+ })})describe('der Bild-Reiter ist die LoRAs los', () => {diff --git a/src/components/models/__tests__/lora-addons-ein-klick.test.tsx b/src/components/models/__tests__/lora-addons-ein-klick.test.tsxnew file mode 100644index 00000000..a40ccec5--- /dev/null+++ b/src/components/models/__tests__/lora-addons-ein-klick.test.tsx@@ -0,0 +1,132 @@+/**+ * @vitest-environment jsdom+ *+ * Models, LoRAs, Get new lists the catalog's own LoRAs with one click each+ * (Discord 2026-10-03, boromirofgeo: how does the MiniMax H3 turbo LoRA get+ * into the stack). Measured on the rendered list: the tile, the click, what+ * the download is told (folder, size, sha256) and the three tile states.+ *+ * Run: npx vitest run src/components/models/__tests__/lora-addons-ein-klick.test.tsx+ */+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'+import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react'+import type { ModelBundle } from '../../../api/model-bundles'++const installBundleComplete = vi.fn(async (_b: ModelBundle) => ({} as { remote?: unknown }))+const checkBundlesInstalled = vi.fn(async (_b: ModelBundle[]) => ({} as Record<string, boolean>))++vi.mock('../../../api/backend', () => ({ openExternal: vi.fn(), backendCall: vi.fn(), isTauri: () => false }))+vi.mock('../../../api/discover', () => ({+ installBundleComplete: (b: ModelBundle) => installBundleComplete(b),+ checkBundlesInstalled: (b: ModelBundle[]) => checkBundlesInstalled(b),+ remoteBundleNotice: (name: string) => `${name}: saved here, copy it over`,+}))++type Row = { status: string; progress?: number; total?: number }+const store = {+ downloads: {} as Record<string, Row>,+ setMeta: vi.fn(),+ setBundleGroup: vi.fn(),+ startPolling: vi.fn(),+ refresh: vi.fn(async () => {}),+ retry: vi.fn(async () => {}),+ dismiss: vi.fn(),+}+vi.mock('../../../stores/downloadStore', () => {+ const useDownloadStore = Object.assign(+ (pick: (s: typeof store) => unknown) => pick(store),+ { getState: () => store },+ )+ return { useDownloadStore }+})++import { LoraAddons } from '../LoraAddons'++const TURBO = 'MiniMax H3 Turbo LoRA · 8 Steps'+const FILE = 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors'+const tile = (name: string) => document.querySelector(`[data-bundle-tile="${name}"]`) as HTMLElement++beforeEach(() => {+ store.downloads = {}+ for (const f of [store.setMeta, store.setBundleGroup, store.startPolling, store.refresh, store.retry, store.dismiss]) f.mockClear()+ installBundleComplete.mockReset().mockResolvedValue({})+ checkBundlesInstalled.mockReset().mockResolvedValue({})+})+afterEach(cleanup)++describe('the list', () => {+ it('shows the H3 turbo LoRA and Pixel Art XL, each with its size', async () => {+ render(<LoraAddons />)+ await waitFor(() => expect(checkBundlesInstalled).toHaveBeenCalled())+ 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(/LoRA stack/)+ })++ it('follows the header search and disappears when nothing matches', async () => {+ const { rerender } = render(<LoraAddons search="turbo" />)+ await waitFor(() => expect(checkBundlesInstalled).toHaveBeenCalled())+ expect(tile(TURBO)).toBeTruthy()+ expect(tile('Pixel Art XL · SDXL LoRA')).toBeNull()+ rerender(<LoraAddons search="film grain" />)+ expect(screen.queryByText('Ready to install')).toBeNull()+ })+})++describe('one click', () => {+ it('starts the install of exactly that bundle, with folder, size and sha256 on the download row', async () => {+ render(<LoraAddons />)+ await waitFor(() => expect(checkBundlesInstalled).toHaveBeenCalled())+ fireEvent.click(within(tile(TURBO)).getByRole('button', { name: /Get/ }))+ await waitFor(() => expect(installBundleComplete).toHaveBeenCalledTimes(1))+ expect(installBundleComplete.mock.calls[0][0].name).toBe(TURBO)+ expect(store.setMeta).toHaveBeenCalledWith(+ FILE,+ `https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/loras/${FILE}`,+ 'loras',+ undefined,+ { expectedBytes: Math.round(1.82 * 1024 ** 3), sha256: '2339acdf19bfe123f46b971ea35d367a84adb85de43627e1eceafa5a5b2b111e' },+ )+ expect(store.setBundleGroup).toHaveBeenCalledWith(TURBO, [FILE])+ expect(store.startPolling).toHaveBeenCalled()+ })++ it('a failed install says why, in the list', async () => {+ installBundleComplete.mockRejectedValue(new Error('Not enough space on this drive.'))+ render(<LoraAddons />)+ await waitFor(() => expect(checkBundlesInstalled).toHaveBeenCalled())+ fireEvent.click(within(tile(TURBO)).getByRole('button', { name: /Get/ }))+ expect(await screen.findByText(`${TURBO}: Not enough space on this drive.`)).toBeTruthy()+ })+})++describe('the tile states', () => {+ it('Installed when the file is on disk at its size', async () => {+ checkBundlesInstalled.mockResolvedValue({ [TURBO]: true })+ render(<LoraAddons />)+ expect(await within(tile(TURBO)).findByText('Installed')).toBeTruthy()+ expect(within(tile(TURBO)).queryByRole('button', { name: /Get/ })).toBeNull()+ })++ it('Installing while the download runs, and the disk is asked again when it is done', async () => {+ store.downloads = { [FILE]: { status: 'downloading', progress: 1, total: 2 } }+ render(<LoraAddons />)+ expect(await within(tile(TURBO)).findByText(/Installing/)).toBeTruthy()+ const before = checkBundlesInstalled.mock.calls.length+ window.dispatchEvent(new CustomEvent('comfyui-model-downloaded'))+ await waitFor(() => expect(checkBundlesInstalled.mock.calls.length).toBe(before + 1))+ })++ it('Retry after an error goes through the store, which clears the failed row first', async () => {+ store.downloads = { [FILE]: { status: 'error' } }+ render(<LoraAddons />)+ await waitFor(() => expect(checkBundlesInstalled).toHaveBeenCalled())+ fireEvent.click(within(tile(TURBO)).getByRole('button', { name: /Retry/ }))+ expect(store.retry).toHaveBeenCalledWith(FILE)+ expect(installBundleComplete).not.toHaveBeenCalled()+ fireEvent.click(within(tile(TURBO)).getByRole('button', { name: /Clear/ }))+ expect(store.dismiss).toHaveBeenCalledWith(FILE)+ })+})diff --git a/src/lib/render/__tests__/local-model-tier.test.ts b/src/lib/render/__tests__/local-model-tier.test.tsindex 99308862..62200203 100644--- a/src/lib/render/__tests__/local-model-tier.test.ts+++ b/src/lib/render/__tests__/local-model-tier.test.ts@@ -25,8 +25,8 @@ const mainFile = (b: ModelBundle) =>const tierOfFile = (name: string) => localTier({ name, type: classifyModel(name) })describe('jedes lokale Bundle traegt eine Stufe', () => {- it('alle 38 Bundles haben best, standard oder older', () => {- expect(ALL.length).toBe(38)+ it('alle 39 Bundles haben best, standard oder older', () => {+ expect(ALL.length).toBe(39)for (const b of ALL) expect(['best', 'standard', 'older'], b.name).toContain(b.tier)})