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(create): the LoRA stack offers a catalogue LoRA only where its family runs
purpleab659198c640
diff --git a/e2e/lora-stack-follows-the-folder.spec.ts b/e2e/lora-stack-follows-the-folder.spec.tsindex ce4c4ad2..88fd5378 100644--- a/e2e/lora-stack-follows-the-folder.spec.ts+++ b/e2e/lora-stack-follows-the-folder.spec.ts@@ -121,6 +121,36 @@ test('a Z-Image character on an SDXL checkpoint says so and is not counted', asyawait expect(row.locator('xpath=..').getByRole('slider')).toHaveCount(0)})+// Found on 2026-10-03: after the download of the MiniMax H3 Turbo LoRA the+// stack offered it on the image model Z-Image too, with its long file name+// cut off. A LoRA from the catalogue is listed where its family runs, under+// its catalogue name.+const H3_TURBO = 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors'+const PIXEL = 'pixel-art-xl.safetensors'++test('Z-Image is not offered the MiniMax H3 turbo LoRA or the SDXL LoRA from the catalogue', async ({ page }) => {+ await bootWithFakeComfy(page, [STYLE, H3_TURBO, PIXEL, CHAR], 'z_image_turbo_bf16.safetensors')+ await openStack(page)+ await expect(page.getByRole('button', { name: /film_grain_xl/ })).toBeVisible()+ await expect(page.getByRole('button', { name: /char_mira_zimage/ })).toBeVisible()+ await expect(page.getByText(/minimax_h3/i)).toHaveCount(0)+ await expect(page.getByText(/MiniMax H3 Turbo LoRA/)).toHaveCount(0)+ await expect(page.getByText(/Pixel Art XL/)).toHaveCount(0)+})++test('an SDXL checkpoint is offered Pixel Art XL under its catalogue name, and the run gets the file name', async ({ page }) => {+ await bootWithFakeComfy(page, [STYLE, H3_TURBO, PIXEL], 'juggernautXL.safetensors')+ await openStack(page)+ const row = page.getByRole('button', { name: /Pixel Art XL · SDXL LoRA/ })+ await expect(row).toBeVisible()+ await expect(row).toHaveAttribute('title', PIXEL)+ await expect(page.getByText(/MiniMax H3 Turbo LoRA/)).toHaveCount(0)+ await row.click()+ await expect(page.getByText('· 1 active')).toBeVisible()+ await expect(page.getByRole('textbox', { name: 'Strength of Pixel Art XL · SDXL LoRA' })).toHaveValue('0.80')+ await expect.poll(() => saved(page)).toEqual([{ name: PIXEL, strength: 0.8 }])+})+test('a render that left a LoRA out says so under the result', async ({ page }) => {// Gegenprobe 8 (02.10.): the "Skipping LoRA" progress line was gone a// second later, so the picture looked as if the style had been applied.diff --git a/src/components/create/experimental/LoraStrength.tsx b/src/components/create/experimental/LoraStrength.tsxindex 7fdc8860..c0d838da 100644--- a/src/components/create/experimental/LoraStrength.tsx+++ b/src/components/create/experimental/LoraStrength.tsx@@ -6,7 +6,8 @@ import {} from '../../../lib/lora-strength'interface Props {- /** The LoRA file this strength belongs to, for the field's accessible name. */+ /** The LoRA this strength belongs to, as its row names it (a file name or+ * a catalogue name), for the field's accessible name. */name: stringvalue: numberonChange: (v: number) => voiddiff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsxindex 9385ac27..341c0403 100644--- a/src/components/create/experimental/ParamGroups.tsx+++ b/src/components/create/experimental/ParamGroups.tsx@@ -17,7 +17,7 @@ import { Button } from '../ui/Button'import { Tooltip } from '../ui/Tooltip'import { cn } from '../ui/cn'import { HINWEIS_TEXT } from '../../../lib/hinweis'-import { lorasForRun, loraFitsModel } from '../../../lib/lora-stack'+import { lorasForRun, loraRows } from '../../../lib/lora-stack'import { LoraStrength } from './LoraStrength'import { supportsTransparent } from '../../../lib/transparent-image'import { QWEN_ENCODER_HELP, pickQwenEncoder, qwenEncoderOptions, type QwenEncoderVariant } from '../../../lib/render/qwen-text-encoder'@@ -67,6 +67,7 @@ export function ParamGroups() {const laneModel = isVideo ? s.videoModel : s.imageModelconst laneType = (isVideo ? s.videoModelList : s.imageModelList).find((m) => m.name === laneModel)?.type ?? classifyModel(laneModel)const activeLoras = lorasForRun(s.selectedLoras, loraList, laneType).use.length+ const stackRows = loraRows(loraList, s.selectedLoras, laneType)// On cloud the worker only honours steps for images and guidance_scale for// the flux family — hide the sliders elsewhere rather than show a dead@@ -320,22 +321,27 @@ export function ParamGroups() {</div>{loraList.length === 0 ? (<div className="t-control text-gray-600">No LoRAs found yet. Drop .safetensors files into ComfyUI's models/loras folder and hit Rescan. Characters trained in Character Studio land there automatically.</div>+ ) : stackRows.length === 0 ? (+ <div className="t-control text-gray-600">The LoRAs in models/loras are made for other models. Pick the model they belong to, or drop in a LoRA for this one and hit Rescan.</div>) : (<div className="space-y-1 max-h-44 overflow-y-auto scrollbar-thin">{/* Gegenprobe 8 (02.10.): "Z-Image only" showed only after a- click, and the strength had no number next to it. */}- {loraList.map((name) => {+ click, and the strength had no number next to it.+ 03.10.: the H3 turbo LoRA was offered on an image model, and+ its file name was cut off. A LoRA from the catalogue is+ listed where its family runs, under its catalogue name, with+ the file name as the tooltip (lib/lora-stack.ts). */}+ {stackRows.map(({ name, label, file, fits, familyLabel }) => {const active = s.selectedLoras.find((l) => l.name === name)- const fits = loraFitsModel(name, laneType)return (<div key={name} className={cn('rounded-md border transition-colors', active ? 'border-white/15 bg-white/[0.06]' : 'border-white/[0.06]')}>- <button onClick={() => s.toggleLora(name)} className="w-full flex items-center justify-between px-2.5 py-1.5 t-control text-left text-gray-300">- <span className="truncate">{name.replace(/\.safetensors$/, '')}</span>- <span className={cn('t-mono', active && fits ? 'text-emerald-400' : 'text-gray-600')}>{fits ? (active ? 'on' : 'off') : 'Z-Image only'}</span>+ <button onClick={() => s.toggleLora(name)} title={file} className="w-full flex items-center justify-between gap-2 px-2.5 py-1.5 t-control text-left text-gray-300">+ <span className="truncate">{label}</span>+ <span className={cn('t-mono shrink-0', active && fits ? 'text-emerald-400' : 'text-gray-600')}>{fits ? (active ? 'on' : 'off') : `${familyLabel} only`}</span></button>{active && fits && (<div className="px-2.5 pb-2">- <LoraStrength name={name} value={active.strength} onChange={(v) => s.setLoraStrengthFor(name, v)} />+ <LoraStrength name={label} value={active.strength} onChange={(v) => s.setLoraStrengthFor(name, v)} /></div>)}</div>diff --git a/src/components/create/experimental/__tests__/lora-stapel-familie-oberflaeche.test.tsx b/src/components/create/experimental/__tests__/lora-stapel-familie-oberflaeche.test.tsxnew file mode 100644index 00000000..fd5e674c--- /dev/null+++ b/src/components/create/experimental/__tests__/lora-stapel-familie-oberflaeche.test.tsx@@ -0,0 +1,88 @@+// @vitest-environment jsdom+/**+ * The LoRA stack in the Expert settings offers a LoRA from the catalogue only+ * where its family runs (03.10.2026): the MiniMax H3 turbo LoRA showed up on+ * the image model Z-Image, with its long file name cut off.+ *+ * The rule is lib/lora-stack.ts and has its own test. Here the real+ * ParamGroups is rendered with the real classifier, for the video lane the+ * Playwright spec (e2e/lora-stack-follows-the-folder.spec.ts) does not reach.+ */+import { afterEach, describe, expect, it, vi } from 'vitest'+import { cleanup, fireEvent, render, screen } from '@testing-library/react'++const lists = vi.hoisted(() => ({ loras: [] as string[] }))+vi.mock('../../../../api/mlx-image', () => ({ isMlxImageHost: () => false }))+vi.mock('../CreateContext', () => ({+ useCreateExp: () => ({+ samplerList: [], schedulerList: [], loraList: lists.loras, vaeList: [], refreshModelLists: vi.fn(),+ }),+}))++import { ParamGroups } from '../ParamGroups'+import { useCreateStore } from '../../../../stores/createStore'+import { classifyModel } from '../../../../api/comfyui'++const H3_TURBO = 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors'+const TURBO_NAME = 'MiniMax H3 Turbo LoRA · 8 Steps'+const STYLE = 'film_grain_xl.safetensors'+const H3 = 'minimax_h3_fl2va_bf16.safetensors'+const Z_IMAGE = 'z_image_turbo_bf16.safetensors'++function setup(mode: 'image' | 'video', model: string, loras: string[], picks: string[] = []) {+ lists.loras = loras+ useCreateStore.setState({+ backend: 'local', isGenerating: false, cloudOp: null, utilityOp: null, removebg: false,+ selectedLoras: picks.map((name) => ({ name, strength: 0.8 })),+ imageModel: mode === 'image' ? model : '', imageModelList: mode === 'image' ? [{ name: model, type: classifyModel(model) }] : [],+ videoModel: mode === 'video' ? model : '', videoModelList: mode === 'video' ? [{ name: model, type: classifyModel(model) }] : [],+ } as never)+ useCreateStore.getState().setIntent(mode === 'video' ? 'video' : 'image')+ render(<ParamGroups />)+ fireEvent.click(screen.getByRole('button', { name: 'Expert' }))+}+/** The rows of the stack: the buttons whose tooltip is a LoRA file name. */+const rowNames = () => screen.getAllByRole('button').filter((b) => /\.safetensors$/.test(b.getAttribute('title') ?? '')).map((b) => b.textContent)++afterEach(() => { cleanup() })++describe('the LoRA stack and the MiniMax H3 turbo LoRA', () => {+ it('MiniMax H3 lists it under its catalogue name, the file name is the tooltip', () => {+ setup('video', H3, [STYLE, H3_TURBO])+ const row = screen.getByRole('button', { name: new RegExp(TURBO_NAME) })+ expect(row.getAttribute('title')).toBe(H3_TURBO)+ expect(screen.queryByText(/minimax_h3_fl2v_turbo/)).toBeNull()+ expect(rowNames()).toEqual(['film_grain_xloff', `${TURBO_NAME}off`])+ })++ it('ticking it there counts it and stores the file name', () => {+ setup('video', H3, [STYLE, H3_TURBO])+ fireEvent.click(screen.getByRole('button', { name: new RegExp(TURBO_NAME) }))+ expect(useCreateStore.getState().selectedLoras.map((l) => l.name)).toEqual([H3_TURBO])+ expect(screen.getByText('· 1 active')).toBeTruthy()+ expect(screen.getByRole('textbox', { name: `Strength of ${TURBO_NAME}` })).toBeTruthy()+ })++ it('the reported case: Z-Image does not list it', () => {+ setup('image', Z_IMAGE, [STYLE, H3_TURBO])+ expect(rowNames()).toEqual(['film_grain_xloff'])+ expect(screen.queryByText(new RegExp(TURBO_NAME))).toBeNull()+ })++ it('still ticked from a video run: Z-Image shows it as not for this model, does not count it, and it can be turned off', () => {+ setup('image', Z_IMAGE, [STYLE, H3_TURBO], [H3_TURBO])+ const row = screen.getByRole('button', { name: new RegExp(TURBO_NAME) })+ expect(row.textContent).toBe(`${TURBO_NAME}MiniMax H3 only`)+ expect(screen.queryByText(/active/)).toBeNull()+ expect(screen.queryByRole('textbox', { name: /Strength of/ })).toBeNull()+ fireEvent.click(row)+ expect(useCreateStore.getState().selectedLoras).toEqual([])+ expect(screen.queryByText(new RegExp(TURBO_NAME))).toBeNull()+ })++ it('only LoRAs of other families in the folder: the stack says so instead of showing an empty list', () => {+ setup('image', Z_IMAGE, [H3_TURBO])+ expect(screen.getByText(/The LoRAs in models\/loras are made for other models\./)).toBeTruthy()+ expect(rowNames()).toEqual([])+ })+})diff --git a/src/components/create/experimental/__tests__/lora-strength-feld.test.tsx b/src/components/create/experimental/__tests__/lora-strength-feld.test.tsxindex fb02ffb1..f35d99e6 100644--- a/src/components/create/experimental/__tests__/lora-strength-feld.test.tsx+++ b/src/components/create/experimental/__tests__/lora-strength-feld.test.tsx@@ -130,7 +130,9 @@ describe('the slider next to it', () => {describe('the LoRA stack', () => {it('draws this control for every active LoRA and writes into the store per name', () => {const src = readFileSync(resolve(__dirname, '..', 'ParamGroups.tsx'), 'utf8')- expect(src).toMatch(/<LoraStrength name=\{name\} value=\{active\.strength\} onChange=\{\(v\) => s\.setLoraStrengthFor\(name, v\)\} \/>/)+ // The field is named after what the row reads (a catalogue LoRA shows its+ // catalogue name), the store is written under the file name.+ expect(src).toMatch(/<LoraStrength name=\{label\} value=\{active\.strength\} onChange=\{\(v\) => s\.setLoraStrengthFor\(name, v\)\} \/>/)// The old slider that stopped at 2 is gone, not kept beside it.expect(src).not.toMatch(/label="Strength"/)})diff --git a/src/lib/__tests__/a-known-lora-is-offered-where-it-runs.test.ts b/src/lib/__tests__/a-known-lora-is-offered-where-it-runs.test.tsnew file mode 100644index 00000000..a0d6bae0--- /dev/null+++ b/src/lib/__tests__/a-known-lora-is-offered-where-it-runs.test.ts@@ -0,0 +1,150 @@+/**+ * A LoRA whose family the app knows is offered and sent only where it runs.+ *+ * Found on 2026-10-03: after the download of the MiniMax H3 Turbo LoRA+ * (minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors in models/loras)+ * the LoRA stack in Create offered it on the image model Z-Image too, and the+ * long file name was cut off in the list.+ *+ * Since 3.0.4 a character from Character Studio goes to Z-Image only. The+ * catalogue's own LoRA add-ons now hang on the same rule: the app shipped+ * them, so it knows their family. A LoRA of unknown origin stays selectable+ * everywhere, because the app must not guess a family from a file name.+ *+ * Run: npx vitest run src/lib/__tests__/a-known-lora-is-offered-where-it-runs.test.ts+ */+import { describe, it, expect } from 'vitest'+import { knownLora, loraFitsModel, loraRows, lorasForRun, skippedLorasLine } from '../lora-stack'+import { getLoraAddonBundles } from '../../api/model-bundles'+import { classifyModel } from '../../api/comfyui'++const H3_TURBO = 'minimax_h3_fl2v_turbo_8step_v1.0_comfyui_bf16.safetensors'+const PIXEL = 'pixel-art-xl.safetensors'+const CHAR = 'char_mira_zimage.safetensors'+const STYLE = 'film_grain_xl.safetensors'+const pick = (name: string, strength = 0.8) => ({ name, strength })++const Z_IMAGE = classifyModel('z_image_turbo_bf16.safetensors')+const H3 = classifyModel('minimax_h3_fl2va_bf16.safetensors')+const FAST_H3 = classifyModel('fastvideo_fasth3_8step_v2_bf16.safetensors')+const SDXL = classifyModel('juggernautXL_v9.safetensors')++describe('what the app knows about a LoRA', () => {+ it('the model types of the test are the real ones', () => {+ expect([Z_IMAGE, H3, FAST_H3, SDXL]).toEqual(['zimage', 'minimaxh3', 'minimaxh3', 'sdxl'])+ })++ it('every LoRA add-on of the catalogue is known, with its family and its catalogue name', () => {+ const addons = getLoraAddonBundles()+ expect(addons.map((b) => b.name)).toEqual(['Pixel Art XL · SDXL LoRA', 'MiniMax H3 Turbo LoRA · 8 Steps'])+ for (const b of addons) {+ for (const f of b.files) {+ expect(knownLora(f.filename!), f.filename).toEqual({ family: b.workflow, familyLabel: b.tags[0], catalogName: b.name })+ }+ }+ expect(knownLora(H3_TURBO)).toEqual({ family: 'minimaxh3', familyLabel: 'MiniMax H3', catalogName: 'MiniMax H3 Turbo LoRA · 8 Steps' })+ expect(knownLora(PIXEL)).toEqual({ family: 'sdxl', familyLabel: 'SDXL', catalogName: 'Pixel Art XL · SDXL LoRA' })+ })++ it('is found in a subfolder and whatever the case of the file name', () => {+ expect(knownLora(`video\\${H3_TURBO}`)?.family).toBe('minimaxh3')+ expect(knownLora(`video/${H3_TURBO.toUpperCase()}`)?.family).toBe('minimaxh3')+ })++ it('a character from Character Studio is a Z-Image LoRA', () => {+ expect(knownLora(CHAR)).toEqual({ family: 'zimage', familyLabel: 'Z-Image' })+ })++ it('COUNTER-CHECK: a LoRA of unknown origin is not given a family, whatever its name suggests', () => {+ for (const name of [STYLE, 'wan22_lightning_4step.safetensors', 'my_minimax_h3_style.safetensors', 'zimage_detail.safetensors', 'pixel-art-xl-v2.safetensors']) {+ expect(knownLora(name), name).toBeNull()+ for (const type of [Z_IMAGE, H3, SDXL, 'wan22', 'unknown'] as const) expect(loraFitsModel(name, type), `${name} on ${type}`).toBe(true)+ }+ })+})++describe('where a known LoRA fits', () => {+ it('the H3 turbo LoRA fits MiniMax H3 and FastH3, and no image model', () => {+ expect(loraFitsModel(H3_TURBO, H3)).toBe(true)+ expect(loraFitsModel(H3_TURBO, FAST_H3)).toBe(true)+ expect(loraFitsModel(H3_TURBO, Z_IMAGE)).toBe(false)+ expect(loraFitsModel(H3_TURBO, SDXL)).toBe(false)+ expect(loraFitsModel(H3_TURBO, 'wan22')).toBe(false)+ })++ it('Pixel Art XL fits SDXL only', () => {+ expect(loraFitsModel(PIXEL, SDXL)).toBe(true)+ expect(loraFitsModel(PIXEL, 'sd15')).toBe(false)+ expect(loraFitsModel(PIXEL, Z_IMAGE)).toBe(false)+ expect(loraFitsModel(PIXEL, H3)).toBe(false)+ })++ it('a model the app could not classify does not rule a catalogue LoRA out', () => {+ expect(loraFitsModel(PIXEL, 'unknown')).toBe(true)+ expect(loraFitsModel(H3_TURBO, 'unknown')).toBe(true)+ })++ it('a character stays with Z-Image, as since 3.0.4', () => {+ expect(loraFitsModel(CHAR, Z_IMAGE)).toBe(true)+ expect(loraFitsModel(CHAR, SDXL)).toBe(false)+ expect(loraFitsModel(CHAR, 'unknown')).toBe(false)+ })+})++describe('the rows of the stack', () => {+ const listed = [STYLE, H3_TURBO, PIXEL, CHAR]+ const labels = (type: Parameters<typeof loraRows>[2], picks = [] as ReturnType<typeof pick>[]) =>+ loraRows(listed, picks, type).map((r) => (r.fits ? r.label : `${r.label} [${r.familyLabel} only]`))++ it('the reported case: Z-Image does not offer the H3 turbo LoRA', () => {+ expect(labels(Z_IMAGE)).toEqual(['film_grain_xl', 'char_mira_zimage'])+ })++ it('MiniMax H3 offers it, under its catalogue name with the file name as the tooltip', () => {+ const rows = loraRows(listed, [], H3)+ expect(rows.map((r) => r.label)).toEqual(['film_grain_xl', 'MiniMax H3 Turbo LoRA · 8 Steps', 'char_mira_zimage'])+ const turbo = rows[1]+ expect(turbo).toEqual({ name: H3_TURBO, label: 'MiniMax H3 Turbo LoRA · 8 Steps', file: H3_TURBO, fits: true })+ // The character keeps its row and says where it belongs.+ expect(rows[2]).toMatchObject({ fits: false, familyLabel: 'Z-Image' })+ })++ it('SDXL offers Pixel Art XL and not the turbo LoRA', () => {+ expect(labels(SDXL)).toEqual(['film_grain_xl', 'Pixel Art XL · SDXL LoRA', 'char_mira_zimage [Z-Image only]'])+ })++ it('a catalogue LoRA that is still ticked on another model keeps its row, so it can be turned off', () => {+ expect(labels(Z_IMAGE, [pick(H3_TURBO)])).toEqual(['film_grain_xl', 'MiniMax H3 Turbo LoRA · 8 Steps [MiniMax H3 only]', 'char_mira_zimage'])+ })++ it('the name a row sends is the one ComfyUI lists, subfolder included', () => {+ const inFolder = `video\\${H3_TURBO}`+ expect(loraRows([inFolder], [], H3)).toEqual([{ name: inFolder, label: 'MiniMax H3 Turbo LoRA · 8 Steps', file: H3_TURBO, fits: true }])+ })++ it('a file of unknown origin reads as its name without the ending', () => {+ expect(loraRows(['styles\\Film Grain.safetensors'], [], Z_IMAGE)).toEqual([+ { name: 'styles\\Film Grain.safetensors', label: 'styles\\Film Grain', file: 'Film Grain.safetensors', fits: true },+ ])+ })+})++describe('what a run sends', () => {+ it('Z-Image leaves a ticked H3 turbo LoRA out and says so', () => {+ const r = lorasForRun([pick(H3_TURBO), pick(STYLE)], [H3_TURBO, STYLE], Z_IMAGE)+ expect(r.use).toEqual([pick(STYLE)])+ expect(r.otherModel).toEqual([H3_TURBO])+ expect(skippedLorasLine(r.missing, r.otherModel)).toBe('Skipping LoRA MiniMax H3 only: MiniMax H3 Turbo LoRA · 8 Steps')+ })++ it('MiniMax H3 sends it', () => {+ const r = lorasForRun([pick(H3_TURBO, 1)], [H3_TURBO], H3)+ expect(r.use).toEqual([pick(H3_TURBO, 1)])+ expect(r.otherModel).toEqual([])+ })++ it('characters and catalogue LoRAs each get their own part of the line', () => {+ expect(skippedLorasLine(['gone.safetensors'], [CHAR, PIXEL]))+ .toBe('Skipping LoRA no longer in models/loras: gone; Z-Image characters only: char_mira_zimage; SDXL only: Pixel Art XL · SDXL LoRA')+ })+})diff --git a/src/lib/lora-stack.ts b/src/lib/lora-stack.tsindex e4ebb728..b8f40e88 100644--- a/src/lib/lora-stack.ts+++ b/src/lib/lora-stack.ts@@ -2,8 +2,10 @@// in the persisted stack. The picker showed "2 active" with nothing ticked,// every run sent them, and ComfyUI refused the graph with "Value not in list".// One of them was a Z-Image character LoRA riding into the Animate lane.-// This file decides, from the one list ComfyUI reports, which picks a run uses.+// This file decides, from the one list ComfyUI reports, which picks a run uses+// and which LoRAs the stack offers for the model that is picked.import { parseLocalCharacterLora } from '../api/trainer'+import { getLoraAddonBundles } from '../api/model-bundles'import type { ModelType } from '../api/comfyui'export interface LoraPick {@@ -11,10 +13,85 @@ export interface LoraPick {strength: number}-/** A character from Character Studio is a Z-Image LoRA (trainer naming- * `char_<name>_zimage`), so any other model would only get noise from it. */+/** A LoRA whose model family the app knows, because the app made or shipped it. */+export interface KnownLora {+ /** The model family it was made for. */+ family: ModelType+ /** How the stack names that family, as in "Z-Image only". */+ familyLabel: string+ /** From the catalogue: the bundle name the Model Manager shows for it. */+ catalogName?: string+}++const fileOf = (name: string) => name.replace(/^.*[\\/]/, '')+const stemOf = (name: string) => fileOf(name).replace(/\.safetensors$/i, '')++/** The catalogue's LoRA add-ons by file name: the family is the bundle's+ * workflow, its label the bundle's first tag ("MiniMax H3", "SDXL"). */+let catalogLoras: Map<string, KnownLora> | null = null+function catalog(): Map<string, KnownLora> {+ catalogLoras ??= new Map(getLoraAddonBundles().flatMap((b) => b.files.map((f) => [+ (f.filename ?? '').toLowerCase(),+ { family: b.workflow as ModelType, familyLabel: b.tags[0], catalogName: b.name },+ ])))+ return catalogLoras+}++/**+ * What the app knows about a file in models/loras, or null when it knows+ * nothing. Two kinds are known: a character from Character Studio (trainer+ * naming `char_<name>_zimage`, a Z-Image LoRA) and the catalogue's own add-ons+ * (the MiniMax H3 turbo LoRA, Pixel Art XL). Everything else is a file the+ * user put there, and the app does not guess a family from its name.+ */+export function knownLora(name: string): KnownLora | null {+ if (parseLocalCharacterLora(name)) return { family: 'zimage', familyLabel: 'Z-Image' }+ return catalog().get(fileOf(name).toLowerCase()) ?? null+}++/** Any other model would only get noise from a LoRA of a known family. A+ * catalogue LoRA is not ruled out on a model the app could not classify:+ * that would be a guess about the model. */export function loraFitsModel(name: string, modelType: ModelType): boolean {- return !parseLocalCharacterLora(name) || modelType === 'zimage'+ const known = knownLora(name)+ if (!known || known.family === modelType) return true+ return modelType === 'unknown' && !!known.catalogName+}++export interface LoraRow {+ /** The name ComfyUI lists, which is what a run sends. */+ name: string+ /** What the row reads: the catalogue name, or the file name without its ending. */+ label: string+ /** The full file name, for the row's tooltip. */+ file: string+ fits: boolean+ /** For a row that does not fit: the family it belongs to. */+ familyLabel?: string+}++/**+ * The rows the stack shows for the picked model. A LoRA of unknown origin is+ * always offered. A catalogue LoRA is offered where its family runs (the H3+ * turbo LoRA on MiniMax H3, not on an image model); elsewhere it only shows+ * while it is still ticked, so it can be turned off. A character keeps its+ * row on every model with "Z-Image only", as since 3.0.4.+ */+export function loraRows(listed: string[], picks: LoraPick[], modelType: ModelType): LoraRow[] {+ const rows: LoraRow[] = []+ for (const name of listed) {+ const known = knownLora(name)+ const fits = loraFitsModel(name, modelType)+ if (!fits && known?.catalogName && !picks.some((p) => p.name === name)) continue+ rows.push({+ name,+ label: known?.catalogName ?? name.replace(/\.safetensors$/i, ''),+ file: fileOf(name),+ fits,+ ...(fits ? {} : { familyLabel: known?.familyLabel }),+ })+ }+ return rows}/**@@ -40,9 +117,13 @@ export function lorasForRun(/** The progress line for picks a run leaves out, or null when it uses all. */export function skippedLorasLine(missing: string[], otherModel: string[]): string | null {- const base = (n: string) => n.replace(/^.*[\\/]/, '').replace(/\.safetensors$/i, '')const parts: string[] = []- if (missing.length) parts.push(`no longer in models/loras: ${missing.map(base).join(', ')}`)- if (otherModel.length) parts.push(`Z-Image characters only: ${otherModel.map(base).join(', ')}`)+ if (missing.length) parts.push(`no longer in models/loras: ${missing.map(stemOf).join(', ')}`)+ const characters = otherModel.filter((n) => !knownLora(n)?.catalogName)+ if (characters.length) parts.push(`Z-Image characters only: ${characters.map(stemOf).join(', ')}`)+ for (const name of otherModel) {+ const known = knownLora(name)+ if (known?.catalogName) parts.push(`${known.familyLabel} only: ${known.catalogName}`)+ }return parts.length ? `Skipping LoRA ${parts.join('; ')}` : null}