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): re-read the LoRA list automatically after training finishes

purpled1697b634884
diff --git a/src/components/create/experimental/CreateContext.tsx b/src/components/create/experimental/CreateContext.tsx
index 0fef80d4..64cdb870 100644
--- a/src/components/create/experimental/CreateContext.tsx
+++ b/src/components/create/experimental/CreateContext.tsx
@@ -215,6 +215,16 @@ export function CreateExpProvider({ children }: { children: ReactNode }) {
} catch { /* node probe is best-effort */ }
}, [connected, setCaps])
useEffect(() => { void refreshModelLists() }, [refreshModelLists])
+ // K3 proof-vorgabe Station 10 / GH #109, the completion case: a character
+ // trained locally lands in models/loras the same way a manually dropped
+ // .safetensors does, and needed the same manual Rescan click to appear in
+ // the LoRA stack. `bumpCharactersVersion()` already fires the moment
+ // `useCreate` sees the run finish (`src/hooks/useCreate.ts`); reusing it
+ // here instead of adding a second "training done" signal keeps the picker
+ // in sync with zero clicks, matching what the finished-training message
+ // now claims.
+ const charactersVersion = useCreateStore((s) => s.charactersVersion)
+ useEffect(() => { void refreshModelLists() }, [charactersVersion, 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/create/experimental/__tests__/lora-stack-discoverable.test.ts b/src/components/create/experimental/__tests__/lora-stack-discoverable.test.ts
index 006cd930..7430a0f5 100644
--- a/src/components/create/experimental/__tests__/lora-stack-discoverable.test.ts
+++ b/src/components/create/experimental/__tests__/lora-stack-discoverable.test.ts
@@ -45,4 +45,21 @@ describe('der LoRA-Stack ist auffindbar (#109)', () => {
const src = lies('CreateContext.tsx')
expect(src).toMatch(/getAllNodeInfo\(true\)/)
})
+
+ /**
+ * Nachbesserung Punkt 5 (Trainer-Review): ein fertig trainierter Charakter
+ * landete wie jede manuell abgelegte .safetensors in models/loras, aber nur
+ * ein manueller Rescan-Klick zeigte ihn im Stack. `bumpCharactersVersion()`
+ * feuert schon beim Trainingsende (src/hooks/useCreate.ts); dieser Effekt
+ * haengt sich an dasselbe Signal, statt ein zweites einzufuehren.
+ */
+ it('ein fertiges Training stoesst den Refresh ueber charactersVersion an, ohne Klick', () => {
+ const src = lies('CreateContext.tsx')
+ expect(src).toMatch(
+ /const charactersVersion = useCreateStore\(\(s\) => s\.charactersVersion\)/,
+ )
+ expect(src).toMatch(
+ /useEffect\(\(\) => \{ void refreshModelLists\(\) \}, \[charactersVersion, refreshModelLists\]\)/,
+ )
+ })
})