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): LoRA picks actually reach the workflow; enable LoRA for capable video families (Discord #80)

purple11eb9e9ee8c0
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 96f3a161..fa0e206a 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -1121,10 +1121,27 @@ function buildWan22Workflow(params: VideoParams, seed: number, nodes: Categorize
workflow[posId] = { class_type: 'CLIPTextEncode', inputs: { text: params.prompt, clip: [clipId, 0] } }
workflow[negId] = { class_type: 'CLIPTextEncode', inputs: { text: params.negativePrompt || '', clip: [clipId, 0] } }
+ // Optional LoRA chain (D#80, game-master0): video LoRAs are model-only, so
+ // patch the UNET with LoraLoaderModelOnly (no clip side) before the sampling
+ // shift. Guarded on params.lora — a plain Wan 2.2 gen stays byte-identical.
+ let wanModelSrc = unetId
+ const wanLoras = normalizeLoraList(params.lora)
+ if (wanLoras.length > 0) {
+ const wanStrengths = normalizeLoraStrengths(params.loraStrength, wanLoras.length)
+ wanLoras.forEach((loraName, i) => {
+ const loraId = String(n++)
+ workflow[loraId] = {
+ class_type: 'LoraLoaderModelOnly',
+ inputs: { lora_name: loraName, strength_model: wanStrengths[i], model: [wanModelSrc, 0] },
+ }
+ wanModelSrc = loraId
+ })
+ }
+
// Wan's recommended sampling shift. ModelSamplingSD3 is a core node (ships since
// SD3), so the sampler reads from it to match the official 5B workflow's motion.
const shiftId = String(n++)
- workflow[shiftId] = { class_type: 'ModelSamplingSD3', inputs: { model: [unetId, 0], shift: 8.0 } }
+ workflow[shiftId] = { class_type: 'ModelSamplingSD3', inputs: { model: [wanModelSrc, 0], shift: 8.0 } }
// Unified latent: a start_image is attached ONLY for an I2V request.
const latentInputs: Record<string, any> = { vae: [vaeId, 0], width, height, length, batch_size: 1 }
diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsx
index a4f6e13e..4ef8d9d6 100644
--- a/src/components/create/experimental/ParamGroups.tsx
+++ b/src/components/create/experimental/ParamGroups.tsx
@@ -2,6 +2,7 @@ import { Gauge, Boxes, FlaskConical, RotateCcw, HelpCircle } from 'lucide-react'
import { useCreateStore } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
import { cloudModelById, defaultCloudModel } from '../../../stores/cloudCatalogStore'
+import { classifyModel } from '../../../api/comfyui'
import { INTENT_MAP } from './intents'
import { SAMPLERS as SAMPLERS_FALLBACK, SCHEDULERS as SCHEDULERS_FALLBACK } from './badges'
import { Section } from '../ui/Section'
@@ -12,6 +13,13 @@ import { Button } from '../ui/Button'
import { Tooltip } from '../ui/Tooltip'
import { cn } from '../ui/cn'
+// Video families whose dynamic-workflow strategy actually wires a LoRA node:
+// the generic UNET path (wan/hunyuan/ltx/mochi/cosmos) plus Wan 2.2's dedicated
+// builder (LoraLoaderModelOnly insert). The remaining families (cogvideo/svd/
+// framepack/pyramidflow/allegro) use wrapper nodes with no LoRA seam, so we hide
+// the stack for them rather than offer a control that silently does nothing.
+const VIDEO_LORA_FAMILIES = new Set(['wan', 'wan22', 'hunyuan', 'ltx', 'mochi', 'cosmos'])
+
// The full param surface, reorganized into 3 frequency-ranked Sections.
// Sampler/scheduler/LoRA/VAE lists come live from ComfyUI via CreateContext,
// falling back to the standard node names until they load.
@@ -22,6 +30,9 @@ export function ParamGroups() {
const isVideo = meta.isVideo
const isEdit = meta.id === 'edit'
const isCloud = s.backend === 'cloud'
+ // LoRA is a local-only knob; for video it's offered only on families whose
+ // builder actually applies it (see VIDEO_LORA_FAMILIES). Image always qualifies.
+ const loraSupported = !isCloud && (!isVideo || VIDEO_LORA_FAMILIES.has(classifyModel(s.videoModel)))
// 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
@@ -87,7 +98,7 @@ export function ParamGroups() {
<Slider label="Mask edge feather" min={0} max={64} step={1} value={s.growMaskBy} onChange={s.setGrowMaskBy} unit="px" />
)}
- {!isCloud && !isVideo && loraList.length > 0 && (
+ {loraSupported && loraList.length > 0 && (
<div className="space-y-1.5">
<div className="t-control text-gray-400">LoRA stack {s.selectedLoras.length > 0 && <span className="t-mono text-gray-600">· {s.selectedLoras.length} active</span>}</div>
<div className="space-y-1 max-h-44 overflow-y-auto scrollbar-thin">
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index b49e9eec..87b3e599 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -316,8 +316,13 @@ export function useCreate() {
...(isRemoveBg && effInputImage ? { removebg: true, inputImage: effInputImage } : {}),
...(isI2I && !isRemoveBg && effInputImage ? { inputImage: effInputImage, denoise } : {}),
...(!isRemoveBg && maskFilename ? { maskImage: maskFilename, growMaskBy } : {}),
- // Advanced image adjustments (builder ignores these for video).
- ...(selectedLoras.length ? { loras: selectedLoras } : {}),
+ // Advanced adjustments. LoRA feeds the builder's `lora`/`loraStrength`
+ // contract (string[] + number[]); the old `loras` key was read by nobody,
+ // so LoRA selection was a silent no-op for image too (D#80). VAE/clip-skip
+ // stay image-only (the builder ignores them for video).
+ ...(selectedLoras.length
+ ? { lora: selectedLoras.map((l) => l.name), loraStrength: selectedLoras.map((l) => l.strength) }
+ : {}),
...(selectedVae && selectedVae !== 'auto' ? { vae: selectedVae } : {}),
...(clipSkip > 0 ? { clipSkip } : {}),
}