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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(onboarding): Runde 2, Qwen 3.5 9B auf gemessene Zahlen und echte Verdrahtung
purple1380c94c05ce
diff --git a/src/components/onboarding/ModelsStep.tsx b/src/components/onboarding/ModelsStep.tsxindex add9348c..38455fc9 100644--- a/src/components/onboarding/ModelsStep.tsx+++ b/src/components/onboarding/ModelsStep.tsx@@ -30,7 +30,7 @@*/import { useState, useEffect } from 'react'import { Check, Download, ChevronRight } from 'lucide-react'-import { ONBOARDING_MODELS, recommendedOnboardingModelName } from '../../lib/constants'+import { ONBOARDING_MODELS, recommendedOnboardingModelName, strongestOnboardingModelName } from '../../lib/constants'import { useSettingsStore } from '../../stores/settingsStore'import { useProviderStore } from '../../stores/providerStore'import { useDownloadStore } from '../../stores/downloadStore'@@ -157,6 +157,13 @@ export function ModelsStep({ skin, scan, fleet, step, setStep, pulledModels, set}}+ // Built-in engine only: names that finish downloading in this run, so+ // the strongest of them (not whichever the loop below activates last)+ // can be made active once the whole batch is done. Ollama and LM Studio+ // pick their own active model elsewhere, this loop never calls+ // `setActiveModel` for them.+ const builtinPulledThisRun: string[] = []+for (const name of selectedModels) {if (pulledModels.includes(name)) continueconst model = ONBOARDING_MODELS.find(m => m.name === name)@@ -228,7 +235,7 @@ export function ModelsStep({ skin, scan, fleet, step, setStep, pulledModels, settry {const found = await activateBuiltinModel(builtinModelNameFromPath(model.filename))if (!found) setDownloadError(`Model downloaded, but the LU Engine did not find ${model.filename} in its model folder.`)- else setActiveModel(bundledPickerIdForFile(model.filename))+ else { setActiveModel(bundledPickerIdForFile(model.filename)); builtinPulledThisRun.push(name) }} catch (e) {setDownloadError(`Model downloaded, but the LU Engine failed to start: ${e instanceof Error ? e.message : String(e)}`)}@@ -249,6 +256,23 @@ export function ModelsStep({ skin, scan, fleet, step, setStep, pulledModels, set}}setPullingModel(null)+ // Two or more built-in models picked at once: the loop above activated+ // each in turn as its download finished, so whatever is active right+ // now is just the last one clicked. Re-activate the strongest of the+ // ones that actually finished, so the choice is "the most capable model+ // downloaded", not "whichever button order happened to be clicked in".+ // The file is already on disk from the loop above, so this is a re-scan,+ // not a second download.+ if (builtinPulledThisRun.length > 1) {+ const strongestName = strongestOnboardingModelName(ONBOARDING_MODELS, builtinPulledThisRun)+ const strongestModel = ONBOARDING_MODELS.find(m => m.name === strongestName)+ if (strongestModel?.filename) {+ try {+ const found = await activateBuiltinModel(builtinModelNameFromPath(strongestModel.filename))+ if (found) setActiveModel(bundledPickerIdForFile(strongestModel.filename))+ } catch { /* leave the last-activated model active; no worse than before this fix */ }+ }+ }// Tell the rest of the app the model list changed — Model Manager,// Chat picker, etc. listen for this and re-fetch.window.dispatchEvent(new CustomEvent('lu-models-refresh'))@@ -527,6 +551,17 @@ export function ModelsStep({ skin, scan, fleet, step, setStep, pulledModels, setRecommended</span>)}+ {/* The one place `OnboardingModel.agent` is read. Without+ this it was a display flag nothing displayed: set on+ the catalog entries this list is drawn from, but+ never rendered here, so the only agent hint reaching+ the user was whatever happened to be written into+ `description`. */}+ {model.agent && (+ <span className={`text-[0.5rem] px-1 py-0.5 rounded ${isDark ? 'bg-purple-500/15 text-purple-300' : 'bg-purple-100 text-purple-700'}`}>+ Agent-ready+ </span>+ )}</div><p className={`text-[0.6rem] mt-0.5 ${isDark ? 'text-gray-400' : 'text-gray-500'}`}>{model.description}</p>{systemVRAM !== null && systemVRAM < model.vramGB && (diff --git a/src/components/onboarding/__tests__/empfehlung-folgt-der-hardware.test.tsx b/src/components/onboarding/__tests__/empfehlung-folgt-der-hardware.test.tsxnew file mode 100644index 00000000..4f27bdea--- /dev/null+++ b/src/components/onboarding/__tests__/empfehlung-folgt-der-hardware.test.tsx@@ -0,0 +1,132 @@+/**+ * @vitest-environment jsdom+ *+ * Opus-Runde 2, Blocker 3 (review-onboard9b.md): die reine Funktion+ * `recommendedOnboardingModelName` war gut geprueft, aber kein Test bemerkte,+ * ob `ModelsStep.tsx` sie ueberhaupt benutzt. Die Gegenprobe im Bericht drehte+ * `{model.name === recommendedModelName && showRecommendedBadge && (` von Hand+ * auf die alte Form `{model.recommended && showRecommendedBadge && (` zurueck+ * und liess damit 16 von 16 Testdateien unveraendert gruen. Dieser Test+ * rendert den Schritt wirklich und liest, an welcher Kachel "Recommended"+ * steht — die alte Form wuerde ihn bei 12 GB VRAM falsch am 7B-Starter+ * bestehen lassen statt am 9B-Modell.+ *+ * Lauf: npx vitest run src/components/onboarding/__tests__/empfehlung-folgt-der-hardware.test.tsx+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { createElement } from 'react'+import { render, screen, cleanup, waitFor } from '@testing-library/react'++const getMaxVramGb = vi.fn(async () => 0)+const getSystemVRAM = vi.fn(async () => null)++vi.mock('../../../lib/hardware', () => ({ getMaxVramGb: () => getMaxVramGb() }))+vi.mock('../../../api/comfyui', () => ({ getSystemVRAM: () => getSystemVRAM() }))+vi.mock('../../../api/ollama', () => ({+ listModels: vi.fn(async () => []),+ pullModelTauri: vi.fn(),+ checkConnection: vi.fn(async () => false),+}))+vi.mock('../../../api/backend', () => ({+ backendCall: vi.fn(async () => ({})),+ isTauri: () => false,+ isMacOS: () => false,+ openExternal: vi.fn(),+ secretGet: vi.fn().mockRejectedValue(new Error('no keychain here')),+ secretSet: vi.fn(),+ secretDelete: vi.fn(),+}))+vi.mock('../../../api/discover', () => ({+ detectProviderModelPath: vi.fn(async () => ''),+ startModelDownloadToPath: vi.fn(),+ luEngineDownloadDir: vi.fn(async () => ''),+}))+vi.mock('../../../api/engine', () => ({ activateBuiltinModel: vi.fn() }))++const { useProviderStore } = await import('../../../stores/providerStore')+const { useModelStore } = await import('../../../stores/modelStore')+const { ModelsStep } = await import('../ModelsStep')+const { onboardingSkin } = await import('../onboarding-skin')++const LEERE_FLOTTE = {+ ollama: { phase: 'idle' }, lmstudio: { phase: 'idle' },+ comfyInstall: { phase: 'idle' }, pythonInstall: { phase: 'idle' },+ ollamaDo: () => {}, lmstudioDo: () => {}, comfyInstallDo: () => {}, pythonInstallDo: () => {},+ secondsOf: () => 0,+}+const LEERER_SCAN = {+ detectedBackends: [], detecting: false, selectedBackend: 'builtin',+ setSelectedBackend: () => {}, lmstudioOfflineDetected: false, lmstudioModelCount: 0,+ runDetection: async () => {}, stopDetection: () => {},+}++function zeichnen() {+ return render(createElement(ModelsStep, {+ skin: onboardingSkin(true),+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ scan: LEERER_SCAN as any,+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ fleet: LEERE_FLOTTE as any,+ step: 'models' as const,+ setStep: () => {},+ pulledModels: [],+ setPulledModels: () => {},+ }))+}++/** Die Kachel, in der ein Modellname steht (Karte samt Abzeichen). */+function kachelVon(label: string): HTMLElement {+ const knoten = screen.getByText(label)+ const button = knoten.closest('button')+ expect(button, `keine Kachel fuer "${label}" gefunden`).not.toBeNull()+ return button as HTMLElement+}++beforeEach(() => {+ useProviderStore.getState().setProviderConfig('ollama', { enabled: false, disabledByUser: true })+ useModelStore.setState({ activeModel: null })+})+afterEach(() => {+ cleanup()+ getMaxVramGb.mockReset()+ getSystemVRAM.mockReset()+ getMaxVramGb.mockImplementation(async () => 0)+ getSystemVRAM.mockImplementation(async () => null)+})++describe('das Abzeichen folgt der Hardware, nicht dem statischen Feld', () => {+ it('12 GB (eine RTX 3060, die Hardware aus dem Auftrag): das Abzeichen sitzt auf Qwen 3.5 9B', async () => {+ getMaxVramGb.mockImplementation(async () => 12)+ zeichnen()+ await waitFor(() => {+ expect(kachelVon('Qwen 3.5 9B').textContent).toContain('Recommended')+ })+ expect(kachelVon('Qwen 2.5 7B (Starter)').textContent).not.toContain('Recommended')+ // Genau eins, nicht zwei: keine zweite Kachel wirbt gleichzeitig.+ expect(screen.getAllByText('Recommended', { exact: true })).toHaveLength(1)+ })++ it('0 GB / unbekannte Hardware: das Abzeichen bleibt beim 7B-Starter', async () => {+ getMaxVramGb.mockImplementation(async () => 0)+ getSystemVRAM.mockImplementation(async () => null)+ zeichnen()+ await waitFor(() => {+ expect(kachelVon('Qwen 2.5 7B (Starter)').textContent).toContain('Recommended')+ })+ expect(kachelVon('Qwen 3.5 9B').textContent).not.toContain('Recommended')+ expect(screen.getAllByText('Recommended', { exact: true })).toHaveLength(1)+ })++ // Negativkontrolle mit Zahlen: 6 GB traegt den 7B-Starter (Bedarf 6), aber+ // nicht das gemessene 9B (Bedarf 6,1). Ohne diese Zeile koennte eine+ // Verdrahtung, die ab v>0 immer 9B zeigt, den ersten Fall oben ebenfalls+ // bestehen.+ it('NEGATIVKONTROLLE: 6 GB traegt den 7B-Starter, aber nicht das gemessene 9B', async () => {+ getMaxVramGb.mockImplementation(async () => 6)+ zeichnen()+ await waitFor(() => {+ expect(kachelVon('Qwen 2.5 7B (Starter)').textContent).toContain('Recommended')+ })+ expect(kachelVon('Qwen 3.5 9B').textContent).not.toContain('Recommended')+ })+})diff --git a/src/components/onboarding/__tests__/staerkeres-modell-aktiv-bei-zwei-wahlen.test.tsx b/src/components/onboarding/__tests__/staerkeres-modell-aktiv-bei-zwei-wahlen.test.tsxnew file mode 100644index 00000000..21bfb926--- /dev/null+++ b/src/components/onboarding/__tests__/staerkeres-modell-aktiv-bei-zwei-wahlen.test.tsx@@ -0,0 +1,128 @@+/**+ * @vitest-environment jsdom+ *+ * Opus-Runde 2, Auflage (review-onboard9b.md): mit zwei gewaehlten+ * Onboarding-Modellen lief `handleDownloadSelected` die Auswahl in+ * Klickreihenfolge durch und rief `activateBuiltinModel` fuer jeden Eintrag,+ * also blieb das ZULETZT geklickte aktiv, nicht das staerkere. Mit einem+ * einzigen Eintrag (vor diesem Auftrag) konnte das nie auffallen.+ *+ * Dieser Test klickt bewusst zuerst das staerkere Modell (Qwen 3.5 9B), dann+ * das schwaechere (Qwen 2.5 7B), damit die alte Reihenfolge-Regel das+ * schwaechere aktiv liesse. Nach dem Lauf muss trotzdem das staerkere aktiv+ * sein.+ *+ * Lauf: npx vitest run src/components/onboarding/__tests__/staerkeres-modell-aktiv-bei-zwei-wahlen.test.tsx+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { createElement } from 'react'+import { render, screen, cleanup, act, waitFor } from '@testing-library/react'+import { bundledPickerIdForFile } from '../../../lib/bundled-download-activation'+import { builtinModelNameFromPath } from '../../../lib/builtin-model-identity'+import { ONBOARDING_MODELS } from '../../../lib/constants'++const activateBuiltinModel = vi.fn(async (_name: string) => true)+const startModelDownloadToPath = vi.fn(async (_url: string, _dir: string, _filename: string, _bytes?: number, _sha?: string) => {})+const awaitDownloadComplete = vi.fn(async (_filename: string) => {})++vi.mock('../../../lib/hardware', () => ({ getMaxVramGb: vi.fn(async () => 0) }))+vi.mock('../../../api/comfyui', () => ({ getSystemVRAM: vi.fn(async () => null) }))+vi.mock('../../../api/ollama', () => ({+ listModels: vi.fn(async () => []),+ pullModelTauri: vi.fn(),+ checkConnection: vi.fn(async () => false),+}))+vi.mock('../../../api/backend', () => ({+ backendCall: vi.fn(async () => ({})),+ isTauri: () => false,+ isMacOS: () => false,+ openExternal: vi.fn(),+ secretGet: vi.fn().mockRejectedValue(new Error('no keychain here')),+ secretSet: vi.fn(),+ secretDelete: vi.fn(),+}))+vi.mock('../../../api/discover', () => ({+ detectProviderModelPath: vi.fn(async () => ''),+ startModelDownloadToPath: (url: string, dir: string, filename: string, bytes?: number, sha?: string) =>+ startModelDownloadToPath(url, dir, filename, bytes, sha),+ luEngineDownloadDir: vi.fn(async () => '/fake/models'),+}))+vi.mock('../../../api/engine', () => ({+ activateBuiltinModel: (name: string) => activateBuiltinModel(name),+}))+vi.mock('../wait-for-download', () => ({+ awaitDownloadComplete: (filename: string) => awaitDownloadComplete(filename),+}))++const { useProviderStore } = await import('../../../stores/providerStore')+const { useModelStore } = await import('../../../stores/modelStore')+const { ModelsStep } = await import('../ModelsStep')+const { onboardingSkin } = await import('../onboarding-skin')++const LEERE_FLOTTE = {+ ollama: { phase: 'idle' }, lmstudio: { phase: 'idle' },+ comfyInstall: { phase: 'idle' }, pythonInstall: { phase: 'idle' },+ ollamaDo: () => {}, lmstudioDo: () => {}, comfyInstallDo: () => {}, pythonInstallDo: () => {},+ secondsOf: () => 0,+}+const LEERER_SCAN = {+ detectedBackends: [], detecting: false, selectedBackend: 'builtin',+ setSelectedBackend: () => {}, lmstudioOfflineDetected: false, lmstudioModelCount: 0,+ runDetection: async () => {}, stopDetection: () => {},+}++beforeEach(() => {+ useProviderStore.getState().setProviderConfig('ollama', { enabled: false, disabledByUser: true })+ useModelStore.setState({ activeModel: null })+ activateBuiltinModel.mockClear()+})+afterEach(cleanup)++describe('zwei gewaehlte Modelle: das staerkere gewinnt, nicht das zuletzt geklickte', () => {+ it('9B zuerst geklickt, 7B danach: am Ende ist 9B aktiv', async () => {+ await act(async () => {+ render(createElement(ModelsStep, {+ skin: onboardingSkin(true),+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ scan: LEERER_SCAN as any,+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ fleet: LEERE_FLOTTE as any,+ step: 'models' as const,+ setStep: () => {},+ pulledModels: [],+ setPulledModels: () => {},+ }))+ })++ // Bewusste Reihenfolge: das staerkere zuerst, das schwaechere zuletzt.+ // Die alte Regel (letzter Klick gewinnt) wuerde damit den 7B-Starter+ // aktiv lassen.+ await act(async () => {+ screen.getByText('Qwen 3.5 9B').closest('button')!.click()+ })+ await act(async () => {+ screen.getByText('Qwen 2.5 7B (Starter)').closest('button')!.click()+ })++ const installBtn = await screen.findByRole('button', { name: /Install 2 models/i })+ await act(async () => {+ installBtn.click()+ })++ await waitFor(() => {+ expect(activateBuiltinModel).toHaveBeenCalledTimes(3)+ })++ const nineB = ONBOARDING_MODELS.find(m => m.name === 'qwen3.5-9b')!+ const sevenB = ONBOARDING_MODELS.find(m => m.name === 'qwen2.5-7b')!++ // Beide wurden waehrend der Schleife aktiviert (in Klickreihenfolge: 9B,+ // dann 7B) ...+ expect(activateBuiltinModel.mock.calls[0][0]).toBe(builtinModelNameFromPath(nineB.filename))+ expect(activateBuiltinModel.mock.calls[1][0]).toBe(builtinModelNameFromPath(sevenB.filename))+ // ... aber der dritte, abschliessende Aufruf holt das staerkere zurueck.+ expect(activateBuiltinModel.mock.calls[2][0]).toBe(builtinModelNameFromPath(nineB.filename))++ expect(useModelStore.getState().activeModel).toBe(bundledPickerIdForFile(nineB.filename))+ })+})diff --git a/src/lib/__tests__/onboarding-chat-minimum.test.ts b/src/lib/__tests__/onboarding-chat-minimum.test.tsindex d05d404d..ade5cbd4 100644--- a/src/lib/__tests__/onboarding-chat-minimum.test.ts+++ b/src/lib/__tests__/onboarding-chat-minimum.test.ts@@ -17,9 +17,14 @@ it('uses an existing catalog model meeting the 7B minimum with exact download in// Second onboarding pick, added so the wizard offers an agent-capable model// above the 9B floor getRecommendedAgentModels() names as where tool calls-// start holding together. One source of truth: repo and filename come from-// the Discover catalog entry (api/discover.ts, getMainstreamTextModels,-// name 'Qwen 3.5 9B'), not typed twice.+// start holding together. Repo and filename come from the Discover catalog+// entry (api/discover.ts, getMainstreamTextModels, name 'Qwen 3.5 9B'), not+// typed twice, so the two cannot drift apart.+//+// sizeGB is NOT pinned against the catalog's number here: the catalog writes+// a rounded display figure (5), this entry needs the byte-exact one for+// download integrity (see the next test), the same split the 7B entry+// already has between its catalog row and its own `expectedBytes`.it('the second onboarding pick matches the Discover catalog entry it is drawn from', () => {const nineB = ONBOARDING_MODELS.find(m => m.name === 'qwen3.5-9b')expect(nineB).toBeDefined()@@ -27,13 +32,41 @@ it('the second onboarding pick matches the Discover catalog entry it is drawn frexpect(catalog).toBeDefined()expect(nineB!.downloadUrl).toBe(catalog!.downloadUrl)expect(nineB!.filename).toBe(catalog!.filename)- expect(nineB!.sizeGB).toBe(catalog!.sizeGB)expect(catalog!.tags).toContain('9B')expect(catalog!.agent).toBe(true)+ // This IS read now: ModelsStep.tsx renders an "Agent-ready" tag on any+ // model with `agent: true` (the Discover page's ModelTiles.tsx filters on+ // the same field for its catalog rows). Not a dead flag on either side.expect(nineB!.agent).toBe(true)- // Not the badge: the badge follows hardware, this field is the display flag- // the Discover page filters on (ModelTiles.tsx).- expect(nineB!.vramGB).toBe(8)+})++// Byte-exact download integrity, measured on lu-box (see+// lu-301/e2e/box-modelle/MODELL-UND-SKRIPT.md) and cross-checked live+// against the HuggingFace LFS metadata for this repo+// (api/models/unsloth/Qwen3.5-9B-GGUF/tree/main) on 2026-09-20: both name+// 5680522464 bytes and the same SHA-256 for Qwen3.5-9B-Q4_K_M.gguf. Mirrors+// the check the 7B starter already has above, so the built-in engine path+// can verify this download the same way it verifies that one+// (ModelsStep.tsx passes `expectedBytes`/`sha256` through to+// `startModelDownloadToPath`).+it('the 9B download is pinned to the byte-exact size and SHA-256 measured on lu-box', () => {+ const nineB = ONBOARDING_MODELS.find(m => m.name === 'qwen3.5-9b')!+ expect(nineB.expectedBytes).toBe(5680522464)+ expect(nineB.sha256).toBe('03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8')+ expect(Math.round(nineB.sizeGB * 1_073_741_824)).toBe(nineB.expectedBytes)+})++// vramGB is measured, not guessed (lu-301/STAND-BAU.md:258: RTX 3060, all 32+// layers offloaded, "6,1 GB VRAM"; corroborated by MODELL-UND-SKRIPT.md's+// nvidia-smi reading). The number is not re-typed here as a second copy to+// compare against, that would just check the field equals itself under a+// different name. Instead this checks the thing that could actually drift:+// that the human-readable `vram` and `description` text are read FROM+// `vramGB`, so a future edit to one cannot silently leave the other behind.+it('vram and description text are derived from vramGB, not a separately hand-typed number', () => {+ const nineB = ONBOARDING_MODELS.find(m => m.name === 'qwen3.5-9b')!+ expect(nineB.vram).toContain(String(nineB.vramGB))+ expect(nineB.description).toContain(String(nineB.vramGB))})it('both onboarding entries are present and distinct', () => {diff --git a/src/lib/__tests__/onboarding-hardware-recommendation.test.ts b/src/lib/__tests__/onboarding-hardware-recommendation.test.tsindex 267b475a..6754bbfc 100644--- a/src/lib/__tests__/onboarding-hardware-recommendation.test.ts+++ b/src/lib/__tests__/onboarding-hardware-recommendation.test.ts@@ -7,14 +7,20 @@* fit"-Warnung treibt. Keine neue Schwelle, nur derselbe Vergleich an einer* zweiten Stelle gelesen.*+ * 9B braucht laut Messung (lu-301/STAND-BAU.md:258, RTX 3060, 32/32+ * Schichten auf GPU) 6,1 GB, nicht die zuvor erfundenen 8. Opus-Runde 1 hat+ * das zurueckgewiesen (review-onboard9b.md, Blocker 1). Die Zahlen unten+ * sind entsprechend nachgezogen.+ ** Lauf: npx vitest run src/lib/__tests__/onboarding-hardware-recommendation.test.ts*/import { describe, it, expect } from 'vitest'-import { ONBOARDING_MODELS, recommendedOnboardingModelName } from '../constants'+import { ONBOARDING_MODELS, recommendedOnboardingModelName, strongestOnboardingModelName } from '../constants'describe('recommendedOnboardingModelName', () => {const SIEBEN_B = 'qwen2.5-7b'const NEUN_B = 'qwen3.5-9b'+ const NEUN_B_VRAM = ONBOARDING_MODELS.find(m => m.name === NEUN_B)!.vramGBit('unbekannte Hardware (null) laesst den statisch markierten 7B-Starter stehen', () => {expect(recommendedOnboardingModelName(ONBOARDING_MODELS, null)).toBe(SIEBEN_B)@@ -24,16 +30,16 @@ describe('recommendedOnboardingModelName', () => {expect(recommendedOnboardingModelName(ONBOARDING_MODELS, 12)).toBe(NEUN_B)})- it('genau die 8 GB, die 9B selbst verlangt, empfehlen bereits 9B', () => {- expect(recommendedOnboardingModelName(ONBOARDING_MODELS, 8)).toBe(NEUN_B)+ it('genau die gemessenen 6,1 GB, die 9B selbst verlangt, empfehlen bereits 9B', () => {+ expect(recommendedOnboardingModelName(ONBOARDING_MODELS, NEUN_B_VRAM)).toBe(NEUN_B)})- // Negativkontrolle mit Zahlen: 7 GB traegt den 7B-Starter (Bedarf 6),- // aber nicht 9B (Bedarf 8). Ohne diese Zeile koennte eine Funktion, die- // immer NEUN_B zurueckgibt, die 12-GB- und die 8-GB-Zusicherung auch- // bestehen.- it('7 GB traegt den 7B-Starter, aber nicht 9B, und empfiehlt darum 7B', () => {- expect(recommendedOnboardingModelName(ONBOARDING_MODELS, 7)).toBe(SIEBEN_B)+ // Negativkontrolle mit Zahlen: 6 GB traegt den 7B-Starter (Bedarf 6), aber+ // nicht 9B (Bedarf 6,1, knapp darueber, aber darueber). Ohne diese Zeile+ // koennte eine Funktion, die immer NEUN_B zurueckgibt, die 12-GB- und die+ // 6,1-GB-Zusicherung auch bestehen.+ it('6 GB traegt den 7B-Starter, aber nicht das gemessene 9B, und empfiehlt darum 7B', () => {+ expect(recommendedOnboardingModelName(ONBOARDING_MODELS, 6)).toBe(SIEBEN_B)})it('0 GB (Sonde fehlgeschlagen, aber nicht null) traegt keinen der beiden und faellt auf 7B zurueck', () => {@@ -49,3 +55,28 @@ describe('recommendedOnboardingModelName', () => {expect(recommendedOnboardingModelName(ohneEmpfehlung, 0)).toBeUndefined()})})++describe('strongestOnboardingModelName', () => {+ const SIEBEN_B = 'qwen2.5-7b'+ const NEUN_B = 'qwen3.5-9b'++ it('von zweien gewinnt das mit dem hoeheren VRAM-Bedarf, unabhaengig von der Reihenfolge', () => {+ expect(strongestOnboardingModelName(ONBOARDING_MODELS, [NEUN_B, SIEBEN_B])).toBe(NEUN_B)+ expect(strongestOnboardingModelName(ONBOARDING_MODELS, [SIEBEN_B, NEUN_B])).toBe(NEUN_B)+ })++ it('mit nur einem Namen liefert es genau den', () => {+ expect(strongestOnboardingModelName(ONBOARDING_MODELS, [SIEBEN_B])).toBe(SIEBEN_B)+ })++ // Negativkontrolle: eine leere Liste ist nicht dasselbe wie "das erste+ // gewinnt automatisch", es gibt schlicht keinen Gewinner.+ it('eine leere Liste liefert undefined, nicht irgendeinen Namen', () => {+ expect(strongestOnboardingModelName(ONBOARDING_MODELS, [])).toBeUndefined()+ })++ it('ein unbekannter Name wird ignoriert, kein Absturz', () => {+ expect(strongestOnboardingModelName(ONBOARDING_MODELS, ['gibt-es-nicht'])).toBeUndefined()+ expect(strongestOnboardingModelName(ONBOARDING_MODELS, ['gibt-es-nicht', SIEBEN_B])).toBe(SIEBEN_B)+ })+})diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex e8b28ecd..f0542408 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -377,6 +377,11 @@ export const ONBOARDING_EMBED_MODEL = {sizeGB: 0.084,}+// See the comment on the 'qwen3.5-9b' entry below for where this number+// comes from. Kept as a named constant so it appears exactly once and the+// entry's `vram` / `description` text read it back instead of repeating it.+const NINE_B_VRAM_GB = 6.1+export const ONBOARDING_MODELS: OnboardingModel[] = [// One chat starter meeting the 7B minimum. Download integrity comes from// the published LFS metadata, not the rounded display size.@@ -388,12 +393,25 @@ export const ONBOARDING_MODELS: OnboardingModel[] = [// on the second tool call." The flag here is the same curation call, not// the wire-format check, so it stays false at 7B.{ name: 'qwen2.5-7b', label: 'Qwen 2.5 7B (Starter)', description: '7B chat model, Q4_K_M. Allow additional memory for context and the operating system. Download time and response speed depend on your hardware.', size: '4.4 GiB', vram: 'about 6 GB for GPU offload, context-dependent', vramGB: 6, recommended: true, agent: false, downloadUrl: HF_OB('bartowski/Qwen2.5-7B-Instruct-GGUF', 'Qwen2.5-7B-Instruct-Q4_K_M.gguf'), filename: 'Qwen2.5-7B-Instruct-Q4_K_M.gguf', sizeGB: 4683074240 / 1_073_741_824, expectedBytes: 4683074240, sha256: '65b8fcd92af6b4fefa935c625d1ac27ea29dcb6ee14589c55a8f115ceaaa1423' },- // Second onboarding pick, above the 9B floor the same verdict names as the- // point where tool calls start holding together. Same repo/filename as the- // Discover catalog entry (api/discover.ts, getMainstreamTextModels, name- // 'Qwen 3.5 9B'); src/lib/__tests__/onboarding-chat-minimum.test.ts pins- // the two together so they cannot drift apart.- { name: 'qwen3.5-9b', label: 'Qwen 3.5 9B', description: 'Better for agents and tools, needs about 8 GB VRAM.', size: '~5 GB', vram: 'about 8 GB for GPU offload, context-dependent', vramGB: 8, agent: true, downloadUrl: HF_OB('unsloth/Qwen3.5-9B-GGUF', 'Qwen3.5-9B-Q4_K_M.gguf'), filename: 'Qwen3.5-9B-Q4_K_M.gguf', sizeGB: 5 },+ // Second onboarding pick, above the 9B floor getRecommendedAgentModels()+ // names as where tool calls start holding together. Same repo/filename as+ // the Discover catalog entry (api/discover.ts, getMainstreamTextModels,+ // name 'Qwen 3.5 9B'); src/lib/__tests__/onboarding-chat-minimum.test.ts+ // pins the two together so they cannot drift apart.+ //+ // NINE_B_VRAM_GB is measured, not guessed: lu-box, RTX 3060 12 GB, all 32+ // layers offloaded to the GPU (lu-301/STAND-BAU.md:258, "32 Schichten auf+ // GPU, 6,1 GB VRAM"; corroborated by lu-301/e2e/box-modelle/MODELL-UND-+ // SKRIPT.md, nvidia-smi read 6149 MiB of 12288 MiB right after load). The+ // number lives here once; the `vram` and `description` text below read it+ // back rather than repeating a hand-typed copy.+ //+ // expectedBytes/sha256 come from the same box run: HuggingFace's own LFS+ // metadata (api/models/unsloth/Qwen3.5-9B-GGUF/tree/main, lfs.size /+ // lfs.oid for Qwen3.5-9B-Q4_K_M.gguf) and the file Get-FileHash'd on the+ // box after download agree on both numbers (re-checked against the live+ // HF API on 2026-09-20, unchanged).+ { name: 'qwen3.5-9b', label: 'Qwen 3.5 9B', description: `Better for agents and tools. Needs about ${NINE_B_VRAM_GB} GB VRAM, measured on an RTX 3060 with full GPU offload.`, size: '5.3 GiB', vram: `about ${NINE_B_VRAM_GB} GB for GPU offload, context-dependent`, vramGB: NINE_B_VRAM_GB, agent: true, downloadUrl: HF_OB('unsloth/Qwen3.5-9B-GGUF', 'Qwen3.5-9B-Q4_K_M.gguf'), filename: 'Qwen3.5-9B-Q4_K_M.gguf', sizeGB: 5680522464 / 1_073_741_824, expectedBytes: 5680522464, sha256: '03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8' },]/**@@ -421,3 +439,22 @@ export function recommendedOnboardingModelName(}return models.find((m) => m.recommended)?.name}++/**+ * With two onboarding models to choose from, picking both and letting the+ * built-in engine loop finish on whichever the user happened to click last+ * would make the winner an accident of click order, not a choice. Given the+ * names that actually finished downloading together, this names the one+ * that should end up active: the one asking for the most VRAM, i.e. the+ * strongest model the machine was told to fetch. Same `vramGB` comparison as+ * `recommendedOnboardingModelName`, just over the downloaded set instead of+ * the whole catalog.+ */+export function strongestOnboardingModelName(+ models: OnboardingModel[],+ names: string[],+): string | undefined {+ const chosen = models.filter((m) => names.includes(m.name))+ if (chosen.length === 0) return undefined+ return chosen.reduce((best, m) => (m.vramGB > best.vramGB ? m : best)).name+}