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): the LoRA stack is discoverable instead of secretly empty (#109)

Davidc85da3a1251e
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsx
index 3a6b9dc0..16dd6e9d 100644
--- a/src/components/create/experimental/CreateContext.tsx
+++ b/src/components/create/experimental/CreateContext.tsx
@@ -63,6 +63,9 @@ interface CreateExpValue {
/** Installed LoRA + VAE filenames for the Advanced drawer. */
loraList: string[]
vaeList: string[]
+ /** Re-scan LoRA/VAE lists + node caps on demand (GH #109): the lists load
+ * once per connect, so files dropped in later were invisible until restart. */
+ refreshModelLists: () => Promise<void>
connected: boolean | null
modelsLoaded: boolean
modelLoadError: string | null
@@ -167,30 +170,30 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
// Once ComfyUI is reachable, fetch LoRA/VAE lists and probe installed
// capabilities (RMBG for cutout, inpaint nodes) so the UI gates correctly.
- useEffect(() => {
+ // Exposed as refreshModelLists because this used to run exactly once per
+ // connect: a .safetensors dropped into models/loras afterwards stayed
+ // invisible until an app restart, which read as "no LoRA support at all"
+ // (GH #109, ElBiggus). The LoRA stack's Rescan button re-runs it on demand;
+ // getAllNodeInfo(true) skips the node cache so the scan is really fresh.
+ const refreshModelLists = useCallback(async () => {
if (connected !== true) return
- let cancelled = false
- ;(async () => {
- const [loras, vaes] = await Promise.all([
- getLoraModels().catch(() => [] as string[]),
- getVAEModels().catch(() => [] as string[]),
- ])
- if (cancelled) return
- setLoraList(loras)
- setVaeList(['auto', ...vaes])
- try {
- const nodes = await getAllNodeInfo()
- if (cancelled) return
- const names = new Set(Object.keys(nodes))
- setCaps({
- rmbg: names.has('RMBG'),
- 'inpaint-nodes': names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning'),
- dwpose: names.has('DWPreprocessor'),
- })
- } catch { /* node probe is best-effort */ }
- })()
- return () => { cancelled = true }
+ const [loras, vaes] = await Promise.all([
+ getLoraModels().catch(() => [] as string[]),
+ getVAEModels().catch(() => [] as string[]),
+ ])
+ setLoraList(loras)
+ setVaeList(['auto', ...vaes])
+ try {
+ const nodes = await getAllNodeInfo(true)
+ const names = new Set(Object.keys(nodes))
+ setCaps({
+ rmbg: names.has('RMBG'),
+ 'inpaint-nodes': names.has('VAEEncodeForInpaint') || names.has('InpaintModelConditioning'),
+ dwpose: names.has('DWPreprocessor'),
+ })
+ } catch { /* node probe is best-effort */ }
}, [connected, setCaps])
+ useEffect(() => { void refreshModelLists() }, [refreshModelLists])
// One-click prerequisite: make sure a local ComfyUI is actually running —
// start it if it's merely stopped, INSTALL it first if it's missing (the
@@ -466,7 +469,7 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
cancel: () => (hasActiveCloudRun() ? cloud.cancel() : cancel()),
enhanceVideo: cloud.enhanceVideo,
makeVoice: cloud.makeVoice,
- samplerList, schedulerList, loraList, vaeList,
+ samplerList, schedulerList, loraList, vaeList, refreshModelLists,
connected, modelsLoaded, modelLoadError, mlxMissing, comfyOnCpu, installCapability, installModelBundle,
cloudAvailable, quota, refreshQuota,
}
diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsx
index c9149aaa..2ccaf3dc 100644
--- a/src/components/create/experimental/ParamGroups.tsx
+++ b/src/components/create/experimental/ParamGroups.tsx
@@ -28,7 +28,7 @@ const VIDEO_LORA_FAMILIES = new Set(['wan', 'wan22', 'hunyuan', 'ltx', 'mochi',
// falling back to the standard node names until they load.
export function ParamGroups() {
const s = useCreateStore()
- const { samplerList, schedulerList, loraList, vaeList } = useCreateExp()
+ const { samplerList, schedulerList, loraList, vaeList, refreshModelLists } = useCreateExp()
const meta = INTENT_MAP[s.intent()]
const isVideo = meta.isVideo
const isEdit = meta.id === 'edit'
@@ -218,9 +218,21 @@ export function ParamGroups() {
<Slider label="Mask edge feather" min={0} max={64} step={1} value={s.growMaskBy} onChange={s.setGrowMaskBy} unit="px" />
)}
- {loraSupported && loraList.length > 0 && (
+ {loraSupported && (
<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="flex items-center justify-between">
+ <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>
+ {/* GH #109: the list loads once per connect, so a file dropped
+ into models/loras later never appeared — and with an empty
+ list the whole section was invisible, which read as "no LoRA
+ support at all". Always show it, let the user re-scan. */}
+ <button onClick={() => { void refreshModelLists() }} title="Re-scan ComfyUI's models/loras folder" className="t-control text-gray-500 hover:text-gray-300 inline-flex items-center gap-1">
+ <RotateCcw className="w-3 h-3" /> Rescan
+ </button>
+ </div>
+ {loraList.length === 0 ? (
+ <div className="t-control text-gray-600">No LoRAs found yet. Drop .safetensors files into ComfyUI&apos;s models/loras folder and hit Rescan. Characters trained in Character Studio land there automatically.</div>
+ ) : (
<div className="space-y-1 max-h-44 overflow-y-auto scrollbar-thin">
{loraList.map((name) => {
const active = s.selectedLoras.find((l) => l.name === name)
@@ -239,6 +251,7 @@ export function ParamGroups() {
)
})}
</div>
+ )}
</div>
)}
diff --git a/src/components/create/experimental/__tests__/lora-stack-discoverable.test.ts b/src/components/create/experimental/__tests__/lora-stack-discoverable.test.ts
new file mode 100644
index 00000000..006cd930
--- /dev/null
+++ b/src/components/create/experimental/__tests__/lora-stack-discoverable.test.ts
@@ -0,0 +1,48 @@
+/**
+ * GH #109 (ElBiggus): "I put a couple in ...\ComfyUI\models\loras but I can't
+ * see any way of activating them."
+ *
+ * Der LoRA-Stack existierte laengst: Store, Slider, Multi-LoRA-Kettung im
+ * Builder, sogar der Trainer legt fertige Charaktere in models/loras ab. Aber
+ * die Sektion war unsichtbar, solange die Liste leer war, und die Liste wurde
+ * genau einmal beim Connect geholt. Wer eine Datei danach in den Ordner legte,
+ * sah bis zum App-Neustart nichts, und wer den Ordner nicht kannte, erfuhr ihn
+ * nirgends. Genau ElBiggus' Lauf.
+ *
+ * Quellgepinnt, weil beide Fixes reine Sichtbarkeits- und Verdrahtungs-
+ * bedingungen sind, die kein bestehender Test bemerkt.
+ */
+import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { resolve, dirname } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const hier = dirname(fileURLToPath(import.meta.url))
+const lies = (f: string) => readFileSync(resolve(hier, '..', f), 'utf8')
+
+describe('der LoRA-Stack ist auffindbar (#109)', () => {
+ it('die Sektion steht, sobald die Spur LoRAs kann, nicht erst wenn die Liste voll ist', () => {
+ const src = lies('ParamGroups.tsx')
+ expect(src).not.toMatch(/loraSupported && loraList\.length > 0/)
+ expect(src).toMatch(/\{loraSupported && \(/)
+ })
+
+ it('der leere Zustand nennt den Ordner und bietet einen Rescan an', () => {
+ const src = lies('ParamGroups.tsx')
+ expect(src).toMatch(/models\/loras/)
+ expect(src).toMatch(/Rescan/)
+ expect(src).toMatch(/refreshModelLists\s*\}\s*=\s*useCreateExp\(\)/)
+ })
+
+ it('der Kontext stellt den Refresh bereit und der Connect-Pfad nutzt ihn', () => {
+ const src = lies('CreateContext.tsx')
+ expect(src).toMatch(/refreshModelLists: \(\) => Promise<void>/)
+ expect(src).toMatch(/const refreshModelLists = useCallback/)
+ expect(src).toMatch(/refreshModelLists\(\) \}, \[refreshModelLists\]\)/)
+ })
+
+ it('ein Rescan liest wirklich frisch statt aus dem Node-Cache', () => {
+ const src = lies('CreateContext.tsx')
+ expect(src).toMatch(/getAllNodeInfo\(true\)/)
+ })
+})