Skip to content

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.

fix(create): imported workflows take the LoRA stack and say when they are set aside (C72, C79)

purplea37d65442d9b
diff --git a/src/api/__tests__/own-workflow-gets-the-lora-stack-c72.test.ts b/src/api/__tests__/own-workflow-gets-the-lora-stack-c72.test.ts
new file mode 100644
index 00000000..07226627
--- /dev/null
+++ b/src/api/__tests__/own-workflow-gets-the-lora-stack-c72.test.ts
@@ -0,0 +1,120 @@
+/**
+ * C72 (Discord help-chat, 10.11.2026): a workflow imported from ComfyUI
+ * rendered without the LoRAs picked in Create. injectParameters set model,
+ * prompts, seed, steps, CFG, size and sampler, and dropped the stack.
+ *
+ * Run: npx vitest run src/api/__tests__/own-workflow-gets-the-lora-stack-c72.test.ts
+ */
+import { describe, it, expect, vi } from 'vitest'
+import type { ComfyApiGraph } from '../../types/comfy-graph'
+import type { GenerateParams } from '../comfyui'
+
+vi.mock('../comfyui', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('../comfyui')>()),
+ getVAEModels: vi.fn(async () => ['ae.safetensors', 'sdxl_vae.safetensors']),
+ getCLIPModels: vi.fn(async () => ['t5xxl.safetensors', 'qwen_2.5_vl_7b_fp8_scaled.safetensors']),
+ getLoraModels: vi.fn(async () => ['styles/pixel-art-xl.safetensors', 'detail_slider.safetensors', 'su542e_character.safetensors']),
+ findMatchingVAE: vi.fn(async () => 'ae.safetensors'),
+ findMatchingCLIP: vi.fn(async () => 't5xxl.safetensors'),
+}))
+
+const { autoDetectParameterMap, injectParameters } = await import('../workflows')
+
+const sdxl = (): ComfyApiGraph => ({
+ '4': { class_type: 'CheckpointLoaderSimple', inputs: { ckpt_name: 'juggernaut.safetensors' } },
+ '6': { class_type: 'CLIPTextEncode', inputs: { text: 'a cat', clip: ['4', 1] } },
+ '7': { class_type: 'CLIPTextEncode', inputs: { text: 'blurry', clip: ['4', 1] } },
+ '5': { class_type: 'EmptyLatentImage', inputs: { width: 1024, height: 1024, batch_size: 1 } },
+ '3': { class_type: 'KSampler', inputs: { model: ['4', 0], positive: ['6', 0], negative: ['7', 0], latent_image: ['5', 0], seed: 1, steps: 20, cfg: 7, sampler_name: 'euler', scheduler: 'normal', denoise: 1 } },
+ '8': { class_type: 'VAEDecode', inputs: { samples: ['3', 0], vae: ['4', 2] } },
+ '9': { class_type: 'SaveImage', inputs: { images: ['8', 0], filename_prefix: 'x' } },
+})
+
+const qwen = (): ComfyApiGraph => ({
+ '1': { class_type: 'UNETLoader', inputs: { unet_name: 'qwen_image.safetensors', weight_dtype: 'default' } },
+ '2': { class_type: 'LoraLoaderModelOnly', inputs: { model: ['1', 0], lora_name: 'su542e_character.safetensors', strength_model: 0.85 } },
+ '3': { class_type: 'ModelSamplingAuraFlow', inputs: { model: ['2', 0], shift: 3.1 } },
+ '4': { class_type: 'CLIPLoader', inputs: { clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', type: 'qwen_image', device: 'default' } },
+ '6': { class_type: 'CLIPTextEncode', inputs: { text: 'a', clip: ['4', 0] } },
+ '7': { class_type: 'CLIPTextEncode', inputs: { text: 'b', clip: ['4', 0] } },
+ '8': { class_type: 'EmptySD3LatentImage', inputs: { width: 768, height: 1360, batch_size: 1 } },
+ '9': { class_type: 'KSampler', inputs: { model: ['3', 0], positive: ['6', 0], negative: ['7', 0], latent_image: ['8', 0], seed: 42, steps: 30, cfg: 2.5, sampler_name: 'euler', scheduler: 'beta', denoise: 1 } },
+})
+
+const params = (extra: Partial<GenerateParams> = {}): GenerateParams => ({
+ prompt: 'a cat', negativePrompt: '', model: 'juggernaut.safetensors', sampler: 'euler', scheduler: 'normal',
+ steps: 20, cfgScale: 7, width: 1024, height: 1024, seed: 7, batchSize: 1, ...extra,
+})
+
+describe('the LoRA stack in a workflow of the user\'s own', () => {
+ it('a checkpoint workflow: one LoraLoader per LoRA behind the loader, model and CLIP both through the chain', async () => {
+ const wf = sdxl()
+ const out = await injectParameters(wf, autoDetectParameterMap(wf), params({ lora: ['pixel-art-xl', 'detail_slider'], loraStrength: [0.6, 1.2] }), 'sdxl')
+ const loras = Object.entries(out).filter(([, n]) => n.class_type === 'LoraLoader')
+ expect(loras.map(([, n]) => [n.inputs?.lora_name, n.inputs?.strength_model, n.inputs?.strength_clip])).toEqual([
+ ['styles/pixel-art-xl.safetensors', 0.6, 0.6],
+ ['detail_slider.safetensors', 1.2, 1.2],
+ ])
+ const [[firstId, first], [lastId, last]] = loras
+ expect(first.inputs?.model).toEqual(['4', 0])
+ expect(first.inputs?.clip).toEqual(['4', 1])
+ expect(last.inputs?.model).toEqual([firstId, 0])
+ expect(last.inputs?.clip).toEqual([firstId, 1])
+ // Sampler and both prompts read the end of the chain; the VAE stays the checkpoint's.
+ expect(out['3'].inputs?.model).toEqual([lastId, 0])
+ expect(out['6'].inputs?.clip).toEqual([lastId, 1])
+ expect(out['7'].inputs?.clip).toEqual([lastId, 1])
+ expect(out['8'].inputs?.vae).toEqual(['4', 2])
+ // The template the user saved is not touched.
+ expect(wf['3'].inputs?.model).toEqual(['4', 0])
+ })
+
+ it('a UNET workflow with its own LoRA: the stack goes behind the loader, the workflow\'s LoRA stays once', async () => {
+ const wf = qwen()
+ const out = await injectParameters(wf, autoDetectParameterMap(wf), params({
+ model: 'qwen_image.safetensors', lora: ['detail_slider', 'su542e_character'], loraStrength: 0.9,
+ }), 'qwenimage')
+ const added = Object.entries(out).filter(([, n]) => n._meta?.title?.startsWith('LoRA (LU)'))
+ expect(added).toHaveLength(1)
+ const [[id, node]] = added
+ expect(node.class_type).toBe('LoraLoader')
+ expect(node.inputs).toMatchObject({ lora_name: 'detail_slider.safetensors', model: ['1', 0], clip: ['4', 0], strength_model: 0.9 })
+ expect(out['2'].inputs).toMatchObject({ model: [id, 0], lora_name: 'su542e_character.safetensors', strength_model: 0.85 })
+ expect(out['6'].inputs?.clip).toEqual([id, 1])
+ })
+
+ it('two model loaders (Wan 2.2 high and low noise): each gets the stack, the second one model-only', async () => {
+ const wf: ComfyApiGraph = {
+ '1': { class_type: 'UNETLoader', inputs: { unet_name: 'wan22_high.safetensors', weight_dtype: 'default' } },
+ '2': { class_type: 'UNETLoader', inputs: { unet_name: 'wan22_low.safetensors', weight_dtype: 'default' } },
+ '3': { class_type: 'CLIPLoader', inputs: { clip_name: 'umt5.safetensors', type: 'wan', device: 'default' } },
+ '4': { class_type: 'CLIPTextEncode', inputs: { text: 'a', clip: ['3', 0] } },
+ '5': { class_type: 'KSamplerAdvanced', inputs: { model: ['1', 0], positive: ['4', 0] } },
+ '6': { class_type: 'KSamplerAdvanced', inputs: { model: ['2', 0], positive: ['4', 0] } },
+ }
+ const out = await injectParameters(wf, { model: { nodeId: '1', inputKey: 'unet_name' } }, params({ model: 'wan22_high.safetensors', lora: 'detail_slider' }), 'wan')
+ const high = out[String((out['5'].inputs?.model as [string, number])[0])]
+ const low = out[String((out['6'].inputs?.model as [string, number])[0])]
+ expect(high.class_type).toBe('LoraLoader')
+ expect(low.class_type).toBe('LoraLoaderModelOnly')
+ expect(low.inputs?.model).toEqual(['2', 0])
+ })
+
+ it('no stack: the graph is what it was', async () => {
+ const wf = sdxl()
+ const out = await injectParameters(wf, autoDetectParameterMap(wf), params(), 'sdxl')
+ expect(Object.values(out).some((n) => n.class_type === 'LoraLoader')).toBe(false)
+ expect(Object.keys(out).sort()).toEqual(Object.keys(wf).sort())
+ })
+
+ it('a LoRA ComfyUI does not have is said by name, as in LU\'s own builder', async () => {
+ const wf = sdxl()
+ await expect(injectParameters(wf, autoDetectParameterMap(wf), params({ lora: 'gone' }), 'sdxl'))
+ .rejects.toThrow(/LoRA "gone" is not installed in ComfyUI/)
+ })
+
+ it('a graph with no model loader LU knows says so instead of dropping the stack', async () => {
+ const wf: ComfyApiGraph = { '1': { class_type: 'SomeCustomLoader', inputs: {} }, '2': { class_type: 'SaveImage', inputs: { images: ['1', 0] } } }
+ await expect(injectParameters(wf, {}, params({ lora: 'detail_slider' }), 'sdxl')).rejects.toThrow(/no model loader LU can put a LoRA behind/)
+ })
+})
diff --git a/src/api/workflow-lora-inject.ts b/src/api/workflow-lora-inject.ts
new file mode 100644
index 00000000..927bb14d
--- /dev/null
+++ b/src/api/workflow-lora-inject.ts
@@ -0,0 +1,145 @@
+// C72 (3.1.0): the LoRA stack picked in Create reaches a workflow of the
+// user's own.
+//
+// injectParameters filled in model, prompts, seed, steps, CFG, size and
+// sampler, and the LoRA stack was dropped without a word: a workflow imported
+// from ComfyUI rendered as if no LoRA had been picked (Discord, help-chat,
+// 10.11.2026). LU's own builder chains a LoraLoader per LoRA behind the model
+// loader (dynamic-workflow.ts, Phase 1b). The same is done here in a graph
+// LU did not build: the chain goes in right behind each model loader, and
+// everything that read the loader's MODEL (and the text encoder's CLIP) reads
+// the end of the chain instead. A LoRA the workflow already loads itself is
+// not loaded a second time.
+
+import type { ComfyApiGraph, ComfyInputValue } from '../types/comfy-graph'
+import { apiNodes } from '../types/comfy-graph'
+import type { ParameterMap } from '../types/workflows'
+import { normalizeLoraStrengths, resolveLoraNames } from './dynamic-workflow'
+
+/** Loaders whose first output is the diffusion model. */
+const MODEL_LOADERS = new Set([
+ 'CheckpointLoaderSimple', 'CheckpointLoader', 'UNETLoader', 'UnetLoaderGGUF', 'UnetLoaderGGUFAdvanced',
+])
+/** Loaders whose first output is the text encoder of a UNET workflow. */
+const CLIP_LOADERS = new Set([
+ 'CLIPLoader', 'DualCLIPLoader', 'TripleCLIPLoader', 'QuadrupleCLIPLoader', 'CLIPLoaderGGUF', 'DualCLIPLoaderGGUF',
+])
+const LORA_LOADERS = new Set(['LoraLoader', 'LoraLoaderModelOnly'])
+
+export interface LoraInjection {
+ /** The LoRAs that went in, as ComfyUI names them. */
+ added: string[]
+ /** LoRAs the workflow loads itself, left as they are. */
+ alreadyThere: string[]
+}
+
+const isRef = (v: ComfyInputValue | undefined): v is [string, number] =>
+ Array.isArray(v) && v.length === 2 && typeof v[0] === 'string' && typeof v[1] === 'number'
+
+/** Point every input that reads `[from, slot]` at `[to, toSlot]`, except in `skip`. */
+function rewire(wf: ComfyApiGraph, from: string, slot: number, to: string, toSlot: number, skip: Set<string>): void {
+ for (const [id, node] of apiNodes(wf)) {
+ if (skip.has(id) || !node.inputs) continue
+ for (const [key, value] of Object.entries(node.inputs)) {
+ if (isRef(value) && value[0] === from && value[1] === slot) node.inputs[key] = [to, toSlot]
+ }
+ }
+}
+
+/** A node id the graph does not use yet. */
+function freshIds(wf: ComfyApiGraph): () => string {
+ let next = Object.keys(wf).reduce((max, id) => {
+ const n = Number(id)
+ return Number.isInteger(n) && n > max ? n : max
+ }, 0)
+ return () => {
+ do next += 1
+ while (String(next) in wf)
+ return String(next)
+ }
+}
+
+/**
+ * Put the LoRA stack into `wf` (in place). `installed` is ComfyUI's LoraLoader
+ * list; a name it does not have throws the same sentence LU's own builder
+ * says. A graph with no model loader LU knows is left as it is, and nothing
+ * is added: `added` is empty then.
+ */
+export function injectLoraStack(
+ wf: ComfyApiGraph,
+ paramMap: ParameterMap,
+ names: string[],
+ strengths: number | number[] | undefined,
+ installed: string[],
+): LoraInjection {
+ const result: LoraInjection = { added: [], alreadyThere: [] }
+ if (names.length === 0) return result
+ const perLora = normalizeLoraStrengths(strengths, names.length)
+ const resolved = resolveLoraNames(names, installed)
+
+ // What the workflow loads itself stays its own, at its own strength.
+ const own = new Set(
+ apiNodes(wf)
+ .filter(([, n]) => LORA_LOADERS.has(n.class_type) && typeof n.inputs?.lora_name === 'string')
+ .map(([, n]) => String(n.inputs?.lora_name).toLowerCase()),
+ )
+ const stack = resolved
+ .map((name, i) => ({ name, strength: perLora[i] }))
+ .filter((l) => {
+ if (!own.has(l.name.toLowerCase())) return true
+ result.alreadyThere.push(l.name)
+ return false
+ })
+ if (stack.length === 0) return result
+
+ // The mapped model loader first, then any other (Wan 2.2: high and low noise).
+ const mapped = paramMap.model?.nodeId
+ const loaders = apiNodes(wf)
+ .filter(([, n]) => MODEL_LOADERS.has(n.class_type))
+ .map(([id]) => id)
+ .sort((a, b) => (a === mapped ? -1 : b === mapped ? 1 : 0))
+ if (loaders.length === 0) return result
+
+ // The CLIP the prompts are encoded with: the checkpoint's own, or the one
+ // text-encoder loader of a UNET workflow. With none or several, the LoRA
+ // patches the model alone, as LoraLoaderModelOnly does.
+ const first = wf[loaders[0]]
+ let clip: [string, number] | null = null
+ if (first.class_type.startsWith('Checkpoint')) clip = [loaders[0], 1]
+ else {
+ const clipLoaders = apiNodes(wf).filter(([, n]) => CLIP_LOADERS.has(n.class_type)).map(([id]) => id)
+ if (clipLoaders.length === 1) clip = [clipLoaders[0], 0]
+ }
+
+ const nextId = freshIds(wf)
+ const added = new Set<string>()
+ loaders.forEach((loaderId, index) => {
+ const withClip = index === 0 && clip !== null
+ let model: [string, number] = [loaderId, 0]
+ let clipRef = withClip ? clip : null
+ const chain: string[] = []
+ for (const lora of stack) {
+ const id = nextId()
+ chain.push(id)
+ wf[id] = clipRef
+ ? {
+ class_type: 'LoraLoader',
+ inputs: { lora_name: lora.name, strength_model: lora.strength, strength_clip: lora.strength, model, clip: clipRef },
+ _meta: { title: `LoRA (LU): ${lora.name}` },
+ }
+ : {
+ class_type: 'LoraLoaderModelOnly',
+ inputs: { lora_name: lora.name, strength_model: lora.strength, model },
+ _meta: { title: `LoRA (LU): ${lora.name}` },
+ }
+ model = [id, 0]
+ if (clipRef) clipRef = [id, 1]
+ }
+ const skip = new Set(chain)
+ rewire(wf, loaderId, 0, model[0], 0, skip)
+ if (withClip && clip && clipRef) rewire(wf, clip[0], clip[1], clipRef[0], 1, skip)
+ for (const l of stack) added.add(l.name)
+ })
+ result.added = [...added]
+ return result
+}
diff --git a/src/api/workflows.ts b/src/api/workflows.ts
index 0ce210f3..48117dc6 100644
--- a/src/api/workflows.ts
+++ b/src/api/workflows.ts
@@ -1,6 +1,8 @@
import type { ModelType } from './comfyui'
import type { GenerateParams, VideoParams } from './comfyui'
-import { findMatchingVAE, findMatchingCLIP, getVAEModels, getCLIPModels } from './comfyui'
+import { findMatchingVAE, findMatchingCLIP, getVAEModels, getCLIPModels, getLoraModels } from './comfyui'
+import { normalizeLoraList } from './dynamic-workflow'
+import { injectLoraStack } from './workflow-lora-inject'
import { log } from '../lib/logger'
import { resolveRunSeed } from '../lib/run-seed'
import { applyParamOverrides, type WorkflowParamOverrides } from './workflow-params'
@@ -311,6 +313,19 @@ export async function injectParameters(
forceSavedOutput(wf)
}
+ // C72: the LoRA stack picked in Create, chained behind the model loader
+ // the way LU's own builder does it. Before 3.1.0 it was dropped here.
+ const loraNames = normalizeLoraList(params.lora)
+ if (loraNames.length > 0) {
+ const lora = injectLoraStack(wf, paramMap, loraNames, params.loraStrength, await getLoraModels())
+ if (lora.added.length === 0 && lora.alreadyThere.length === 0) {
+ throw new Error(
+ 'This workflow has no model loader LU can put a LoRA behind. Add a LoraLoader to the workflow in ComfyUI, or clear the LoRA stack.',
+ )
+ }
+ log.info('[workflows] LoRA stack', lora)
+ }
+
log.info('[workflows] Injected workflow nodes', { nodes: apiNodes(wf).map(([id, n]) =>
`${id}: ${n.class_type} (${Object.keys(n.inputs || {}).join(', ')})`
).join(' | ') })
diff --git a/src/components/create/experimental/WorkflowParams.tsx b/src/components/create/experimental/WorkflowParams.tsx
index 3d2e2edd..fd5a3dfe 100644
--- a/src/components/create/experimental/WorkflowParams.tsx
+++ b/src/components/create/experimental/WorkflowParams.tsx
@@ -7,7 +7,7 @@
// workflow from the workflow manager (installedWorkflows).
import { useEffect, useMemo, useState } from 'react'
-import { ChevronRight, RotateCcw, Search, SlidersHorizontal } from 'lucide-react'
+import { AlertTriangle, ChevronRight, RotateCcw, Search, SlidersHorizontal } from 'lucide-react'
import type { ModelType } from '../../../api/comfyui'
import type { ComfyApiGraph } from '../../../types/comfy-graph'
import type { WorkflowTemplate } from '../../../types/workflows'
@@ -19,8 +19,16 @@ import {
} from '../../../api/workflow-params'
import { workflowOptionText } from '../../../lib/sampler-names'
import { useWorkflowStore } from '../../../stores/workflowStore'
+import { useCreateStore } from '../../../stores/createStore'
+import { ownWorkflowMisfitNote } from '../../../lib/own-workflow-fit'
+import { apiNodes } from '../../../types/comfy-graph'
+import { Hinweis } from '../../ui/Hinweis'
import { baseFieldClass, label } from './SchemaControl'
import { cn } from '../ui/cn'
+import { Select, type SelectOption } from '../ui/Select'
+
+/** A list longer than this gets a search field (LoRAs, checkpoints). */
+const SEARCH_FROM = 8
// ── Node definitions, once per set of node types while the app runs ──
@@ -128,16 +136,28 @@ function FieldControl({ field, value, onChange, id }: {
return <NumberInput id={id} field={{ ...field, control: c }} value={typeof value === 'number' ? value : Number(field.fileValue)} onChange={onChange} />
}
if (c.kind === 'select') {
+ // C79 (3.1.0): LU's own list instead of a native <select>. Windows drew
+ // the native list white with the field's light grey text on it (Win 10,
+ // LU Dark), and a LoRA folder of a few hundred files had no search.
+ const options: SelectOption[] = [
+ ...(field.autoByLu ? [{ value: '', label: 'Auto (LU picks a match)' }] : []),
+ ...c.options.map((o) => ({ value: o, label: workflowOptionText(field.inputKey, o), title: o })),
+ ]
return (
- <select id={id} className={cn(baseFieldClass, 'cursor-pointer')} value={value === undefined ? '' : String(value)}
- onChange={(e) => {
- const v = e.target.value
- if (v === '') return onChange(undefined)
- onChange(typeof field.fileValue === 'number' && Number.isFinite(Number(v)) ? Number(v) : v)
- }}>
- {field.autoByLu && <option value="">Auto (LU picks a match)</option>}
- {c.options.map((o) => <option key={o} value={o}>{workflowOptionText(field.inputKey, o)}</option>)}
- </select>
+ <div id={id}>
+ <Select
+ ariaLabel={label(field.inputKey)}
+ size="sm"
+ options={options}
+ searchable={c.options.length > SEARCH_FROM}
+ placeholder={field.autoByLu ? 'Auto (LU picks a match)' : 'Choose…'}
+ value={value === undefined ? '' : String(value)}
+ onChange={(v) => {
+ if (v === '') return onChange(undefined)
+ onChange(typeof field.fileValue === 'number' && Number.isFinite(Number(v)) ? Number(v) : v)
+ }}
+ />
+ </div>
)
}
const text = typeof value === 'string' ? value : value === undefined ? '' : String(value)
@@ -281,6 +301,24 @@ export function ActiveWorkflowParams({ modelName, modelType, path }: {
path?: WorkflowRunPath
}) {
const workflow = useWorkflowStore((s) => s.getWorkflowForModel(modelName, modelType))
+ // The folder the model list found the file in decides the loader it needs.
+ const source = useCreateStore((s) =>
+ (s.imageModelList.find((m) => m.name === modelName) ?? s.videoModelList.find((m) => m.name === modelName))?.source)
if (!workflow) return null
- return <WorkflowParams key={workflow.id} workflow={workflow} path={path} />
+ // C72: a workflow with the wrong loader is set aside at run time. Said here
+ // before the run, so the list below is not edited for a workflow that will
+ // not run. Motion Control fills its workflow its own way and checks no loader.
+ const misfit = path === 'lane'
+ ? null
+ : ownWorkflowMisfitNote(workflow.name, apiNodes(workflow.workflow).map(([, n]) => n.class_type), modelType, source)
+ return (
+ <>
+ {misfit && (
+ <div className="mt-4" data-testid="own-workflow-misfit">
+ <Hinweis icon={<AlertTriangle size={12} className="mt-[2px] shrink-0" />}>{misfit}</Hinweis>
+ </div>
+ )}
+ <WorkflowParams key={workflow.id} workflow={workflow} path={path} />
+ </>
+ )
}
diff --git a/src/components/create/experimental/__tests__/workflow-params-list.test.tsx b/src/components/create/experimental/__tests__/workflow-params-list.test.tsx
index 141abea8..23cde66c 100644
--- a/src/components/create/experimental/__tests__/workflow-params-list.test.tsx
+++ b/src/components/create/experimental/__tests__/workflow-params-list.test.tsx
@@ -49,7 +49,13 @@ async function renderList() {
await waitFor(() => expect(loadNodeDefs).toHaveBeenCalled())
// The definitions are in once the LoRA list has its choices.
fireEvent.click(screen.getByRole('button', { name: /Detail LoRA/ }))
- await waitFor(() => expect((screen.getByLabelText('Lora name') as HTMLSelectElement).tagName).toBe('SELECT'))
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Lora name' }).getAttribute('aria-haspopup')).toBe('listbox'))
+}
+
+/** C79: a list is LU's own picker now. Open it and click the row. */
+function pick(name: string, row: string) {
+ fireEvent.click(screen.getByRole('button', { name }))
+ fireEvent.click(within(screen.getByRole('listbox')).getByRole('option', { name: row }))
}
function node(name: RegExp) {
@@ -62,7 +68,7 @@ describe('Workflow parameters in Create', () => {
expect(screen.getByText('Workflow parameters')).toBeTruthy()
expect(screen.getByRole('button', { name: /Sampler/ }).getAttribute('aria-expanded')).toBe('false')
const lora = node(/Detail LoRA/)
- expect((within(lora).getByLabelText('Lora name') as HTMLSelectElement).value).toBe('detail_tweaker_xl.safetensors')
+ expect(within(lora).getByRole('button', { name: 'Lora name' }).textContent).toBe('detail_tweaker_xl.safetensors')
const strength = within(lora).getByLabelText('Strength model') as HTMLInputElement
expect(strength.type).toBe('number')
expect(strength.min).toBe('-100')
@@ -70,7 +76,7 @@ describe('Workflow parameters in Create', () => {
fireEvent.click(screen.getByRole('button', { name: /LU_TestToggle/ }))
expect((screen.getByLabelText('Enabled') as HTMLInputElement).type).toBe('checkbox')
expect(screen.getByLabelText('Note').tagName).toBe('TEXTAREA')
- expect(screen.getByLabelText('Mode').tagName).toBe('SELECT')
+ expect(screen.getByRole('button', { name: 'Mode' }).getAttribute('aria-haspopup')).toBe('listbox')
})
it('stores a change for this workflow, shows it, and Reset goes back to the file', async () => {
@@ -83,7 +89,7 @@ describe('Workflow parameters in Create', () => {
fireEvent.change(screen.getByLabelText('Strength model'), { target: { value: '0.8' } })
expect(useWorkflowStore.getState().paramOverrides['wf-1']).toBeUndefined()
- fireEvent.change(screen.getByLabelText('Lora name'), { target: { value: 'detail_tweaker_xl.safetensors' } })
+ pick('Lora name', 'detail_tweaker_xl.safetensors')
fireEvent.change(screen.getByLabelText('Strength clip'), { target: { value: '2' } })
expect(useWorkflowStore.getState().paramOverrides['wf-1']).toEqual({ '10': { strength_clip: 2 } })
fireEvent.click(screen.getByRole('button', { name: /Reset/ }))
@@ -104,12 +110,12 @@ describe('Workflow parameters in Create', () => {
it('offers the VAE with Auto first, and a pick is stored', async () => {
await renderList()
fireEvent.click(screen.getByRole('button', { name: /VAELoader/ }))
- const vae = screen.getByLabelText('Vae name') as HTMLSelectElement
- expect(vae.value).toBe('')
- expect(vae.options[0].text).toBe('Auto (LU picks a match)')
- fireEvent.change(vae, { target: { value: 'sdxl_vae.safetensors' } })
- expect(useWorkflowStore.getState().paramOverrides['wf-1']).toEqual({ '12': { vae_name: 'sdxl_vae.safetensors' } })
- fireEvent.change(vae, { target: { value: '' } })
+ expect(screen.getByRole('button', { name: 'Vae name' }).textContent).toBe('Auto (LU picks a match)')
+ fireEvent.click(screen.getByRole('button', { name: 'Vae name' }))
+ expect(within(screen.getByRole('listbox')).getAllByRole('option')[0].textContent).toBe('Auto (LU picks a match)')
+ fireEvent.click(within(screen.getByRole('listbox')).getByRole('option', { name: 'ae.safetensors' }))
+ expect(useWorkflowStore.getState().paramOverrides['wf-1']).toEqual({ '12': { vae_name: 'ae.safetensors' } })
+ pick('Vae name', 'Auto (LU picks a match)')
expect(useWorkflowStore.getState().paramOverrides['wf-1']).toBeUndefined()
})
@@ -137,4 +143,46 @@ describe('Workflow parameters in Create', () => {
rerender(createElement(ActiveWorkflowParams, { modelName: 'mine.safetensors', modelType: 'sdxl' }))
expect(await screen.findByText('Workflow parameters')).toBeTruthy()
})
+
+ it('C79: a long LoRA list has a search, and a pick from it is stored', async () => {
+ const many = Array.from({ length: 40 }, (_, i) => `style_${String(i).padStart(2, '0')}.safetensors`)
+ loadNodeDefs.mockResolvedValueOnce({
+ ...defs,
+ LoraLoader: { input: { required: { ...defs.LoraLoader.input.required, lora_name: [['detail_tweaker_xl.safetensors', 'pixel-art-xl.safetensors', ...many]] } } },
+ })
+ await renderList()
+ fireEvent.click(screen.getByRole('button', { name: 'Lora name' }))
+ const search = screen.getByRole('textbox', { name: 'Search Lora name' })
+ fireEvent.change(search, { target: { value: 'pixel' } })
+ const rows = within(screen.getByRole('listbox')).getAllByRole('option')
+ expect(rows.map((r) => r.textContent)).toEqual(['pixel-art-xl.safetensors'])
+ fireEvent.click(rows[0])
+ expect(useWorkflowStore.getState().paramOverrides['wf-1']).toEqual({ '10': { lora_name: 'pixel-art-xl.safetensors' } })
+ })
+
+ it('C79: a short list has no search field', async () => {
+ await renderList()
+ fireEvent.click(screen.getByRole('button', { name: 'Lora name' }))
+ expect(screen.queryByRole('textbox', { name: 'Search Lora name' })).toBeNull()
+ })
+
+ it('C72: a workflow whose loader does not fit the model says so before the run', async () => {
+ const { useCreateStore } = await import('../../../../stores/createStore')
+ useWorkflowStore.setState({ modelNameAssignments: { 'flux1-dev.safetensors': 'wf-1' } })
+ // The checkpoint workflow, assigned to a model from diffusion_models.
+ useCreateStore.setState({ imageModelList: [{ name: 'flux1-dev.safetensors', type: 'flux', source: 'diffusion_model' }] as never })
+ render(createElement(ActiveWorkflowParams, { modelName: 'flux1-dev.safetensors', modelType: 'flux' }))
+ const note = await screen.findByTestId('own-workflow-misfit')
+ expect(note.textContent).toContain('Your workflow "My SDXL" is not used: this model is a diffusion model and needs a UNETLoader')
+ expect(note.textContent).toContain('LU builds its own workflow for this model instead.')
+ })
+
+ it('C72: a fitting workflow shows no such line', async () => {
+ const { useCreateStore } = await import('../../../../stores/createStore')
+ useWorkflowStore.setState({ modelNameAssignments: { 'mine.safetensors': 'wf-1' } })
+ useCreateStore.setState({ imageModelList: [{ name: 'mine.safetensors', type: 'sdxl', source: 'checkpoint' }] as never })
+ render(createElement(ActiveWorkflowParams, { modelName: 'mine.safetensors', modelType: 'sdxl' }))
+ expect(await screen.findByText('Workflow parameters')).toBeTruthy()
+ expect(screen.queryByTestId('own-workflow-misfit')).toBeNull()
+ })
})
diff --git a/src/components/create/ui/Select.tsx b/src/components/create/ui/Select.tsx
index 409ba180..01af9f25 100644
--- a/src/components/create/ui/Select.tsx
+++ b/src/components/create/ui/Select.tsx
@@ -214,6 +214,7 @@ export function Select({
<input
autoFocus
+ aria-label={ariaLabel ? `Search ${ariaLabel}` : 'Search'}
value={query}
onChange={(event) =>
setQuery(event.target.value)
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 28ea8b1e..c9bca81d 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -132,7 +132,7 @@ import { defaultLoraStrength } from '../lib/lora-strength'
import { fetchGalleryItemBlob } from '../components/create/experimental/galleryUrl'
import { LongRunStopped, longVideoRequest, runLongVideo, type ClipItem } from '../lib/long-video-run'
import { settleSeams } from '../api/video-settle'
-import { ownWorkflowMisfit } from '../lib/own-workflow-fit'
+import { ownWorkflowMisfitNote } from '../lib/own-workflow-fit'
import { loadImageRef } from '../components/create/experimental/loadImage'
import { listMlxLoras } from '../api/mlx-loras'
import {
@@ -1984,9 +1984,13 @@ export function useCreate() {
// Check for custom workflow assignment — but verify it's compatible with the model
let customWf = localOp || isUpscale ? null : useWorkflowStore.getState().getWorkflowForModel(activeModel, imageModelType)
if (customWf) {
- const misfit = ownWorkflowMisfit(apiNodes(customWf.workflow).map(([, n]) => n.class_type), imageModelType, listedModel?.source)
+ const misfit = ownWorkflowMisfitNote(customWf.name, apiNodes(customWf.workflow).map(([, n]) => n.class_type), imageModelType, listedModel?.source)
if (misfit) {
- console.warn(`[useCreate] Custom workflow incompatible: ${misfit}. Using auto.`)
+ // C72: said on the progress line and kept under the result, not
+ // only in the console.
+ console.warn(`[useCreate] ${misfit}`)
+ setProgress(5, misfit)
+ skippedNote = skippedNote ? `${skippedNote} ${misfit}` : misfit
customWf = null
}
}
diff --git a/src/lib/__tests__/image-engines.test.ts b/src/lib/__tests__/image-engines.test.ts
index 5218c985..af61bf23 100644
--- a/src/lib/__tests__/image-engines.test.ts
+++ b/src/lib/__tests__/image-engines.test.ts
@@ -273,7 +273,7 @@ describe('Qwen-Image 2.1 edits on the Mac and takes Create\'s settings', () => {
it('COUNTER-CHECK: a model of the sidecar keeps its steps and is sent no CFG', async () => {
await generateMlxImageDataUrl({ prompt: 'x', model: 'sd-turbo', steps: 4, guidance: 7, seed: 1, width: 512, height: 512 })
- expect(calls.find((c) => c.cmd === 'mlx_generate')?.args).toEqual({ prompt: 'x', model: 'sd-turbo', steps: 4, seed: 1, width: 512, height: 512, run: expect.any(String) })
+ expect(calls.find((c) => c.cmd === 'mlx_generate')?.args).toEqual({ prompt: 'x', model: 'sd-turbo', steps: 4, seed: 1, width: 512, height: 512, run: expect.any(String), stall_timeout_secs: expect.any(Number) })
// An image is passed on, so that Rust can refuse the edit in words. It
// is never dropped on the way.
calls.length = 0
diff --git a/src/lib/own-workflow-fit.ts b/src/lib/own-workflow-fit.ts
index 7ad575cb..895d1dcd 100644
--- a/src/lib/own-workflow-fit.ts
+++ b/src/lib/own-workflow-fit.ts
@@ -29,3 +29,16 @@ export function ownWorkflowMisfit(classTypes: readonly string[], type: string, s
if (!needsUnet && hasUnet && !hasCheckpoint) return 'model needs CheckpointLoaderSimple but workflow has UNETLoader'
return null
}
+
+/**
+ * C72 (3.1.0): the sentence for a workflow that is set aside, or null when it
+ * fits. The run used to say it only in the developer console, and Create
+ * rendered LU's own graph as if the workflow had been used.
+ */
+export function ownWorkflowMisfitNote(workflowName: string, classTypes: readonly string[], type: string, source?: ComfyModelSource): string | null {
+ if (!ownWorkflowMisfit(classTypes, type, source)) return null
+ const what = modelNeedsUnetLoader(type, source)
+ ? 'this model is a diffusion model and needs a UNETLoader, but the workflow loads a checkpoint (CheckpointLoaderSimple)'
+ : 'this model is a checkpoint and needs a CheckpointLoaderSimple, but the workflow loads a UNETLoader'
+ return `Your workflow "${workflowName}" is not used: ${what}. LU builds its own workflow for this model instead. Change the loader in ComfyUI and import the workflow again, or use it with a model it fits.`
+}