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(models): Abnahme loratab, drei Blocker und vier Hinweise

purple89fd16469a7e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5617aaae..3630c4d1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,11 +25,13 @@ installs stop losing environment variables to it.
pair for every model.
- **A cloud render without a prompt (a presenter reading a script, for
example) still gets a real name in the gallery**, instead of an empty tile.
-- **Models now has a LoRAs tab of its own.** Get new searches CivitAI for
- LoRAs and downloads what you pick into ComfyUI's `models/loras` folder;
- Installed lists what is there with its size, marks a character you trained
- yourself with its trigger word, and deletes a file you no longer want. LoRAs
- no longer sit unnamed among the checkpoints in the Image tab.
+- **Models now has a LoRAs tab of its own on Windows and Linux.** Get new
+ searches CivitAI for LoRAs and downloads what you pick into ComfyUI's
+ `models/loras` folder; Installed lists what is there with its size, marks a
+ character you trained yourself with its trigger word, and deletes a file you
+ no longer want. LoRAs no longer sit unnamed among the checkpoints in the
+ Image tab. Not offered on a Mac, where local media runs on Apple MLX and
+ there is no ComfyUI `models/loras` folder to list.
- **Character LoRAs in Create now only offer the models actually trained for
that character's family**, so the picker cannot suggest a combination that
would fail to generate.
diff --git a/src/components/models/CivitaiSearchPanel.tsx b/src/components/models/CivitaiSearchPanel.tsx
index b2785b00..1b5660fb 100644
--- a/src/components/models/CivitaiSearchPanel.tsx
+++ b/src/components/models/CivitaiSearchPanel.tsx
@@ -7,7 +7,7 @@
* mirror toggle, one key hint, one download path, and the folder a hit lands in
* is decided once, in `searchCivitaiModels`, from that same type.
*/
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
import { Search, Loader2, ExternalLink, Download, CheckCircle } from 'lucide-react'
import { searchCivitaiModels, startModelDownload, type CivitAIModelResult } from '../../api/discover'
import { openExternal } from '../../api/backend'
@@ -26,12 +26,21 @@ interface Props {
title: string
/** Placeholder for the query field, so each lane can show its own examples. */
placeholder: string
+ /** What the ModelManager header search holds. It is copied into this card's
+ * own field, so a lane whose Get new IS this card does not drop the words
+ * the user just typed up there. */
+ search?: string
+ /** Bumped by ModelManager on Enter in the header search. That keypress also
+ * switches to Get new, and on this lane Get new is this card: without the
+ * token the user landed on an empty field, no hits and no message, which is
+ * exactly the silent gap the empty state below exists to close. */
+ searchSubmitToken?: number
}
-export function CivitaiSearchPanel({ modelType, title, placeholder }: Props) {
+export function CivitaiSearchPanel({ modelType, title, placeholder, search = '', searchSubmitToken = 0 }: Props) {
const [results, setResults] = useState<CivitAIModelResult[]>([])
const [searching, setSearching] = useState(false)
- const [query, setQuery] = useState('')
+ const [query, setQuery] = useState(search)
// Track whether the *latest* CivitAI search has been issued at least once,
// so an empty-state hint can render between "before-first-search" and
// "search returned 0 hits". Without this we fall through to the silent gap
@@ -44,8 +53,8 @@ export function CivitaiSearchPanel({ modelType, title, placeholder }: Props) {
const downloads = useDownloadStore((s) => s.downloads)
const dlStore = useDownloadStore
- const runSearch = async () => {
- if (!query.trim()) return
+ const runSearch = async (text: string = query) => {
+ if (!text.trim()) return
setSearching(true)
setSearched(true)
// The CivitAI API key the user configured in Settings, AI Backends,
@@ -53,11 +62,22 @@ export function CivitaiSearchPanel({ modelType, title, placeholder }: Props) {
// credential, so there is no second input here.
const apiKey = useWorkflowStore.getState().civitaiApiKey || undefined
const host = useWorkflowStore.getState().civitaiHost
- const hits = await searchCivitaiModels(query, modelType, apiKey, host)
+ const hits = await searchCivitaiModels(text, modelType, apiKey, host)
setResults(hits)
setSearching(false)
}
+ // Enter in the header search. Same deal DiscoverModels has with its own
+ // catalog search: the live text is only a filter, the token is the submit.
+ // The typed text is taken over either way, so the field is never empty
+ // after a keypress that just switched the view to this card.
+ useEffect(() => {
+ if (searchSubmitToken <= 0 || !search.trim()) return
+ setQuery(search)
+ void runSearch(search)
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [searchSubmitToken])
+
const download = async (model: CivitAIModelResult) => {
if (!model.downloadUrl || !model.filename || !model.subfolder) return
dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder)
@@ -95,13 +115,13 @@ export function CivitaiSearchPanel({ modelType, title, placeholder }: Props) {
<input
value={query}
onChange={(e) => setQuery(e.target.value)}
- onKeyDown={(e) => e.key === 'Enter' && runSearch()}
+ onKeyDown={(e) => { if (e.key === 'Enter') void runSearch() }}
placeholder={placeholder}
aria-label={title}
className="flex-1 px-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-900 dark:text-white placeholder-gray-500 focus:outline-none focus:border-gray-400 dark:focus:border-white/20"
/>
<button
- onClick={runSearch}
+ onClick={() => { void runSearch() }}
disabled={searching || !query.trim()}
aria-label="Search CivitAI"
className="px-3 py-2 rounded-lg bg-gray-100 dark:bg-white/10 hover:bg-gray-200 dark:hover:bg-white/15 disabled:opacity-50 text-gray-700 dark:text-white transition-colors"
diff --git a/src/components/models/LoraManager.tsx b/src/components/models/LoraManager.tsx
index 07cb2796..525cfc68 100644
--- a/src/components/models/LoraManager.tsx
+++ b/src/components/models/LoraManager.tsx
@@ -21,7 +21,15 @@ export interface LoraRow {
}
interface Props {
+ /** The rows to draw, already narrowed by the header search. */
rows: LoraRow[]
+ /** How many LoRAs are installed in total, search or no search. The empty
+ * state is a claim about the DISK, so it hangs off this and never off the
+ * filtered list: ten installed LoRAs and a query that matches none of them
+ * used to read "No LoRAs installed yet". */
+ total: number
+ /** What the header search currently holds, for the no-match line. */
+ searchQuery: string
/** Opens the shared delete confirmation of the Models view. */
onDelete: (name: string) => void
/** Sends the user to the Get new segment of this same rail. */
@@ -34,8 +42,8 @@ interface Props {
* the list "LoRA stack" (ParamGroups.tsx). */
export const LORA_USE_HINT = 'Use them in Create, Advanced settings, Expert, LoRA stack.'
-export function LoraManager({ rows, onDelete, onGetNew }: Props) {
- if (rows.length === 0) {
+export function LoraManager({ rows, total, searchQuery, onDelete, onGetNew }: Props) {
+ if (total === 0) {
return (
<div className="flex flex-col items-center justify-center text-center py-16 px-6 gap-3">
<div className="w-14 h-14 rounded-full bg-gray-100 dark:bg-white/[0.04] border border-gray-200 dark:border-white/[0.06] flex items-center justify-center">
@@ -100,6 +108,12 @@ export function LoraManager({ rows, onDelete, onGetNew }: Props) {
</div>
)
})}
+ {/* Same shape as the other rails: the section heading and its count
+ stay, and the filtered-away list says so instead of claiming
+ anything about what is installed. */}
+ {rows.length === 0 && (
+ <p className="text-center t-micro text-gray-500 py-6">No installed LoRAs match "{searchQuery}"</p>
+ )}
</div>
</section>
)
diff --git a/src/components/models/ModelManager.tsx b/src/components/models/ModelManager.tsx
index 0cc22165..a3e74a06 100644
--- a/src/components/models/ModelManager.tsx
+++ b/src/components/models/ModelManager.tsx
@@ -26,6 +26,7 @@ import { counterView } from '../../lib/inventory-counter'
import { groupInstalledByProvider, needsBackendSwitchHeading, foldedRowsSentence, LU_ENGINE_GROUP } from '../../lib/lu-engine-rows'
import { isBuiltinEngineEntry } from '../../lib/lmstudio-match'
import { installedRowMatchesSearch } from '../../lib/model-search'
+import { isLoraRow } from '../../lib/lora-rows'
import { useBuiltinEngineStatus, engineIsIdle } from '../../hooks/useBuiltinEngineStatus'
import { LuEngineSwitchBar } from '../chat/LuEngineSwitchBar'
import type { InstalledModelLike } from '../../lib/lmstudio-match'
@@ -54,13 +55,6 @@ const RAIL_ITEMS: { key: Mode; label: string; icon: typeof MessagesSquare }[] =
* is typed on the store's category and this one is not a category. */
const LORA_RAIL = { key: 'lora' as const, label: 'LoRAs', icon: Layers }
-/** A row of the ComfyUI inventory that came out of the loras folder. The field
- * is carried all the way from `api/comfyui`'s addon lanes (useModels keeps it
- * now); without it a LoRA and a checkpoint are the same shape. */
-export function isLoraRow(m: AIModel): boolean {
- return 'source' in m && m.source === 'lora'
-}
-
/** The mark a counter wears while it has nothing counted to show. Not a 0:
* a 0 next to a card that reads Installed is a wrong answer, and this one
* stood for five seconds on the real box (Befund 2, 2026-08-29). */
@@ -144,7 +138,9 @@ export function ModelManager() {
const loraRailOffered = !macMlxMedia
const [loraRail, setLoraRail] = useState(false)
const rail: Rail = loraRail && loraRailOffered ? 'lora' : mode
- const showMlxPanel = macMlxMedia && (mode === 'image' || mode === 'video') && rail !== 'lora'
+ // No `rail !== 'lora'` here: the LoRA rail is not offered while macMlxMedia
+ // holds, so the two can never be true together.
+ const showMlxPanel = macMlxMedia && (mode === 'image' || mode === 'video')
useEffect(() => {
fetchModels()
@@ -456,6 +452,8 @@ export function ModelManager() {
) : rail === 'lora' ? (
<LoraManager
rows={searchQuery ? loraRows.filter((r) => installedRowMatchesSearch(r.name, searchQuery)) : loraRows}
+ total={loraRows.length}
+ searchQuery={searchQuery}
onDelete={(name) => setConfirmDelete(name)}
onGetNew={() => setTab('discover')}
/>
@@ -621,6 +619,8 @@ export function ModelManager() {
modelType="LORA"
title="Search CivitAI for LoRAs"
placeholder="e.g. detail enhancer, pixel art, film grain..."
+ search={searchQuery}
+ searchSubmitToken={searchSubmitToken}
/>
</div>
) : (
diff --git a/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx b/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx
index 890e6d67..7d5efd90 100644
--- a/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx
+++ b/src/components/models/__tests__/die-loras-haben-einen-eigenen-reiter.test.tsx
@@ -86,6 +86,23 @@ const CHARACTER_LORA: AIModel = {
format: 'safetensors', architecture: 'zimage', type: 'image', providerName: 'ComfyUI',
source: 'lora',
}
+/** ComfyUI listet Dateien MIT ihrem Unterordner. Genau dieser Fall fehlte in
+ * der ersten Fassung, und er ist der teuerste: der Loeschweg ist der eine
+ * Weg im Stueck, der Dateien vom Datentraeger nimmt. Schneidet irgendwer den
+ * Praefix ab, sucht Rust in `loras/` statt in `loras/styles/` und loescht
+ * entweder nichts oder die falsche gleichnamige Datei. */
+const LORA_IM_UNTERORDNER: AIModel = {
+ name: 'styles/foo.safetensors', model: 'styles/foo.safetensors', size: 12_345_678,
+ format: 'safetensors', architecture: 'sdxl', type: 'image', providerName: 'ComfyUI',
+ source: 'lora',
+}
+/** Dieselbe Sache mit dem Trennzeichen, das Windows schreibt. */
+const CHAR_LORA_WINDOWS: AIModel = {
+ name: 'chars\\char_marla_zimage.safetensors', model: 'chars\\char_marla_zimage.safetensors',
+ size: 41_943_040, format: 'safetensors', architecture: 'zimage', type: 'image',
+ providerName: 'ComfyUI', source: 'lora',
+}
+
const VAE: AIModel = {
name: 'sdxl_vae.safetensors', model: 'sdxl_vae.safetensors', size: 334_000_000,
format: 'safetensors', architecture: 'sdxl', type: 'image', providerName: 'ComfyUI',
@@ -333,3 +350,75 @@ describe('die Checkpoint-Suche fragt weiter nach Checkpoint', () => {
expect(quelle).not.toContain('modelType="LORA"')
})
})
+
+
+describe('Unterordner: der Name geht wortgleich weiter', () => {
+ it('THE FIX: delete_comfy_model bekommt "styles/foo.safetensors", nicht "foo.safetensors"', async () => {
+ bestand = [CHECKPOINT, LORA_IM_UNTERORDNER]
+ openLoraInstalled()
+ fireEvent.click(screen.getByRole('button', { name: 'Delete styles/foo.safetensors' }))
+ fireEvent.click(screen.getByRole('button', { name: /^Delete$/ }))
+ await waitFor(() => expect(backendCall).toHaveBeenCalledTimes(1))
+ const arg = backendCall.mock.calls[0][1] as { filename: string } | undefined
+ expect(arg?.filename).toBe('styles/foo.safetensors')
+ // NEGATIVKONTROLLE: der abgeschnittene Name waere ein anderer Ort.
+ expect(arg?.filename).not.toBe('foo.safetensors')
+ })
+
+ it('THE FIX: dasselbe mit Backslash, und der Charakter-Chip erkennt ihn trotzdem', async () => {
+ bestand = [CHECKPOINT, CHAR_LORA_WINDOWS]
+ openLoraInstalled()
+ const zeile = screen.getAllByTestId('lora-row')[0]
+ expect(within(zeile).getByText('Character')).toBeTruthy()
+ expect(zeile.textContent).toContain('Trigger word: marla')
+ fireEvent.click(screen.getByRole('button', { name: 'Delete chars\\char_marla_zimage.safetensors' }))
+ fireEvent.click(screen.getByRole('button', { name: /^Delete$/ }))
+ await waitFor(() => expect(backendCall).toHaveBeenCalledTimes(1))
+ const arg = backendCall.mock.calls[0][1] as { filename: string } | undefined
+ expect(arg?.filename).toBe('chars\\char_marla_zimage.safetensors')
+ expect(arg?.filename).not.toBe('char_marla_zimage.safetensors')
+ })
+})
+
+describe('die Kopfsuche auf der LoRA-Bahn', () => {
+ it('THE FIX: filtert die Liste, ohne den Bestand zu verleugnen', () => {
+ openLoraInstalled()
+ fireEvent.change(screen.getByPlaceholderText(/Search models/), { target: { value: 'zzz' } })
+ expect(screen.queryAllByTestId('lora-row')).toHaveLength(0)
+ expect(screen.getByText(/No installed LoRAs match "zzz"/)).toBeTruthy()
+ // NEGATIVKONTROLLE: der Leertext ueber den eigenen Bestand darf hier NICHT
+ // stehen, es sind zwei LoRAs installiert.
+ expect(screen.queryByText('No LoRAs installed yet')).toBeNull()
+ // Die Abschnittszeile bleibt stehen, wie auf den anderen Bahnen.
+ expect(screen.getByRole('heading', { name: 'LoRAs' })).toBeTruthy()
+ })
+
+ it('THE FIX: Enter nimmt den Suchtext nach Get new mit und sucht damit', async () => {
+ render(createElement(ModelManager))
+ fireEvent.click(screen.getByRole('button', { name: /^LoRAs/ }))
+ fireEvent.click(screen.getByRole('button', { name: /^Installed/ }))
+ const kopf = screen.getByPlaceholderText(/Search models/)
+ fireEvent.change(kopf, { target: { value: 'pixel art' } })
+ fireEvent.keyDown(kopf, { key: 'Enter' })
+ await waitFor(() => expect(searchCivitaiModels).toHaveBeenCalledTimes(1))
+ expect(searchCivitaiModels.mock.calls[0][0]).toBe('pixel art')
+ expect(searchCivitaiModels.mock.calls[0][1]).toBe('LORA')
+ // Und das Feld der Karte steht nicht leer da.
+ expect((screen.getByLabelText('Search CivitAI for LoRAs') as HTMLInputElement).value)
+ .toBe('pixel art')
+ })
+})
+
+describe('ein Loeschen, das fehlschlaegt, sagt es auf Englisch', () => {
+ it('THE FIX: die Meldung aus Rust steht im Fenster, der Knopf bleibt nicht stumm', async () => {
+ const meldung = 'pixel_art_xl.safetensors exists in more than one models folder'
+ backendCall.mockRejectedValueOnce(new Error(meldung))
+ openLoraInstalled()
+ fireEvent.click(screen.getByRole('button', { name: 'Delete pixel_art_xl.safetensors' }))
+ fireEvent.click(screen.getByRole('button', { name: /^Delete$/ }))
+ expect(await screen.findByText(meldung)).toBeTruthy()
+ expect(screen.getByText('Delete failed')).toBeTruthy()
+ // NEGATIVKONTROLLE: die Zeile ist NICHT verschwunden, es wurde nichts geloescht.
+ expect(screen.getAllByTestId('lora-row')).toHaveLength(2)
+ })
+})
diff --git a/src/lib/lora-rows.ts b/src/lib/lora-rows.ts
new file mode 100644
index 00000000..ea94ffda
--- /dev/null
+++ b/src/lib/lora-rows.ts
@@ -0,0 +1,17 @@
+import type { AIModel } from '../types/models'
+
+/**
+ * Is this inventory row a file out of ComfyUI's `loras` folder?
+ *
+ * The `source` field is carried all the way from `api/comfyui`'s addon lanes
+ * (useModels keeps it now); without it a LoRA and a checkpoint are the same
+ * shape, both `type: 'image'`, both a file under `ComfyUI/models`.
+ *
+ * It lives in lib rather than beside the Models view because two very
+ * different callers need the same answer: the view, which lists LoRAs on their
+ * own rail, and the model store, which must never let one become the active
+ * model. A LoRA is not a model you switch to.
+ */
+export function isLoraRow(m: AIModel): boolean {
+ return 'source' in m && m.source === 'lora'
+}
diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.ts
index 20e32508..a788da9c 100644
--- a/src/lib/release-notes.ts
+++ b/src/lib/release-notes.ts
@@ -392,8 +392,8 @@ export const RELEASE_NOTES: ReleaseNote[] = [
detail: 'At a narrow window width, picking a model, opening the sampling sliders or opening the plugins menu used to leave the whole chat shifted sideways afterward, because the shared chat area allowed the browser to scroll it into view when a clicked control sat partly off screen. That area no longer accepts a programmatic scroll, so it stays put.',
},
{
- title: 'Models now has a LoRAs tab that searches and installs from CivitAI.',
- detail: 'Models has a LoRAs entry of its own next to Chat, Image and Video. Get new searches CivitAI for LoRAs and downloads what you pick into ComfyUI\'s models/loras folder; Installed lists what is already there with its size, marks the characters you trained yourself with their trigger word, and deletes a file you no longer want. LoRAs no longer sit unnamed among the checkpoints in the Image tab, where one could be picked as if it were a main model.',
+ title: 'Models now has a LoRAs tab that searches and installs from CivitAI (Windows and Linux).',
+ detail: 'On Windows and Linux, Models has a LoRAs entry of its own next to Chat, Image and Video. Get new searches CivitAI for LoRAs and downloads what you pick into ComfyUI\'s models/loras folder; Installed lists what is already there with its size, marks the characters you trained yourself with their trigger word, and deletes a file you no longer want. LoRAs no longer sit unnamed among the checkpoints in the Image tab, where one could be picked as if it were a main model. The tab is not offered on a Mac, where local media runs on Apple MLX and there is no ComfyUI loras folder to list.',
},
{
title: 'Update ComfyUI now asks first and refuses while ComfyUI is busy.',
diff --git a/src/stores/__tests__/eine-lora-bleibt-keine-wahl.test.ts b/src/stores/__tests__/eine-lora-bleibt-keine-wahl.test.ts
new file mode 100644
index 00000000..ac585f7f
--- /dev/null
+++ b/src/stores/__tests__/eine-lora-bleibt-keine-wahl.test.ts
@@ -0,0 +1,68 @@
+/**
+ * Ein LoRA ist keine Modellwahl, auch nicht als Rest aus einer alten Version.
+ *
+ * Bis zum LoRA-Reiter standen die Dateien aus `ComfyUI/models/loras` zwischen
+ * den Checkpoints im Bild-Reiter und waren dort anklickbar. Wer einmal
+ * geklickt hat, traegt den Namen bis heute in `activeModel`. Die Pruefung in
+ * `setModels` fragt nur, ob der Name in der frischen Liste STEHT, und die
+ * LoRA steht dort weiter (die volle Inventur enthaelt sie, nur die Ansicht
+ * filtert sie heraus). Also blieb die Wahl stehen, und abwaehlen liess sie
+ * sich in Models nicht mehr, weil es die Zeile dort nicht mehr gibt.
+ *
+ * Run: npx vitest run src/stores/__tests__/eine-lora-bleibt-keine-wahl.test.ts
+ */
+import { describe, it, expect, beforeEach, vi } from 'vitest'
+import type { AIModel } from '../../types/models'
+
+vi.mock('../../api/ollama', () => ({ unloadModel: vi.fn() }))
+vi.mock('../../api/lmstudio', () => ({ unloadLmStudioModel: vi.fn() }))
+vi.mock('../../api/engine', () => ({ activateBuiltinModel: vi.fn() }))
+vi.mock('../../api/backend', () => ({ isTauri: () => false, backendCall: vi.fn() }))
+vi.mock('../../api/builtin-ensure', () => ({
+ ensureBuiltinEngineAlive: vi.fn(),
+ builtinSlotSwitchedOff: vi.fn(),
+}))
+
+import { useModelStore } from '../modelStore'
+
+const LORA: AIModel = {
+ name: 'pixel_art_xl.safetensors', model: 'pixel_art_xl.safetensors', size: 170_917_888,
+ format: 'safetensors', architecture: 'sdxl', type: 'image', providerName: 'ComfyUI',
+ source: 'lora',
+}
+const CHECKPOINT: AIModel = {
+ name: 'sdxl_base.safetensors', model: 'sdxl_base.safetensors', size: 6_000_000_000,
+ format: 'safetensors', architecture: 'sdxl', type: 'image', providerName: 'ComfyUI',
+ source: 'checkpoint',
+}
+
+beforeEach(() => {
+ useModelStore.setState({ models: [], activeModel: null })
+})
+
+describe('setModels raeumt eine verwaiste LoRA-Wahl auf', () => {
+ it('THE FIX: eine Wahl, die auf eine LoRA zeigt, faellt beim naechsten Laden', () => {
+ useModelStore.setState({ activeModel: LORA.name })
+ useModelStore.getState().setModels([CHECKPOINT, LORA])
+ expect(useModelStore.getState().activeModel).not.toBe(LORA.name)
+ // Kein Chatmodell in der Liste, also bleibt nichts uebrig: das ist
+ // dieselbe Antwort, die ein geloeschter Name bekommt.
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+
+ // GEGENPROBE: die Regel trifft nur die LoRAs. Alles andere, was hier stand,
+ // steht weiter da.
+ it('GEGENPROBE: ein Checkpoint als Wahl bleibt unangetastet', () => {
+ useModelStore.setState({ activeModel: CHECKPOINT.name })
+ useModelStore.getState().setModels([CHECKPOINT, LORA])
+ expect(useModelStore.getState().activeModel).toBe(CHECKPOINT.name)
+ })
+
+ it('GEGENPROBE: eine leere Liste entscheidet weiter gar nichts', () => {
+ // Eine Inventur, die nichts geliefert hat, ist keine Aussage ueber die
+ // Wahl. Diese Regel stand vor dem LoRA-Reiter hier und bleibt.
+ useModelStore.setState({ activeModel: LORA.name })
+ useModelStore.getState().setModels([])
+ expect(useModelStore.getState().activeModel).toBe(LORA.name)
+ })
+})
diff --git a/src/stores/modelStore.ts b/src/stores/modelStore.ts
index c57e8e16..8b2dbcd7 100644
--- a/src/stores/modelStore.ts
+++ b/src/stores/modelStore.ts
@@ -2,6 +2,7 @@ import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import { safeJSONStorage } from '../lib/storage-quota'
import { canAutoSelectChat } from '../lib/chat-model-minimum'
+import { isLoraRow } from '../lib/lora-rows'
import type { AIModel, PullProgress, ModelCategory } from '../types/models'
import { unloadModel } from '../api/ollama'
import { unloadLmStudioModel } from '../api/lmstudio'
@@ -244,9 +245,18 @@ export const useModelStore = create<ModelState>()(
// getauscht wurde. Gesagt wird es deshalb dort, wo beide Seiten
// noch dastehen: bei dem, der die Liste hereingibt
// (hooks/useModels, announceChatModelReplaced).
+ // Ein LoRA ist keine Wahl. Bis zum LoRA-Reiter standen die Dateien
+ // aus `loras` zwischen den Checkpoints im Bild-Reiter und waren
+ // anklickbar, und wer damals einmal geklickt hat, traegt den Namen
+ // bis heute hier. Die Zeile steht weiter in der vollen Inventur,
+ // also haette die Pruefung unten sie fuer gueltig gehalten, und
+ // abwaehlen laesst sie sich in Models nicht mehr. Die Wahl faellt
+ // deshalb beim naechsten Laden zurueck, denselben Weg wie ein Name,
+ // den es nicht mehr gibt.
+ const gewaehlteZeile = models.find((m) => m.name === state.activeModel)
const stillValid =
!!state.activeModel &&
- (models.length === 0 || models.some((m) => m.name === state.activeModel))
+ (models.length === 0 || (!!gewaehlteZeile && !isLoraRow(gewaehlteZeile)))
// Automatic choices need a known size of at least 7B. Image/video,
// small models and opaque aliases require no implicit chat pick.
// The valid persisted choice above remains the user's decision.