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): das LU-Engine-Heading ist eine Warnung, kein Schmuck

purpleae57d56d639f
diff --git a/src/components/models/ModelManager.tsx b/src/components/models/ModelManager.tsx
index 3b22d316..621b6d01 100644
--- a/src/components/models/ModelManager.tsx
+++ b/src/components/models/ModelManager.tsx
@@ -21,7 +21,7 @@ import { MlxMediaSettings } from '../settings/MlxMediaSettings'
import { backendCall } from '../../api/backend'
import { customModelDirs } from '../../api/engine'
import { counterView } from '../../lib/inventory-counter'
-import { groupInstalledByProvider } from '../../lib/lu-engine-rows'
+import { groupInstalledByProvider, needsLuEngineHeading } from '../../lib/lu-engine-rows'
import type { InstalledModelLike } from '../../lib/lmstudio-match'
import type { ModelCategory, AIModel } from '../../types/models'
@@ -60,6 +60,9 @@ export function ModelManager() {
} = useModels()
const { setView, openSettingsAt } = useUIStore()
const ollamaEnabled = useProviderStore(s => s.providers.ollama.enabled)
+ // A14: whether the LU Engine itself is serving the chat. Decides whether its
+ // group needs a heading even when it is the only group (review 7).
+ const luEngineHoldsChat = useProviderStore(s => s.providers.openai.enabled && s.providers.openai.managed === true)
const [pullOpen, setPullOpen] = useState(false)
const [infoOpen, setInfoOpen] = useState(false)
const [modelInfo, setModelInfo] = useState<any>(null)
@@ -412,10 +415,15 @@ export function ModelManager() {
no heading: there is nothing to tell apart then. */}
{(() => {
const providerGroups = groupInstalledByProvider(shown as unknown as InstalledModelLike[])
+ // One group normally draws no heading. The exception
+ // is an LU Engine group while another backend holds
+ // the chat: then the heading is not decoration, it is
+ // the warning that a click here moves the backend.
+ const showHeadings = needsLuEngineHeading(providerGroups, luEngineHoldsChat)
let drawn = 0
return providerGroups.map(({ label, models: rows }) => (
<div key={label} className="space-y-1.5">
- {providerGroups.length > 1 && (
+ {showHeadings && (
<p className="px-1 pt-1 text-[0.55rem] font-medium uppercase tracking-widest text-gray-500 dark:text-gray-500">
{label}
</p>
diff --git a/src/components/models/ModelSelector.tsx b/src/components/models/ModelSelector.tsx
index 1655d0e0..ce2489a6 100644
--- a/src/components/models/ModelSelector.tsx
+++ b/src/components/models/ModelSelector.tsx
@@ -971,8 +971,11 @@ export function ModelSelector({ openUpward = false, surface = 'chat', answeredBy
{groups.map(({ family, models: groupModels }) => (
<div key={family}>
- {/* Section header */}
- {groups.length > 1 && (
+ {/* Section header. One group normally draws none; an LU
+ Engine group under a foreign chat backend draws one
+ anyway, because that heading is the warning that picking
+ from it moves the backend (A14 review 7). */}
+ {(groups.length > 1 || (!luEngineHoldsChat && family === LU_ENGINE_GROUP)) && (
<div className="px-2.5 pt-2 pb-0.5">
<span className="text-[0.55rem] font-medium uppercase tracking-widest text-gray-600">
{family}
diff --git a/src/components/settings/CivitaiApiKeySetting.tsx b/src/components/settings/CivitaiApiKeySetting.tsx
index 462fe7b5..3ad1c838 100644
--- a/src/components/settings/CivitaiApiKeySetting.tsx
+++ b/src/components/settings/CivitaiApiKeySetting.tsx
@@ -15,7 +15,8 @@
* provider keys and the HuggingFace token live.
*/
import { useEffect, useState } from 'react'
-import { KeyRound, Check } from 'lucide-react'
+import { KeyRound, Check, AlertTriangle } from 'lucide-react'
+import { looksLikeAFolderPath, CIVITAI_KEY_PLACEHOLDER, CIVITAI_KEY_LOOKS_WRONG } from '../../lib/civitai-key-shape'
import { useWorkflowStore } from '../../stores/workflowStore'
import { openExternal } from '../../api/backend'
@@ -55,7 +56,7 @@ export function CivitaiApiKeySetting() {
value={draft}
onChange={(e) => { setDraft(e.target.value); setSaved(false) }}
onBlur={save}
- placeholder="(none)"
+ placeholder={CIVITAI_KEY_PLACEHOLDER}
spellCheck={false}
autoComplete="off"
aria-label="CivitAI API key"
@@ -77,6 +78,12 @@ export function CivitaiApiKeySetting() {
</button>
)}
</div>
+ {looksLikeAFolderPath(draft) && (
+ <div data-testid="civitai-key-looks-wrong" className="flex items-start gap-1.5 text-[0.6rem] leading-relaxed text-amber-600 dark:text-amber-400">
+ <AlertTriangle size={11} className="shrink-0 mt-0.5" />
+ <span>{CIVITAI_KEY_LOOKS_WRONG}</span>
+ </div>
+ )}
<button
onClick={() => { void openExternal(CIVITAI_KEY_PAGE) }}
className="text-[0.6rem] text-purple-500 hover:text-purple-400 transition-colors"
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 3d51e450..dbd4b50f 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -1625,10 +1625,16 @@ export function SettingsPage() {
<HfDownloadPathSetting />
<LmStudioFolderSetting />
<ImportLocalModels />
- {/* goonerforporn (Discord #bug-reports, 2026-08-28): the store knew
- the key, the changelog named it, and no component ever set it.
- It sits with the other credential-shaped model settings, which
- is also the place the refused-download message points at. */}
+ </Section>
+
+ {/* goonerforporn (Discord #bug-reports, 2026-08-28): the store knew
+ the key, the changelog named it, and no component ever set it.
+ A14 review 8, Windows follow-up: it then sat directly under the
+ Model Storage folder field, two bare text boxes in a row, and a
+ tester saved a filesystem path as his API key. A credential and a
+ folder do not belong in one list, so the key has a section of its
+ own now, and the field says what a key looks like. */}
+ <Section title="CivitAI API key">
<CivitaiApiKeySetting />
</Section>
diff --git a/src/components/settings/__tests__/civitai-key-field-renders.test.ts b/src/components/settings/__tests__/civitai-key-field-renders.test.ts
index 19cda8e0..cc0d8a7a 100644
--- a/src/components/settings/__tests__/civitai-key-field-renders.test.ts
+++ b/src/components/settings/__tests__/civitai-key-field-renders.test.ts
@@ -97,3 +97,51 @@ describe('the field exists and writes to the store', () => {
expect(text).toMatch(/system credential store/)
})
})
+
+// ── A14 review 8: a key field that cannot be mistaken for a folder field ────
+//
+// From the Windows follow-up: the Model Storage folder field and this one sat
+// directly under each other, two bare text boxes in a row, and a tester saved
+// a filesystem path as his API key. Nothing said no, the path went into the OS
+// credential store, every CivitAI download kept failing with a bare 400, and
+// the field showed a row of dots that looked exactly like a key that was there.
+
+describe('the field says what belongs in it', () => {
+ it('the empty field shows the shape of a key, not the word none', () => {
+ show()
+ const field = screen.getByLabelText('CivitAI API key') as HTMLInputElement
+ expect(field.placeholder).toMatch(/^[0-9a-f]{32}$/)
+ expect(field.placeholder).not.toBe('(none)')
+ })
+
+ it('a pasted Windows path is called out instead of silently stored', () => {
+ show()
+ const field = screen.getByLabelText('CivitAI API key')
+ fireEvent.change(field, { target: { value: 'G:\\AI\\Models' } })
+ expect(screen.getByTestId('civitai-key-looks-wrong').textContent)
+ .toContain('That looks like a folder, not a key')
+ // And it names where that value actually belongs.
+ expect(screen.getByTestId('civitai-key-looks-wrong').textContent).toContain('Model Storage')
+ })
+
+ it('a pasted Unix path too', () => {
+ show()
+ fireEvent.change(screen.getByLabelText('CivitAI API key'), { target: { value: '/Users/dev/lu-e2e-models' } })
+ expect(screen.getByTestId('civitai-key-looks-wrong')).toBeTruthy()
+ })
+
+ // NEGATIVE CONTROL, and the important one: a real key must never trip this.
+ // A key the user cannot save without a warning beside it is a feature he
+ // stops trusting.
+ it('stays quiet for a real key', () => {
+ show()
+ fireEvent.change(screen.getByLabelText('CivitAI API key'), { target: { value: '3f9a1c7d5e2b48f06a1d9c3e7b52f8a4' } })
+ expect(screen.queryByTestId('civitai-key-looks-wrong')).toBeNull()
+ })
+
+ // NEGATIVE CONTROL: an empty field is not a mistake, it is the default.
+ it('stays quiet on an empty field', () => {
+ show()
+ expect(screen.queryByTestId('civitai-key-looks-wrong')).toBeNull()
+ })
+})
diff --git a/src/lib/__tests__/lu-engine-groups.test.ts b/src/lib/__tests__/lu-engine-groups.test.ts
index a32c27c5..5f4ecc75 100644
--- a/src/lib/__tests__/lu-engine-groups.test.ts
+++ b/src/lib/__tests__/lu-engine-groups.test.ts
@@ -11,7 +11,7 @@
* Run: npx vitest run src/lib/__tests__/lu-engine-groups.test.ts
*/
import { describe, it, expect } from 'vitest'
-import { splitLuEngineRows, groupInstalledByProvider, dropDuplicateLuEngineRows, LU_ENGINE_GROUP } from '../lu-engine-rows'
+import { splitLuEngineRows, groupInstalledByProvider, dropDuplicateLuEngineRows, needsLuEngineHeading, LU_ENGINE_GROUP } from '../lu-engine-rows'
const lu = (n: string) => ({ name: `openai::${n}`, model: n, provider: 'openai', providerName: 'LU Engine' })
const luOld = (n: string) => ({ name: `openai::${n}`, model: n, provider: 'openai', providerName: 'Built-in Engine' })
@@ -122,3 +122,40 @@ describe('de-duplication asks about the FILE, never about the model', () => {
expect(dropDuplicateLuEngineRows([row], lmsHas('qwen2.5-0.5b-instruct-abliterated@q8_0'))).toEqual([row])
})
})
+
+// ── A14 review 7: the heading is the warning, so it cannot be optional ──────
+
+describe('when the LU Engine heading has to be drawn', () => {
+ const luGroup = groupInstalledByProvider([lu('a')])
+ const ollamaGroup = groupInstalledByProvider([ollama('a')])
+ const both = groupInstalledByProvider([lu('a'), ollama('b')])
+
+ // THE REVIEW FINDING. A user whose only local models are GGUFs in the LU
+ // Engine folder, with Ollama or LM Studio in front, got one unlabelled list
+ // and a click that moved his chat backend without a word of warning.
+ it('one LU Engine group under a foreign backend still gets its heading', () => {
+ expect(needsLuEngineHeading(luGroup, false)).toBe(true)
+ })
+
+ it('and so does a list with more than one backend in it, either way round', () => {
+ expect(needsLuEngineHeading(both, false)).toBe(true)
+ expect(needsLuEngineHeading(both, true)).toBe(true)
+ })
+
+ // NEGATIVE CONTROL: a plain Ollama box looks exactly as it did before. A
+ // heading over the only list there names nothing the user did not know.
+ it('a single foreign group draws none', () => {
+ expect(needsLuEngineHeading(ollamaGroup, false)).toBe(false)
+ expect(needsLuEngineHeading(ollamaGroup, true)).toBe(false)
+ })
+
+ // NEGATIVE CONTROL: with the LU Engine itself in front there is no switch to
+ // warn about, so its own single group needs no heading either.
+ it('and neither does the LU Engine when it is already the chat backend', () => {
+ expect(needsLuEngineHeading(luGroup, true)).toBe(false)
+ })
+
+ it('an empty list needs nothing', () => {
+ expect(needsLuEngineHeading([], false)).toBe(false)
+ })
+})
diff --git a/src/lib/civitai-key-shape.ts b/src/lib/civitai-key-shape.ts
new file mode 100644
index 00000000..bee95f4b
--- /dev/null
+++ b/src/lib/civitai-key-shape.ts
@@ -0,0 +1,44 @@
+/**
+ * Telling a CivitAI API key apart from a folder path.
+ *
+ * A14 review 8, from the Windows follow-up: the Model Storage folder field and
+ * the CivitAI key field sat directly under each other, two bare text boxes in
+ * a row, and a tester saved a filesystem path as his API key. Nothing said no.
+ * The key then went into the OS credential store, every CivitAI download kept
+ * failing with a bare 400, and the field showed a row of dots that looked
+ * exactly like a key that was there.
+ *
+ * Two answers, and the first one does most of the work: the key has a section
+ * of its own now, away from the folder. This is the second, for whoever still
+ * pastes the wrong thing.
+ */
+
+/** What the empty field shows. A CivitAI key is 32 hex characters, so the
+ * placeholder is 32 hex characters: the shape is the instruction. */
+export const CIVITAI_KEY_PLACEHOLDER = '3f9a1c7d5e2b48f06a1d9c3e7b52f8a4'
+
+/** Said under the field when what is in it is plainly not a key. */
+export const CIVITAI_KEY_LOOKS_WRONG =
+ 'That looks like a folder, not a key. The model folder is set further up, under Model Storage. A CivitAI key is a single line of letters and digits from your CivitAI account page.'
+
+/**
+ * Is this a filesystem path rather than a key.
+ *
+ * Narrow on purpose, because a false alarm on a real key is worse than no
+ * alarm at all: a key that a user cannot save is a feature he cannot use. Only
+ * shapes a CivitAI key can never have count, and every one of them is a
+ * separator no key contains.
+ */
+export function looksLikeAFolderPath(value: string | null | undefined): boolean {
+ const v = (value ?? '').trim()
+ if (!v) return false
+ // A Windows drive letter, the shape from the report: C:\ or G:/
+ if (/^[a-z]:[\\/]/i.test(v)) return true
+ // A UNC share or a POSIX absolute path.
+ if (v.startsWith('\\\\') || v.startsWith('/')) return true
+ // A home-relative path.
+ if (v.startsWith('~/') || v.startsWith('~\\')) return true
+ // Anything carrying a separator at all. No key does.
+ if (v.includes('/') || v.includes('\\')) return true
+ return false
+}
diff --git a/src/lib/lu-engine-rows.ts b/src/lib/lu-engine-rows.ts
index 881f85ef..f77697eb 100644
--- a/src/lib/lu-engine-rows.ts
+++ b/src/lib/lu-engine-rows.ts
@@ -97,6 +97,25 @@ export interface ProviderGroup<T> {
models: T[]
}
+/**
+ * Must the LU Engine heading be drawn even though there is only one group.
+ *
+ * A14 review 7: the render dropped every heading at one group, which is right
+ * for a plain Ollama box and wrong for the exact machine this whole change is
+ * about. A user whose only local models are GGUFs in the LU Engine folder,
+ * with Ollama or LM Studio in front and nothing of their own installed, saw
+ * one unlabelled list and a click that moved his chat backend without a word
+ * of warning. The heading is the warning, so it is drawn whenever a foreign
+ * backend holds the chat, group count be damned.
+ */
+export function needsLuEngineHeading<T extends InstalledModelLike>(
+ groups: ProviderGroup<T>[],
+ luEngineHoldsChat: boolean,
+): boolean {
+ if (groups.length > 1) return true
+ return !luEngineHoldsChat && groups.some((g) => g.label === LU_ENGINE_GROUP)
+}
+
/**
* Installed rows grouped by the backend that serves them, LU Engine first.
*