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.

Require known 7B size for automatic chat model selection

David4a6ddc85122e
diff --git a/e2e/model-minimum-selection.spec.ts b/e2e/model-minimum-selection.spec.ts
new file mode 100644
index 00000000..76d7c49d
--- /dev/null
+++ b/e2e/model-minimum-selection.spec.ts
@@ -0,0 +1,17 @@
+import { test, expect } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY } from './support/tauri-mock'
+import { seedOnboardingDone } from './support/cloud-mock'
+
+test('small installed model waits for a choice and preserves that explicit choice on reload', async ({ page }) => {
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: 'Hermes-3-Llama-3.2-3B.Q4_K_M' })
+ await seedOnboardingDone(page)
+ await page.goto('/')
+ await expect(page.getByText('Choose a model below. Automatic picks require a known size of at least 7B.')).toBeVisible()
+ const picker = page.getByRole('button', { name: 'Select chat model', exact: true })
+ await expect(picker).toContainText('Select Model')
+ await picker.click()
+ await page.getByRole('button').filter({ hasText: 'Hermes' }).click()
+ await expect(picker).toContainText('Hermes')
+ await page.reload()
+ await expect(page.getByRole('button', { name: 'Select chat model', exact: true })).toContainText('Hermes')
+})
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index 6cc64b79..a3f10528 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -231,7 +231,7 @@ export function ChatView() {
: !activeModel
// Der Waehler steht IM Composer und oeffnet nach oben. Der alte Satz
// hier hiess „Select a model above." und zeigte in die falsche Richtung.
- ? { subline: 'Pick a model in the box below, then type.', cta: null }
+ ? { subline: 'Choose a model below. Automatic picks require a known size of at least 7B.', cta: null }
// Der Modellname steht auf einer EIGENEN Zeile und wird gekuerzt: er ist
// haeufig 50+ Zeichen lang (`hf.co/DevQuasar/huihui-ai_Qwen3-4B-abliterated-GGUF`),
// und im Fliesstext liess er die Zeile dreimal umbrechen.
diff --git a/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts b/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts
index 0c3980c1..40dd2d23 100644
--- a/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts
+++ b/src/components/chat/__tests__/die-eingangsseite-hat-eine-tuer.test.ts
@@ -67,7 +67,7 @@ describe('D-S02: die Eingangsseite sagt, wo man ist und was zu tun ist', () => {
// oben; er steht also UNTER diesem Text, nicht darueber.
// Im Code — der Kommentar an der Stelle NENNT den alten Satz.
expect(VIEW_CODE).not.toContain('Select a model above')
- expect(VIEW_CODE).toContain('Pick a model in the box below')
+ expect(VIEW_CODE).toContain('Choose a model below. Automatic picks require a known size of at least 7B.')
})
it('der Primaerknopf steht genau dort, wo der Composer nicht weiterhilft', () => {
diff --git a/src/hooks/__tests__/die-neue-liste-sagt-den-tausch-an.test.ts b/src/hooks/__tests__/die-neue-liste-sagt-den-tausch-an.test.ts
index 188fcdae..e8625126 100644
--- a/src/hooks/__tests__/die-neue-liste-sagt-den-tausch-an.test.ts
+++ b/src/hooks/__tests__/die-neue-liste-sagt-den-tausch-an.test.ts
@@ -75,7 +75,7 @@ const { useModelStore } = await import('../../stores/modelStore')
const { useLuEngineSwitchStore } = await import('../../stores/luEngineSwitchStore')
const LMS = 'openai::qwen2.5-0.5b-instruct'
-const OLLAMA = 'llama3.2:3b'
+const OLLAMA = 'test-model:8b'
/** Was LM Studio ueber den geteilten openai-Steckplatz meldet. */
function lmStudioIstDa() {
diff --git a/src/lib/__tests__/chat-model-minimum.test.ts b/src/lib/__tests__/chat-model-minimum.test.ts
index 7db013db..16a7b29c 100644
--- a/src/lib/__tests__/chat-model-minimum.test.ts
+++ b/src/lib/__tests__/chat-model-minimum.test.ts
@@ -1,8 +1,29 @@
import { describe, expect, it } from 'vitest'
import { getMainstreamTextModels, getUncensoredTextModels } from '../../api/discover'
-import { chatRecommendationGroups, isBelowChatMinimum } from '../chat-model-minimum'
+import { canAutoSelectChat, chatRecommendationGroups, installedChatSizeB, isBelowChatMinimum } from '../chat-model-minimum'
+import { pickForMode } from '../active-model-mode'
describe('chat catalog minimum', () => {
+ it('uses explicit installed metadata and safe total-size name boundaries', () => {
+ expect(installedChatSizeB({ name: 'alias', details: { parameter_size: '7600M' } })).toBe(7.6)
+ expect(installedChatSizeB({ name: 'alias-8B', details: { parameter_size: '3.8B' } })).toBe(3.8)
+ expect(installedChatSizeB({ name: 'qwen3-30B-A3B' })).toBe(30)
+ expect(installedChatSizeB({ name: 'unknown-A3B' })).toBeNull()
+ expect(installedChatSizeB({ name: 'file-3GB-Q4_K_M' })).toBeNull()
+ expect(canAutoSelectChat({ name: 'opaque-api-model' })).toBe(false)
+ expect(canAutoSelectChat({ name: 'model-8B', type: 'image' })).toBe(false)
+ expect(canAutoSelectChat({ name: 'model-7B', type: 'text' })).toBe(true)
+ })
+
+ it('applies the same minimum to mode fallback while honoring named choices', () => {
+ const small = { name: 'test-3B', type: 'text', provider: 'openai' }
+ const large = { name: 'test-7B', type: 'text', provider: 'openai' }
+ const opaque = { name: 'opaque', type: 'text', provider: 'openai' }
+ expect(pickForMode(null, [small, opaque, large], 'local').next).toBe(large.name)
+ expect(pickForMode(null, [small, opaque], 'local').next).toBeNull()
+ expect(pickForMode(small.name, [small, large], 'local').change).toBe(false)
+ expect(pickForMode(null, [small, large], 'local', small.name)).toMatchObject({ next: small.name, usedRequest: true })
+ })
it('uses parameter counts, not quantization, file size or MoE active counts', () => {
for (const tag of ['0.5B', '3B', '3.8B', '4B', '6.9B']) expect(isBelowChatMinimum({ tags: [tag] })).toBe(true)
for (const tag of ['7B', '8B', '70B', '3 GB', 'Q4_K_M', 'A3B', '30B-A3B', 'unknown']) expect(isBelowChatMinimum({ tags: [tag] })).toBe(false)
diff --git a/src/lib/__tests__/cloud-teaser-click-identity.test.ts b/src/lib/__tests__/cloud-teaser-click-identity.test.ts
index ec536696..4251b095 100644
--- a/src/lib/__tests__/cloud-teaser-click-identity.test.ts
+++ b/src/lib/__tests__/cloud-teaser-click-identity.test.ts
@@ -108,10 +108,10 @@ describe('THE FIX: the clicked LU Cloud row is the model that comes out', () =>
})
})
-describe('NEGATIVE CONTROL: the rule without a request is untouched', () => {
- it('no request, an out-of-mode pick: the old fallback, unchanged', () => {
+describe('automatic choice requires verified size, named requests retain identity', () => {
+ it('clears an out-of-mode pick when hosted sizes are unknown', () => {
const pick = pickForMode(LOCAL.name, [LOCAL, ...HOSTED], 'cloud')
- expect(pick.next).toBe('kimi-k3')
+ expect(pick.next).toBeNull()
expect(pick.change).toBe(true)
expect(pick.usedRequest).toBe(false)
})
@@ -125,9 +125,9 @@ describe('NEGATIVE CONTROL: the rule without a request is untouched', () => {
expect(pick.usedRequest).toBe(false)
})
- it('a request for a model that is not in the list falls back as before', () => {
+ it('does not substitute an unknown-size model for a missing request', () => {
const pick = pickForMode(LOCAL.name, [LOCAL, ...HOSTED], 'cloud', 'a-model-that-left')
- expect(pick.next).toBe('kimi-k3')
+ expect(pick.next).toBeNull()
expect(pick.usedRequest).toBe(false)
})
diff --git a/src/lib/__tests__/die-app-sagt-wenn-sie-selbst-umwaehlt.test.ts b/src/lib/__tests__/die-app-sagt-wenn-sie-selbst-umwaehlt.test.ts
index 982141e2..165b154e 100644
--- a/src/lib/__tests__/die-app-sagt-wenn-sie-selbst-umwaehlt.test.ts
+++ b/src/lib/__tests__/die-app-sagt-wenn-sie-selbst-umwaehlt.test.ts
@@ -20,7 +20,8 @@ import { resolve } from 'node:path'
import { pickForMode, replacedBehindTheUsersBack } from '../active-model-mode'
const LM = { name: 'qwen2.5-0.5b', provider: 'openai' }
-const KAPUTT = { name: 'G1-Kaputt-Q4_K_M', provider: 'openai' }
+// Preserve the replacement-notification scenario with an eligible fixture.
+const KAPUTT = { name: 'test-broken-8B-Q4_K_M', provider: 'openai' }
const PHI = { name: 'Phi-4-mini-instruct-Q4_K_M', provider: 'openai' }
describe('replacedBehindTheUsersBack', () => {
diff --git a/src/lib/__tests__/die-verdraengte-wahl-wird-angesagt.test.ts b/src/lib/__tests__/die-verdraengte-wahl-wird-angesagt.test.ts
index 69f1e3d6..7166b580 100644
--- a/src/lib/__tests__/die-verdraengte-wahl-wird-angesagt.test.ts
+++ b/src/lib/__tests__/die-verdraengte-wahl-wird-angesagt.test.ts
@@ -138,7 +138,7 @@ describe('DER BEFUND: Enable auf der Standby-Karte sagt jetzt etwas', () => {
it('warum die Modusregel das nicht auffangen kann', () => {
// Nach dem Raeumen ist der alte Name weg. Die Regel in AppShell hat
// nichts mehr zu nennen und schweigt zu Recht.
- const pick = pickForMode(null, [{ name: LMS_ROW, provider: 'openai' }], 'local')
+ const pick = pickForMode(null, [{ name: 'test-model-8B', provider: 'openai' }], 'local')
expect(pick.change).toBe(true)
expect(replacedBehindTheUsersBack(null, pick, false)).toBe(false)
})
diff --git a/src/lib/__tests__/model-pick-survives-restart.test.ts b/src/lib/__tests__/model-pick-survives-restart.test.ts
index e79f7373..4e984811 100644
--- a/src/lib/__tests__/model-pick-survives-restart.test.ts
+++ b/src/lib/__tests__/model-pick-survives-restart.test.ts
@@ -49,16 +49,16 @@ describe('the picked model survives a restart', () => {
expect(pickForMode(QWEN, LOCAL_LIST, 'local')).toMatchObject({ change: false, next: QWEN })
})
- it('NEGATIVE CONTROL: a model that really is gone still hands over to the first one', () => {
+ it('clears a missing choice instead of automatically selecting a small model', () => {
// The dead-name guard is the reason this rule exists. A picker showing a
// model the provider no longer has opens an empty list on click.
expect(pickForMode('openai::deleted-model', LOCAL_LIST, 'local'))
- .toMatchObject({ change: true, next: HERMES })
+ .toMatchObject({ change: true, next: null })
})
it('NEGATIVE CONTROL: flipping to Cloud still moves off a local model', () => {
const withCloud = [...LOCAL_LIST, { name: 'lu-cloud::glm-5.3', type: 'text', provider: 'lu-cloud' }]
- expect(pickForMode(QWEN, withCloud, 'cloud')).toMatchObject({ change: true, next: 'lu-cloud::glm-5.3' })
+ expect(pickForMode(QWEN, withCloud, 'cloud')).toMatchObject({ change: true, next: null })
})
it('NEGATIVE CONTROL: Local mode with nothing but cloud models clears the pick', () => {
@@ -80,7 +80,7 @@ describe('the picked model survives a restart', () => {
expect(pickForMode(null, [], 'local')).toMatchObject({ change: false, next: null })
})
- it('a first launch with models and no pick takes the first in-mode one', () => {
- expect(pickForMode(null, LOCAL_LIST, 'local')).toMatchObject({ change: true, next: HERMES })
+ it('a first launch with only small models waits for an explicit choice', () => {
+ expect(pickForMode(null, LOCAL_LIST, 'local')).toMatchObject({ change: false, next: null })
})
})
diff --git a/src/lib/active-model-mode.ts b/src/lib/active-model-mode.ts
index 8dd4a946..083dae43 100644
--- a/src/lib/active-model-mode.ts
+++ b/src/lib/active-model-mode.ts
@@ -1,4 +1,5 @@
import type { AppMode } from '../types/settings'
+import { canAutoSelectChat, type ChatSizeCandidate } from './chat-model-minimum'
/**
* Which chat model may stay selected under the current Local/Cloud switch.
@@ -14,7 +15,7 @@ import type { AppMode } from '../types/settings'
* An empty list is not evidence that a model is gone. It is the absence of
* evidence, and this rule is re-run the moment the real list lands.
*/
-export interface ModeCandidate {
+export interface ModeCandidate extends ChatSizeCandidate {
name: string
type?: string
provider?: string
@@ -76,7 +77,7 @@ export function pickForMode(
const current = activeModel ? models.find((m) => m.name === activeModel) : undefined
if (current && wanted(current)) return { change: false, next: activeModel, usedRequest: false }
- const fallback = models.find(wanted)
+ const fallback = models.find(model => wanted(model) && canAutoSelectChat(model))
if (activeModel === null && !fallback) return { change: false, next: null, usedRequest: false }
return { change: true, next: fallback ? fallback.name : null, usedRequest: false }
}
diff --git a/src/lib/chat-model-minimum.ts b/src/lib/chat-model-minimum.ts
index ae5e17eb..1e2e801d 100644
--- a/src/lib/chat-model-minimum.ts
+++ b/src/lib/chat-model-minimum.ts
@@ -13,3 +13,32 @@ export function isBelowChatMinimum(model: Pick<DiscoverModel, 'tags'>): boolean
export function chatRecommendationGroups(groups: DiscoverModel[][]): DiscoverModel[][] {
return groups.filter(group => group.length > 0 && group.every(model => !isBelowChatMinimum(model)))
}
+
+export interface ChatSizeCandidate {
+ name: string
+ model?: string
+ type?: string
+ details?: { parameter_size?: string }
+}
+
+/** Prefer explicit provider metadata; names are a fallback, never byte sizes. */
+export function installedChatSizeB(model: ChatSizeCandidate): number | null {
+ const stated = model.details?.parameter_size?.trim()
+ if (stated) {
+ const match = /^(\d+(?:\.\d+)?)\s*([BM])$/i.exec(stated)
+ if (match) {
+ const count = Number(match[1]) / (match[2].toUpperCase() === 'M' ? 1000 : 1)
+ if (Number.isFinite(count) && count > 0) return count
+ }
+ }
+ // Require a boundary before the count so A3B is not read as total size.
+ const match = /(?:^|[^a-z0-9.])(\d+(?:\.\d+)?)b(?=$|[^a-z0-9])/i.exec(model.model || model.name)
+ const count = match ? Number(match[1]) : null
+ return count !== null && Number.isFinite(count) && count > 0 ? count : null
+}
+
+export function canAutoSelectChat(model: ChatSizeCandidate): boolean {
+ if (model.type === 'image' || model.type === 'video') return false
+ const count = installedChatSizeB(model)
+ return count !== null && count >= 7
+}
diff --git a/src/stores/__tests__/modelStore-pick-persistence.test.ts b/src/stores/__tests__/modelStore-pick-persistence.test.ts
index 480c6347..17548d4a 100644
--- a/src/stores/__tests__/modelStore-pick-persistence.test.ts
+++ b/src/stores/__tests__/modelStore-pick-persistence.test.ts
@@ -52,12 +52,12 @@ describe('an empty model list is not a reason to drop the pick', () => {
expect(useModelStore.getState().activeModel).toBe(QWEN)
})
- it('NEGATIVE CONTROL: a pick that is genuinely gone still hands over', () => {
+ it('clears a deleted pick when only small replacements remain', () => {
// The dead-name guard has to keep working, or the picker shows a model
// the provider no longer has and clicking it opens an empty list.
useModelStore.setState({ activeModel: 'openai::deleted-model' })
useModelStore.getState().setModels([chat(HERMES), chat(QWEN)])
- expect(useModelStore.getState().activeModel).toBe(HERMES)
+ expect(useModelStore.getState().activeModel).toBeNull()
})
it('NEGATIVE CONTROL: an empty list does not invent a pick out of nothing', () => {
@@ -76,6 +76,11 @@ describe('an empty model list is not a reason to drop the pick', () => {
})
describe('the pick is written to disk in the first place', () => {
+ it('automatically chooses the first verified 7B model, not a small or opaque row', () => {
+ useModelStore.setState({ activeModel: null })
+ useModelStore.getState().setModels([chat(HERMES), chat('opaque'), chat('test-7B')])
+ expect(useModelStore.getState().activeModel).toBe('test-7B')
+ })
it('activeModel is part of what persist keeps', () => {
expect(storeSrc).toMatch(/partialize:.*activeModel: state\.activeModel/)
})
diff --git a/src/stores/modelStore.ts b/src/stores/modelStore.ts
index edae91cd..0091f331 100644
--- a/src/stores/modelStore.ts
+++ b/src/stores/modelStore.ts
@@ -1,6 +1,7 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import { safeJSONStorage } from '../lib/storage-quota'
+import { canAutoSelectChat } from '../lib/chat-model-minimum'
import type { AIModel, PullProgress, ModelCategory } from '../types/models'
import { unloadModel } from '../api/ollama'
import { unloadLmStudioModel } from '../api/lmstudio'
@@ -151,9 +152,8 @@ export const useModelStore = create<ModelState>()(
// model name persists in the picker after the underlying provider
// (e.g. Ollama) was uninstalled or the model was deleted — the
// dropdown then shows a dead name and clicking it opens an empty
- // list. Falls back to the first available model, mirroring the
- // first-launch behavior so a user is never stuck with no
- // selection while a model exists.
+ // list. Automatic replacement uses the first eligible chat model;
+ // if none has a known size of at least 7B, require an explicit pick.
// An empty list validates nothing. fetchModels writes its result
// here even when every provider failed, and dropping the pick on
// that answer is how a transient failure turned into a silently
@@ -170,11 +170,10 @@ export const useModelStore = create<ModelState>()(
const stillValid =
!!state.activeModel &&
(models.length === 0 || models.some((m) => m.name === state.activeModel))
- // Chat models only for the auto-select — ComfyUI image/video
- // checkpoints share this list and must never become the active CHAT
- // model (an unprefixed checkpoint name routes to Ollama and every
- // send fails with model-not-found).
- const firstChat = models.find((m) => m.type !== 'image' && m.type !== 'video')
+ // 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.
+ const firstChat = models.find(canAutoSelectChat)
return {
models,
inventoryLoaded: true,