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(chat): Cloud mode picks no chat model for the user

purplef3ada1adb3de
diff --git a/e2e/cloud-chat-waits-for-a-model.spec.ts b/e2e/cloud-chat-waits-for-a-model.spec.ts
new file mode 100644
index 00000000..51b07028
--- /dev/null
+++ b/e2e/cloud-chat-waits-for-a-model.spec.ts
@@ -0,0 +1,101 @@
+import { test, expect, type Page } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+
+/**
+ * In Cloud mode the app never picks a chat model by itself (David, 2026-10-05).
+ *
+ * Measured that day: a new account chatted on the head of the hosted
+ * catalogue, Llama 3.1 8B Turbo, without ever having picked it. That model
+ * declines adult fiction, and a refusal in the history is then copied by
+ * better models in the same chat.
+ *
+ * The catalogue of the mock is headed by exactly that model. After the switch
+ * to Cloud the picker has to read "Choose a model", a send has to keep text
+ * and attachment and open the picker, and the message has to go out on the
+ * model the user then names, and on no other.
+ *
+ * The local side of the mock holds a model the automatic pick would take
+ * (7B), so this also shows that the local pick does not leak into Cloud.
+ *
+ * Run: CI=1 LU_E2E_PORT=5311 npx playwright test e2e/cloud-chat-waits-for-a-model.spec.ts
+ */
+
+const TEXT = 'a message that waits for its model'
+const NOTE = { name: 'notes.txt', mimeType: 'text/plain', buffer: Buffer.from('the attachment stays too') }
+const HINT = 'Pick a model to send your message. Your text and attachments are kept.'
+const REPLY = 'Cloud answer on the named model.'
+const CORS = { 'access-control-allow-origin': '*', 'access-control-allow-headers': 'authorization, content-type' }
+
+const picker = (page: Page) => page.getByRole('button', { name: 'Select chat model', exact: true })
+const menu = (page: Page) => page.getByTestId('model-picker-menu')
+
+test('Cloud: no model is picked for the user, and the message goes out on the one he names', async ({ page }) => {
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME })
+ await seedOnboardingDone(page)
+ await routeCloud(page, { license: 'active', access: true, mediaLive: true })
+ const sentModels: string[] = []
+ await page.route('**/api/inference/v1/chat/completions', (route) => {
+ if (route.request().method() === 'OPTIONS') return route.fulfill({ status: 204, headers: CORS })
+ sentModels.push((route.request().postDataJSON() as { model: string }).model)
+ return route.fulfill({
+ status: 200, headers: CORS, contentType: 'text/event-stream',
+ body: `data: ${JSON.stringify({ choices: [{ index: 0, delta: { content: REPLY } }] })}\n\ndata: [DONE]\n\n`,
+ })
+ })
+ await page.goto('/')
+ await expect(cloudSwitch(page)).toBeVisible()
+ // Before the switch the local automatic pick is in place, as it always was.
+ await expect(picker(page)).toContainText('qwen2.5-7b')
+ await signInViaGate(page)
+ await expect(cloudSwitch(page)).toBeChecked()
+
+ // The catalogue is there, and nothing of it is picked.
+ await expect(picker(page)).toContainText('Choose a model')
+ await expect(page.getByText('Choose a model below.', { exact: true })).toBeVisible()
+ await picker(page).click()
+ await expect(menu(page).getByRole('button', { name: /Llama 3.1 8B Turbo/ })).toBeVisible()
+ // The menu says what the pick is for, in the words of the web app. That is
+ // the only place: nothing of it stands in or above the prompt field.
+ await expect(page.getByTestId('picker-choose-a-model')).toHaveText('Choose a model to send your message.')
+ await expect(page.getByText('Choose a model to send your message.')).toHaveCount(1)
+ await expect(menu(page).getByText(HINT)).toHaveCount(0)
+ await page.keyboard.press('Escape')
+ await expect(menu(page)).toHaveCount(0)
+ await expect(picker(page)).toContainText('Choose a model')
+
+ // A send keeps everything and opens the picker with the reason.
+ const box = page.locator('textarea').first()
+ await box.fill(TEXT)
+ await page.locator('input[type="file"]').first().setInputFiles(NOTE)
+ await expect(page.getByText('notes.txt')).toBeVisible()
+ await page.getByRole('button', { name: 'Send message' }).click()
+ await expect(box).toHaveValue(TEXT)
+ await expect(page.getByText('notes.txt')).toBeVisible()
+ await expect(menu(page)).toBeVisible()
+ await expect(menu(page).getByText(HINT)).toBeVisible()
+ // The reason stands in the picker and nowhere else on the page.
+ await expect(page.getByText(HINT)).toHaveCount(1)
+ expect(sentModels).toEqual([])
+
+ // Naming a model and sending again delivers the kept message on that model.
+ await menu(page).getByRole('button', { name: /Qwen3 30B A3B/ }).click()
+ await expect(picker(page)).toContainText('Qwen3 30B A3B')
+ await page.getByRole('button', { name: 'Send message' }).click()
+ await expect(box).toHaveValue('')
+ await expect(page.getByRole('main').locator('p').filter({ hasText: REPLY })).toBeVisible({ timeout: 15_000 })
+ expect(sentModels).toEqual(['Qwen/Qwen3-30B-A3B'])
+
+ // The pick is the user's now: a trip to Local and back returns to it, and
+ // each side keeps its own. (A reload is not asked here, the mock harness
+ // comes back signed out and in Local mode.)
+ await cloudSwitch(page).click()
+ await expect(cloudSwitch(page)).not.toBeChecked()
+ await expect(picker(page)).toContainText('qwen2.5-7b')
+ // Into Cloud the switch asks twice: the first click arms it.
+ await cloudSwitch(page).click()
+ await expect(cloudSwitch(page)).toHaveAttribute('data-armed', 'true')
+ await cloudSwitch(page).click()
+ await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
+ await expect(picker(page)).toContainText('Qwen3 30B A3B')
+})
diff --git a/e2e/cloud-document-chat.spec.ts b/e2e/cloud-document-chat.spec.ts
index 02cd1b0d..3091e0b8 100644
--- a/e2e/cloud-document-chat.spec.ts
+++ b/e2e/cloud-document-chat.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+import { pickChatModel } from './support/ui'
/**
* A9 in the shipped UI: the Docs button exists in Cloud mode.
@@ -49,8 +50,10 @@ async function silenceReleaseNotes(page: Page) {
}
}
-/** The composer only exists inside a conversation. */
-async function openChat(page: Page) {
+/** The Docs panel belongs to a conversation, and in Cloud a conversation
+ * needs a model the user named: the app picks none by itself. */
+async function openChat(page: Page, cloudModel?: RegExp) {
+ if (cloudModel) await pickChatModel(page, cloudModel)
await page.getByRole('button', { name: /New Chat/i }).first().click()
await expect(page.getByTestId('composer-send-slot')).toBeVisible({ timeout: 20_000 })
}
@@ -59,7 +62,7 @@ const docsButton = (page: Page) => page.getByTestId('docs-toggle')
test('cloud chat offers Docs, and the panel says where the text goes', async ({ page }) => {
await bootIntoCloud(page)
- await openChat(page)
+ await openChat(page, /Qwen3 30B A3B/)
// The report, answered: the button is on the composer row in Cloud mode.
await expect(docsButton(page)).toBeVisible({ timeout: 20_000 })
diff --git a/e2e/cloud-onboarding.spec.ts b/e2e/cloud-onboarding.spec.ts
index 7c66298c..46a55188 100644
--- a/e2e/cloud-onboarding.spec.ts
+++ b/e2e/cloud-onboarding.spec.ts
@@ -40,10 +40,16 @@ test('Max account: switch → login → cloud mode with the hosted catalog', asy
await expect(page.getByRole('button', { name: /^Models$/ })).toBeHidden()
await expect(page.getByRole('button', { name: /^Benchmark$/ })).toBeHidden()
- // The chat picker lists the hosted catalog (and only it).
+ // The chat picker lists the hosted catalog (and only it), and none of it
+ // is picked for the user: since 3.0.5 he names the model himself.
await openNewChat(page)
- const picker = page.getByText(/Llama 3\.1 8B Turbo/i).first()
- await expect(picker).toBeVisible({ timeout: 20_000 })
+ const picker = page.getByRole('button', { name: 'Select chat model', exact: true })
+ await expect(picker).toContainText('Choose a model', { timeout: 20_000 })
+ await picker.click()
+ const menu = page.getByTestId('model-picker-menu')
+ await expect(menu.getByRole('button', { name: /Llama 3\.1 8B Turbo/i })).toBeVisible({ timeout: 20_000 })
+ await expect(menu.getByText(DEFAULT_MODEL_NAME)).toHaveCount(0)
+ await page.keyboard.press('Escape')
// Flipping back to Local always works and restores the local tabs.
await cloudSwitch(page).click()
diff --git a/e2e/flash-chat-billing.spec.ts b/e2e/flash-chat-billing.spec.ts
index c2310244..36b3d689 100644
--- a/e2e/flash-chat-billing.spec.ts
+++ b/e2e/flash-chat-billing.spec.ts
@@ -34,7 +34,8 @@ test('flash metadata and paid fallback reach the actual desktop composer', async
await expect(cloudSwitch(page)).toBeVisible()
await signInViaGate(page)
await expect(cloudSwitch(page)).toBeChecked()
- await page.getByRole('button', { name: /New Chat/i }).first().click()
+ // The model first, then the chat: in Cloud the app picks no model by
+ // itself (3.0.5), and "New Chat" without one stays on the landing page.
await page.getByRole('button', { name: 'Select chat model', exact: true }).click()
const row = page.getByRole('button', { name: /Llama 3.1 8B Turbo/ })
// Der Aufdruck der Marke ist zweimal gewandert: "Flash", dann "No credits",
@@ -48,6 +49,7 @@ test('flash metadata and paid fallback reach the actual desktop composer', async
await expect(marke).toBeVisible()
await expect(marke).toHaveAttribute('title', 'No credits on your plan, up to 50,000 tokens per day.')
await row.click()
+ await page.getByRole('button', { name: /New Chat/i }).first().click()
// Runde 3 (Abnahme 19.09.2026, Blocker A2): kein Dauerband mehr ueber der
// Eingabe. Der Hinweis ist ein Etikett neben dem Agent-Schalter, das ein
diff --git a/e2e/flash-notice-real-geometry.spec.ts b/e2e/flash-notice-real-geometry.spec.ts
index 3f1af45f..cf4f08e2 100644
--- a/e2e/flash-notice-real-geometry.spec.ts
+++ b/e2e/flash-notice-real-geometry.spec.ts
@@ -67,9 +67,11 @@ async function boot(page: Page, width: number, height: number): Promise<void> {
await expect(cloudSwitch(page)).toBeVisible()
await signInViaGate(page)
await expect(cloudSwitch(page)).toBeChecked()
- await page.getByRole('button', { name: /New Chat/i }).first().click()
+ // The model first, then the chat: in Cloud the app picks no model by
+ // itself (3.0.5), and "New Chat" without one stays on the landing page.
await page.getByRole('button', { name: 'Select chat model', exact: true }).click()
await page.getByRole('button', { name: /Llama 3.1 8B Turbo/ }).click()
+ await page.getByRole('button', { name: /New Chat/i }).first().click()
if (!REACHABLE_AT_TARGET_WIDTH) await page.setViewportSize({ width, height })
}
diff --git a/e2e/model-minimum-selection.spec.ts b/e2e/model-minimum-selection.spec.ts
index 76d7c49d..a1617abf 100644
--- a/e2e/model-minimum-selection.spec.ts
+++ b/e2e/model-minimum-selection.spec.ts
@@ -8,7 +8,7 @@ test('small installed model waits for a choice and preserves that explicit choic
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 expect(picker).toContainText('Choose a model')
await picker.click()
await page.getByRole('button').filter({ hasText: 'Hermes' }).click()
await expect(picker).toContainText('Hermes')
diff --git a/e2e/send-without-a-model-keeps-the-message.spec.ts b/e2e/send-without-a-model-keeps-the-message.spec.ts
index 2b1f87ff..28aa07cd 100644
--- a/e2e/send-without-a-model-keeps-the-message.spec.ts
+++ b/e2e/send-without-a-model-keeps-the-message.spec.ts
@@ -6,7 +6,7 @@ import { seedOnboardingDone } from './support/cloud-mock'
* Sending without a chat model must not lose the message.
*
* Found in the real Windows build of 3.0.5: with no chat model picked (the
- * picker reads "Select Model") the Send button was live, and a click with
+ * picker reads "Choose a model") the Send button was live, and a click with
* text, with or without attachments, emptied the field and the chips. No
* conversation appeared and nothing was said: the message was gone.
*
@@ -36,7 +36,7 @@ const LANDING = 'Choose a model below. Automatic picks require a known size of a
for (const how of ['the Send button', 'Enter'] as const) {
test(`Chat, ${how}: text and attachment stay, and the model picker opens with the reason`, async ({ page }) => {
await boot(page)
- await expect(picker(page)).toContainText('Select Model')
+ await expect(picker(page)).toContainText('Choose a model')
const box = page.locator('textarea').first()
await box.fill(TEXT)
await page.locator('input[type="file"]').first().setInputFiles(NOTE)
@@ -85,7 +85,7 @@ test('Chat: closing the picker without a pick leaves a mark on the model button,
test('Code: the instruction stays and the model picker opens with the reason', async ({ page }) => {
await boot(page)
await page.getByRole('button', { name: 'Code', exact: true }).click()
- await expect(picker(page)).toContainText('Select Model')
+ await expect(picker(page)).toContainText('Choose a model')
const box = page.locator('textarea').first()
await box.fill(TEXT)
await box.focus()
diff --git a/e2e/support/ui.ts b/e2e/support/ui.ts
index d6dae141..f74cd695 100644
--- a/e2e/support/ui.ts
+++ b/e2e/support/ui.ts
@@ -54,3 +54,19 @@ export async function oeffneSeitenleiste(page: Page): Promise<void> {
await expect(page.getByRole('button', { name: 'New Chat' }).first()).toBeVisible({ timeout: 10_000 })
}
}
+
+/**
+ * Pick a chat model in the composer's picker, the way a user does.
+ *
+ * Needed in Cloud mode since 3.0.5: the app no longer picks a hosted chat
+ * model by itself, so a spec that wants a conversation there names its model
+ * first, exactly like a new account has to. "New Chat" without a picked model
+ * stays on the landing page.
+ */
+export async function pickChatModel(page: Page, name: RegExp): Promise<void> {
+ const picker = page.getByRole('button', { name: 'Select chat model', exact: true })
+ await expect(picker).toBeVisible({ timeout: 20_000 })
+ await picker.click()
+ await page.getByTestId('model-picker-menu').getByRole('button', { name }).click()
+ await expect(picker).toContainText(name)
+}
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index b2077f76..57103f0d 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -276,7 +276,14 @@ 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: 'Choose a model below. Automatic picks require a known size of at least 7B.', cta: null }
+ // In der Cloud waehlt die App nie selbst (lib/active-model-mode), der
+ // Satz ueber die 7B-Regel waere dort eine Auskunft ueber nichts.
+ ? {
+ subline: appMode === 'cloud'
+ ? 'Choose a model below.'
+ : '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/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx
index 0044cc96..2ca91ef8 100644
--- a/src/components/layout/Sidebar.tsx
+++ b/src/components/layout/Sidebar.tsx
@@ -156,9 +156,15 @@ export function Sidebar() {
// when no model is installed/selected, or the model list hasn't
// populated yet. Send the user to the Models page where they can
// install or pick one, instead of a dead click with no feedback.
- // Cloud mode hides that local-hardware view entirely (the hosted
- // catalog is just still loading/failed) — stay in chat there.
- if (useSettingsStore.getState().settings.appMode === 'cloud') return
+ // Cloud mode hides that local-hardware view entirely, so the click
+ // lands on the chat landing page there: its composer holds the model
+ // picker, and in Cloud the user names the model himself (the app picks
+ // none, lib/active-model-mode).
+ if (useSettingsStore.getState().settings.appMode === 'cloud') {
+ setActiveConversation(null)
+ setView('chat')
+ return
+ }
setView('models')
return
}
diff --git a/src/components/models/ModelSelector.tsx b/src/components/models/ModelSelector.tsx
index 9c92767d..4dd50d65 100644
--- a/src/components/models/ModelSelector.tsx
+++ b/src/components/models/ModelSelector.tsx
@@ -654,6 +654,13 @@ export interface ModelSelectorProps {
answeredBy?: string | null
}
+/** What the picker button reads while no chat model is picked. In Cloud mode
+ * that is the normal state of a new account: the app never picks a hosted
+ * model by itself (lib/active-model-mode). */
+const NO_MODEL_LABEL = 'Choose a model'
+/** The first line of the menu in Cloud mode while nothing is picked. */
+const CHOOSE_TO_SEND = 'Choose a model to send your message.'
+
// `openUpward` flips the dropdown to open above the trigger, right-aligned, // used when the picker lives in the composer action bar (bottom of the screen)
// instead of the header. Header usage keeps the default downward/centered menu.
export function ModelSelector({ openUpward = false, surface = 'chat', answeredBy = null }: ModelSelectorProps = {}) {
@@ -1256,7 +1263,7 @@ export function ModelSelector({ openUpward = false, surface = 'chat', answeredBy
const wechselLaeuft = isModelLoading || imWechselZu !== null
|| (swapLaeuft && getProviderIdFromModel(gezeigtesModell ?? '') === 'openai')
const gezeigtesObj = models.find((m) => m.name === gezeigtesModell)
- const activeDisplayName = gezeigtesModell ? modelDisplayLabel(models, gezeigtesModell) : 'Select Model'
+ const activeDisplayName = gezeigtesModell ? modelDisplayLabel(models, gezeigtesModell) : NO_MODEL_LABEL
// Der Punkt folgt demselben Modell wie der Name daneben, sonst haette der
// Knopf waehrend eines Wechsels zwei Aussagen in sich.
const activeType = gezeigtesObj?.type || 'text'
@@ -1396,7 +1403,7 @@ export function ModelSelector({ openUpward = false, surface = 'chat', answeredBy
>
{/* First of all: why the menu opened by itself. The message the
user tried to send is still in the composer. */}
- {sendNeedsModel && (
+ {sendNeedsModel ? (
<div
data-testid="picker-send-needs-model"
className={`px-2.5 py-1.5 border-b border-black/5 dark:border-white/[0.06] t-micro leading-snug ${HINWEIS_TEXT.ruhig}`}
@@ -1405,6 +1412,16 @@ export function ModelSelector({ openUpward = false, surface = 'chat', answeredBy
? 'Pick a model to send your message. Your text and attachments are kept.'
: 'Your message needs a chat model, and none is listed yet. Your text and attachments are kept.'}
</div>
+ ) : appMode === 'cloud' && !activeModel && textModels.length > 0 && (
+ // In Cloud the app picks no model by itself, so a menu without
+ // a pick is the normal state of a new account there. The line
+ // says what the pick is for, in the words of the web app.
+ <div
+ data-testid="picker-choose-a-model"
+ className={`px-2.5 py-1.5 border-b border-black/5 dark:border-white/[0.06] t-micro leading-snug ${HINWEIS_TEXT.ruhig}`}
+ >
+ {CHOOSE_TO_SEND}
+ </div>
)}
{/* Noch vor der Engine-Zeile: was sich am Modell selbst geaendert
hat, waehrend der Nutzer woanders hinsah. Begruendung des
diff --git a/src/hooks/__tests__/der-rueckweg-aus-der-cloud-weckt-den-motor.test.ts b/src/hooks/__tests__/der-rueckweg-aus-der-cloud-weckt-den-motor.test.ts
index 4892dbe0..3a8b9e8a 100644
--- a/src/hooks/__tests__/der-rueckweg-aus-der-cloud-weckt-den-motor.test.ts
+++ b/src/hooks/__tests__/der-rueckweg-aus-der-cloud-weckt-den-motor.test.ts
@@ -86,13 +86,15 @@ const KATALOG = [
const nichts = { local: null, cloud: null }
describe('jeder Modus behaelt seine eigene Wahl', () => {
- it('Cloud an ohne Vorgeschichte: der Kopf des Katalogs, wie bisher', () => {
+ it('Cloud an ohne Vorgeschichte: nichts ist gewaehlt, der Kopf des Katalogs springt nicht mehr ein', () => {
// T1, Nebenfund 7: genau das stand da, `Llama 3.1 8B Turbo`, ohne dass der
- // Tester es gewaehlt hatte. Beim ERSTEN Eintritt ist das richtig, es gibt
- // nichts anderes; der Befund ist, dass es beim zweiten genauso war.
+ // Tester es gewaehlt hatte. Bis zum 05.10.2026 galt das beim ERSTEN
+ // Eintritt als richtig. Gemessen am selben Tag: dieses Modell lehnt
+ // Erwachsenen-Fiktion ab, und die Ablehnung im Verlauf uebernehmen danach
+ // auch die guten Modelle. In der Cloud waehlt jetzt der Nutzer.
const hin = pickForMode(HERMES_ROW, KATALOG, 'cloud', null, { local: HERMES_ROW, cloud: null })
expect(hin.change).toBe(true)
- expect(hin.next).toBe(KIMI)
+ expect(hin.next).toBeNull()
})
it('THE FIX, Cloud an mit Vorgeschichte: die letzte Wolkenwahl, nicht der Kopf', () => {
@@ -100,9 +102,9 @@ describe('jeder Modus behaelt seine eigene Wahl', () => {
expect(hin.next).toBe(FLASH)
})
- it('DIE ROTE ZAHL des Hinwegs: ohne die Wolken-Erinnerung springt der Kopf ein', () => {
+ it('ohne die Wolken-Erinnerung landet der Hinweg auf keinem der beiden Cloud-Modelle', () => {
const hin = pickForMode(HERMES_ROW, KATALOG, 'cloud', null, { local: HERMES_ROW, cloud: null })
- expect(hin.next).toBe(KIMI)
+ expect(hin.next).not.toBe(KIMI)
expect(hin.next).not.toBe(FLASH)
})
diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.ts
index 09973c16..a8bab5a9 100644
--- a/src/hooks/useCloudCreate.ts
+++ b/src/hooks/useCloudCreate.ts
@@ -44,9 +44,9 @@ import { STUDIO_MODELS, studioFields } from '../lib/render/studio-contract'
import { modelLabel } from '../lib/render/preset-models'
import { improveKindForIntent, IMPROVING_PROMPT } from '../lib/render/improve-prompt'
import { rewrittenByName } from '../lib/render/qwen-enhancer'
-import { useModelStore } from '../stores/modelStore'
import { elapsedLine } from '../lib/elapsed-line'
import { improvePrompt } from '../lib/render/improve-prompt-run'
+import { currentHelperModel } from '../lib/cloud-helper-model'
import { bookedVideoSeconds } from '../lib/render/video-duration'
import { studioQuote, StudioQuoteChangedError } from '../api/cloud/studio'
import { MIN_TRAIN_IMAGES, maxTrainImages } from '../lib/train-image-cap'
@@ -588,7 +588,7 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
if (out.status === 'improved' && !clientSafety(out.prompt).blocked) {
runPrompt = out.prompt
promptOriginal = s.prompt
- rewrittenBy = rewrittenByName('chat', useModelStore.getState().activeModel)
+ rewrittenBy = rewrittenByName('chat', currentHelperModel())
} else if (out.status !== 'unchanged' && !ac.signal.aborted) {
improveFailed = true
}
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index 48c7910f..d6535314 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -66,7 +66,7 @@ import { scenePromptFor } from '../lib/ltx-multishot'
import { improveKindForIntent, IMPROVING_PROMPT, type ImproveOutcome } from '../lib/render/improve-prompt'
import { elapsedLine } from '../lib/elapsed-line'
import { improvePrompt } from '../lib/render/improve-prompt-run'
-import { useModelStore } from '../stores/modelStore'
+import { currentHelperModel } from '../lib/cloud-helper-model'
import { pickQwenEnhancer, rewrittenByName, type ImproveWriter } from '../lib/render/qwen-enhancer'
import { buildQwenEnhancerWorkflow, runQwenEnhancer } from '../api/qwen-enhancer'
import { extraReferenceSlots } from '../lib/edit-references'
@@ -616,7 +616,7 @@ export function useCreate() {
const takeRewrite = (out: ImproveOutcome, writer: ImproveWriter['id']) => {
if (out.status === 'improved' && !checkPromptSafety(out.prompt).blocked) {
prompt = out.prompt
- improveFields = { promptOriginal: scenePrompt, rewrittenBy: rewrittenByName(writer, useModelStore.getState().activeModel) }
+ improveFields = { promptOriginal: scenePrompt, rewrittenBy: rewrittenByName(writer, currentHelperModel()) }
} else if (out.status !== 'unchanged') {
improveFields = { improveFailed: true }
}
diff --git a/src/lib/__tests__/chat-export.test.ts b/src/lib/__tests__/chat-export.test.ts
index 334716f5..1a8f2aa7 100644
--- a/src/lib/__tests__/chat-export.test.ts
+++ b/src/lib/__tests__/chat-export.test.ts
@@ -83,3 +83,30 @@ describe('exportAsJSON', () => {
expect(parsed.messages[3].sources).toHaveLength(1)
})
})
+
+// 3.0.5: a chat that has no model names none in its export.
+describe('a chat without a model', () => {
+ const bare: Conversation = {
+ ...mockConversation,
+ model: '',
+ messages: [{ id: 'm1', role: 'user', content: 'Hello!', timestamp: 1712160001000 }],
+ }
+
+ it('Markdown: the header keeps the date and drops the model', () => {
+ const header = exportAsMarkdown(bare).split('\n')[1]
+ expect(header).not.toContain('Model')
+ expect(header).toBe(`_${new Date(bare.createdAt).toLocaleString()}_`)
+ })
+
+ it('JSON: no model field, everything else as it was', () => {
+ const parsed = JSON.parse(exportAsJSON(bare))
+ expect('model' in parsed).toBe(false)
+ expect(parsed.id).toBe('test-123')
+ expect(parsed.messages).toHaveLength(1)
+ })
+
+ it('NEGATIVE CONTROL: a chat with a model still names it in both', () => {
+ expect(exportAsMarkdown(mockConversation).split('\n')[1]).toContain('_Model: hermes3:8b | ')
+ expect(JSON.parse(exportAsJSON(mockConversation)).model).toBe('hermes3:8b')
+ })
+})
diff --git a/src/lib/__tests__/conversation-model.test.ts b/src/lib/__tests__/conversation-model.test.ts
index 7f803341..60706ba2 100644
--- a/src/lib/__tests__/conversation-model.test.ts
+++ b/src/lib/__tests__/conversation-model.test.ts
@@ -125,7 +125,9 @@ describe('every assistant turn records the model that produced it', () => {
describe('the conversation displays read the conversation, not the picker', () => {
it('THE FIX: the export header names the model of the last answer', () => {
- expect(src('lib/chat-export.ts')).toMatch(/_Model: \$\{conversationModelOf\(conversation\)\}/)
+ const exportSrc = src('lib/chat-export.ts')
+ expect(exportSrc).toMatch(/const model = conversationModelOf\(conversation\)/)
+ expect(exportSrc).toMatch(/_Model: \$\{model\}/)
})
it('THE FIX: the composer still knows what the open chat ran on when it differs', () => {
diff --git a/src/lib/active-model-mode.ts b/src/lib/active-model-mode.ts
index 25c4dddd..75a82ce6 100644
--- a/src/lib/active-model-mode.ts
+++ b/src/lib/active-model-mode.ts
@@ -82,8 +82,9 @@ export function pickForMode(
* letzte Wolkenwahl des Nutzers.
*
* Zwei getrennte Erinnerungen loesen beides: jeder Modus bekommt zurueck, was
- * er zuletzt hatte, und der Kopf der Liste springt nur noch ein, wenn es dort
- * wirklich noch keine Wahl gab.
+ * er zuletzt hatte, und der Kopf der Liste springt nur noch lokal ein, und nur
+ * wenn es dort wirklich noch keine Wahl gab. In der Cloud springt er gar nicht
+ * mehr ein (05.10.2026, Begruendung unten am `fallback`).
*/
remembered: RememberedPicks = { local: null, cloud: null },
): ModePick {
@@ -118,7 +119,15 @@ export function pickForMode(
return { change: activeModel !== behalten.name, next: behalten.name, usedRequest: false }
}
- const fallback = models.find(model => wanted(model) && canAutoSelectChat(model))
+ // Der Kopf der Liste springt nur lokal ein. In der Cloud waehlt die App nie
+ // selbst: der Kopf des Katalogs ist `Llama 3.1 8B Turbo`, besteht die
+ // 7B-Regel, und ein neues Konto hat darauf geschrieben, ohne es je gewaehlt
+ // zu haben (gemessen 05.10.2026: es lehnt Erwachsenen-Fiktion ab, und eine
+ // Ablehnung im Verlauf uebernehmen danach auch die guten Modelle). Die
+ // benannte Zeile und die letzte eigene Cloud-Wahl oben bleiben.
+ const fallback = appMode === 'cloud'
+ ? undefined
+ : 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-export.ts b/src/lib/chat-export.ts
index 53c4ba6b..13bae3d2 100644
--- a/src/lib/chat-export.ts
+++ b/src/lib/chat-export.ts
@@ -19,7 +19,11 @@ export function exportAsMarkdown(conversation: Conversation): string {
// that produced none of the text below it (Meldung 4, R5 re-measure
// 2026-08-30). Old chats whose answers carry no model fall back to the
// field, which is all that was ever known about them.
- lines.push(`_Model: ${conversationModelOf(conversation)} | ${new Date(conversation.createdAt).toLocaleString()}_`)
+ // A chat that never had a model names none: "Model:" with nothing behind it
+ // is not an answer.
+ const model = conversationModelOf(conversation)
+ const created = new Date(conversation.createdAt).toLocaleString()
+ lines.push(model ? `_Model: ${model} | ${created}_` : `_${created}_`)
lines.push('')
if (conversation.systemPrompt) {
@@ -69,7 +73,10 @@ export function exportAsMarkdown(conversation: Conversation): string {
}
export function exportAsJSON(conversation: Conversation): string {
- return JSON.stringify(conversation, null, 2)
+ // Same rule as the Markdown header: no model, no model field.
+ if (conversation.model?.trim()) return JSON.stringify(conversation, null, 2)
+ const { model: _none, ...withoutModel } = conversation
+ return JSON.stringify(withoutModel, null, 2)
}
export function downloadFile(content: string, filename: string, type: string) {
diff --git a/src/lib/cloud-helper-model.ts b/src/lib/cloud-helper-model.ts
new file mode 100644
index 00000000..4187edfb
--- /dev/null
+++ b/src/lib/cloud-helper-model.ts
@@ -0,0 +1,31 @@
+import type { AppMode } from '../types/settings'
+import { useModelStore } from '../stores/modelStore'
+import { useSettingsStore } from '../stores/settingsStore'
+
+/**
+ * The hosted model a helper call runs on in Cloud mode while the user has
+ * picked no chat model yet.
+ *
+ * Since 3.0.5 the app no longer picks a hosted chat model by itself
+ * (lib/active-model-mode), so a new account can sit in Create with "Improve my
+ * prompt" on and no chat model anywhere. The switch must not be a dead end
+ * for that. A helper call is not a chat: nothing of it lands in a history, so
+ * a fixed small instruct model is the right tool, and the same one the web
+ * app uses. The one place this id is written down.
+ */
+export const CLOUD_HELPER_MODEL = 'lu-cloud::mistralai/Mistral-Small-3.2-24B-Instruct-2506'
+
+/**
+ * Which model a helper call runs on: the picked chat model when there is one,
+ * the helper model in Cloud mode when there is none, and nothing in Local
+ * mode, where a model has to be on the machine and only the user knows which.
+ */
+export function helperModelFor(activeModel: string | null, appMode: AppMode | undefined): string | null {
+ if (activeModel) return activeModel
+ return appMode === 'cloud' ? CLOUD_HELPER_MODEL : null
+}
+
+/** The same answer for right now, read from the stores. */
+export function currentHelperModel(): string | null {
+ return helperModelFor(useModelStore.getState().activeModel, useSettingsStore.getState().settings.appMode)
+}
diff --git a/src/lib/render/__tests__/improve-prompt-run.test.ts b/src/lib/render/__tests__/improve-prompt-run.test.ts
index f1bd57d7..70addd69 100644
--- a/src/lib/render/__tests__/improve-prompt-run.test.ts
+++ b/src/lib/render/__tests__/improve-prompt-run.test.ts
@@ -42,6 +42,8 @@ vi.mock('../../run-slot', () => ({
}))
import { useModelStore } from '../../../stores/modelStore'
+import { useSettingsStore } from '../../../stores/settingsStore'
+import { CLOUD_HELPER_MODEL, helperModelFor } from '../../cloud-helper-model'
import { improveAvailabilityFor, improvePrompt } from '../improve-prompt-run'
import { IMPROVE_TIMEOUT_MS } from '../improve-prompt'
@@ -58,6 +60,7 @@ beforeEach(() => {
plan.queued = false
plan.thinkCompatible = true
useModelStore.setState({ activeModel: 'lu-cloud::chat-model', models: [] })
+ useSettingsStore.setState((st) => ({ settings: { ...st.settings, appMode: 'local' } }))
})
describe('Improve my prompt: Lauf (Desktop)', () => {
@@ -180,3 +183,59 @@ describe('Improve my prompt: Verfuegbarkeit (Desktop)', () => {
expect(a.hint).not.toMatch(/billed/i)
})
})
+
+/**
+ * 3.0.5: in Cloud mode the app picks no chat model by itself any more, so a
+ * new account can have the switch on and no chat model. The rewrite then runs
+ * on the fixed helper model instead of being a dead end. Local mode is as it
+ * was: no chat model, no rewrite.
+ */
+describe('Improve my prompt without a picked chat model', () => {
+ const cloudMode = () => useSettingsStore.setState((st) => ({ settings: { ...st.settings, appMode: 'cloud' } }))
+
+ it('the helper model is written down once, with the id the web app uses', () => {
+ expect(CLOUD_HELPER_MODEL).toBe('lu-cloud::mistralai/Mistral-Small-3.2-24B-Instruct-2506')
+ })
+
+ it('helperModelFor: the pick wins, Cloud falls back to the helper, Local to nothing', () => {
+ expect(helperModelFor('lu-cloud::chat-model', 'cloud')).toBe('lu-cloud::chat-model')
+ expect(helperModelFor('qwen3:8b', 'local')).toBe('qwen3:8b')
+ expect(helperModelFor(null, 'cloud')).toBe(CLOUD_HELPER_MODEL)
+ expect(helperModelFor(null, 'local')).toBeNull()
+ expect(helperModelFor(null, undefined)).toBeNull()
+ })
+
+ it('Cloud: the switch is usable and says who writes and what it costs', () => {
+ const a = improveAvailabilityFor(null, 'cloud')
+ expect(a.available).toBe(true)
+ expect(a.hint).toBe('A small LU Cloud model rewrites your prompt for the model you picked. Billed like a short chat message.')
+ })
+
+ it('NEGATIVE CONTROL, Local: still needs a chat model', () => {
+ const a = improveAvailabilityFor(null, 'local')
+ expect(a.available).toBe(false)
+ expect(a.hint).toMatch(/chat model/i)
+ })
+
+ it('THE FIX, Cloud: the rewrite runs on the helper model', async () => {
+ useModelStore.setState({ activeModel: null, models: [] })
+ cloudMode()
+ const out = await improvePrompt('a fox', { kind: 'image', modelLabel: 'FLUX 3' })
+ expect(out).toEqual({ status: 'improved', prompt: 'A red fox in deep snow.' })
+ expect(calls.list).toHaveLength(1)
+ expect(calls.list[0].model).toBe('mistralai/Mistral-Small-3.2-24B-Instruct-2506')
+ })
+
+ it('Cloud with a pick: the picked chat model writes, not the helper', async () => {
+ cloudMode()
+ await improvePrompt('a fox', { kind: 'image', modelLabel: 'FLUX 3' })
+ expect(calls.list[0].model).toBe('chat-model')
+ })
+
+ it('NEGATIVE CONTROL, Local without a chat model: nothing is called', async () => {
+ useModelStore.setState({ activeModel: null, models: [] })
+ const out = await improvePrompt('a fox', { kind: 'image', modelLabel: 'FLUX 3' })
+ expect(out).toEqual({ status: 'failed' })
+ expect(calls.list).toHaveLength(0)
+ })
+})
diff --git a/src/lib/render/improve-prompt-run.ts b/src/lib/render/improve-prompt-run.ts
index afea1870..6bcb8607 100644
--- a/src/lib/render/improve-prompt-run.ts
+++ b/src/lib/render/improve-prompt-run.ts
@@ -1,5 +1,7 @@
// "Improve my prompt": the runner. One small chat call on the chat model the
// user has picked, local or cloud, through the same provider a chat turn uses.
+// In Cloud mode without a picked chat model it runs on the fixed helper model
+// (lib/cloud-helper-model), so the switch is never a dead end there.
// On LU Cloud it is metered and billed like chat; on a local model it costs
// nothing. It never throws: any failure answers `failed`, and the run goes on
// with the user's own prompt.
@@ -14,6 +16,8 @@ import { useSettingsStore } from '../../stores/settingsStore'
import { isThinkingCompatible } from '../model-compatibility'
import { resolveAgentNumCtx } from '../agent-num-ctx'
import { runInLane } from '../run-slot'
+import { helperModelFor, currentHelperModel } from '../cloud-helper-model'
+import type { AppMode } from '../../types/settings'
import { laneOf, currentLaneFacts } from '../run-lane-of-model'
import {
IMPROVE_MAX_TOKENS, IMPROVE_TIMEOUT_MS, buildImproveMessages, cleanImproved,
@@ -28,17 +32,25 @@ export interface ImproveAvailability {
const HINT_LOCAL = 'Your chat model rewrites your prompt for the model you picked. It runs on your machine.'
const HINT_CLOUD = 'Your chat model rewrites your prompt for the model you picked. Billed like a short chat message.'
+const HINT_CLOUD_HELPER = 'A small LU Cloud model rewrites your prompt for the model you picked. Billed like a short chat message.'
-/** Can a rewrite run with this chat model? It needs one to write with. */
-export function improveAvailabilityFor(activeModel: string | null): ImproveAvailability {
- if (!activeModel) return { available: false, hint: 'Pick a chat model in Chat first.' }
- const cloud = getProviderIdFromModel(activeModel) === 'lu-cloud'
+/** Can a rewrite run with this chat model? It needs one to write with: the
+ * picked one, or in Cloud mode the helper model. */
+export function improveAvailabilityFor(activeModel: string | null, appMode?: AppMode): ImproveAvailability {
+ const writer = helperModelFor(activeModel, appMode)
+ if (!writer) return { available: false, hint: 'Pick a chat model in Chat first.' }
+ if (!activeModel) return { available: true, hint: HINT_CLOUD_HELPER }
+ const cloud = getProviderIdFromModel(writer) === 'lu-cloud'
return { available: true, hint: cloud ? HINT_CLOUD : HINT_LOCAL }
}
-/** The same answer, kept current while the user picks another chat model. */
+/** The same answer, kept current while the user picks another chat model or
+ * flips the Cloud switch. */
export function useImproveAvailability(): ImproveAvailability {
- return improveAvailabilityFor(useModelStore((s) => s.activeModel))
+ return improveAvailabilityFor(
+ useModelStore((s) => s.activeModel),
+ useSettingsStore((s) => s.settings.appMode),
+ )
}
/** The turn id the rewrite books its place under. Its own, so it queues behind
@@ -51,7 +63,8 @@ export async function improvePrompt(
target: ImproveTarget,
signal?: AbortSignal,
): Promise<ImproveOutcome> {
- const { activeModel, models } = useModelStore.getState()
+ const { models } = useModelStore.getState()
+ const activeModel = currentHelperModel()
if (!activeModel || signal?.aborted) return { status: 'failed' }
try {
const { provider, modelId } = getProviderForModel(activeModel)
diff --git a/src/stores/__tests__/cloud-waehlt-kein-chatmodell-von-selbst.test.ts b/src/stores/__tests__/cloud-waehlt-kein-chatmodell-von-selbst.test.ts
new file mode 100644
index 00000000..f5c3b6ff
--- /dev/null
+++ b/src/stores/__tests__/cloud-waehlt-kein-chatmodell-von-selbst.test.ts
@@ -0,0 +1,129 @@
+/**
+ * In Cloud mode the app never picks a chat model by itself (David, 2026-10-05).
+ *
+ * Measured that day (lu-305/mail/TEST-VERWEIGERUNG-2026-10-05.md): a new
+ * account got the head of the hosted catalogue, Llama 3.1 8B Turbo, without
+ * ever having picked it. That model declines adult fiction, and once a refusal
+ * stands in the history, better models in the same chat copy it.
+ *
+ * Two places handed out that model: `setModels` in this store, which takes the
+ * first chat row of at least 7B when no valid pick is there, and the
+ * Local/Cloud rule in lib/active-model-mode, which did the same on the way
+ * into Cloud. Both are covered here. A pick the user made earlier and that is
+ * still in the list stays, in both places. Local mode keeps its rule.
+ *
+ * Run: npx vitest run src/stores/__tests__/cloud-waehlt-kein-chatmodell-von-selbst.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+vi.mock('@tauri-apps/api/core', () => ({ invoke: vi.fn(async () => undefined) }))
+vi.mock('../../api/backend', () => ({
+ isTauri: vi.fn(() => false),
+ backendCall: vi.fn(async () => undefined),
+}))
+vi.mock('../../api/ollama', () => ({ unloadModel: vi.fn(async () => undefined) }))
+vi.mock('../../api/lmstudio', () => ({ unloadLmStudioModel: vi.fn(async () => undefined) }))
+vi.mock('../../api/engine', () => ({ activateBuiltinModel: vi.fn(async () => undefined) }))
+
+import { useModelStore } from '../modelStore'
+import { useSettingsStore } from '../settingsStore'
+import { pickForMode } from '../../lib/active-model-mode'
+import type { AIModel } from '../../types/models'
+
+const LLAMA = 'lu-cloud::llama-3.1-8b-turbo'
+const GLM = 'lu-cloud::glm-5.3'
+const QWEN_LOCAL = 'openai::Qwen3-14B-Q4_K_M'
+
+const cloud = (name: string) => ({
+ name, model: name, size: 0, type: 'text' as const,
+ provider: 'lu-cloud' as const, providerName: 'LU Cloud',
+}) as AIModel
+const local = (name: string) => ({
+ name, model: name, size: 0, type: 'text' as const,
+ provider: 'openai' as const, providerName: 'LU Engine',
+}) as AIModel
+
+/** The head of the catalogue first, exactly as `/v1/models` answers. */
+const CATALOGUE = [cloud(LLAMA), cloud(GLM)]
+
+const setMode = (appMode: 'cloud' | 'local') =>
+ useSettingsStore.setState((s) => ({ settings: { ...s.settings, appMode } }))
+
+beforeEach(() => {
+ useModelStore.setState({ models: [], activeModel: null, lastCloudModel: null, lastLocalModel: null })
+ setMode('cloud')
+})
+
+describe('setModels in Cloud mode', () => {
+ it('THE FIX: a new account ends up with no chat model, not with the head of the catalogue', () => {
+ useModelStore.getState().setModels(CATALOGUE)
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+
+ it('a pick the user made earlier and that is still listed stays', () => {
+ useModelStore.setState({ activeModel: GLM })
+ useModelStore.getState().setModels(CATALOGUE)
+ expect(useModelStore.getState().activeModel).toBe(GLM)
+ })
+
+ it('a pick that left the catalogue is cleared, nothing takes its place', () => {
+ useModelStore.setState({ activeModel: 'lu-cloud::retired-model-70b' })
+ useModelStore.getState().setModels(CATALOGUE)
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+
+ it('a local model of the right size is not handed out in Cloud mode either', () => {
+ useModelStore.getState().setModels([local(QWEN_LOCAL), ...CATALOGUE])
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+})
+
+describe('setModels in Local mode', () => {
+ beforeEach(() => setMode('local'))
+
+ it('never falls on a hosted model, even when the catalogue heads the list', () => {
+ useModelStore.getState().setModels(CATALOGUE)
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+
+ it('NEGATIVE CONTROL: the local automatic pick is unchanged', () => {
+ useModelStore.getState().setModels([...CATALOGUE, local(QWEN_LOCAL)])
+ expect(useModelStore.getState().activeModel).toBe(QWEN_LOCAL)
+ })
+})
+
+describe('the Local/Cloud rule on the way into Cloud', () => {
+ const rows = [
+ { name: QWEN_LOCAL, type: 'text', provider: 'openai' },
+ { name: LLAMA, type: 'text', provider: 'lu-cloud' },
+ { name: GLM, type: 'text', provider: 'lu-cloud' },
+ ]
+ const none = { local: null, cloud: null }
+
+ it('THE FIX: nothing picked and nothing remembered stays nothing', () => {
+ expect(pickForMode(null, rows, 'cloud', null, none)).toMatchObject({ change: false, next: null })
+ })
+
+ it('a local pick is cleared on the flip, and no hosted model replaces it', () => {
+ expect(pickForMode(QWEN_LOCAL, rows, 'cloud', null, { local: QWEN_LOCAL, cloud: null }))
+ .toMatchObject({ change: true, next: null })
+ })
+
+ it('the last Cloud pick of the user comes back', () => {
+ expect(pickForMode(QWEN_LOCAL, rows, 'cloud', null, { local: QWEN_LOCAL, cloud: GLM }))
+ .toMatchObject({ change: true, next: GLM })
+ })
+
+ it('a row the user named on the way in is taken', () => {
+ expect(pickForMode(QWEN_LOCAL, rows, 'cloud', GLM, none))
+ .toMatchObject({ change: true, next: GLM, usedRequest: true })
+ })
+
+ it('a valid Cloud pick is left alone', () => {
+ expect(pickForMode(LLAMA, rows, 'cloud', null, none)).toMatchObject({ change: false, next: LLAMA })
+ })
+
+ it('NEGATIVE CONTROL: back in Local the first model of at least 7B still steps in', () => {
+ expect(pickForMode(GLM, rows, 'local', null, none)).toMatchObject({ change: true, next: QWEN_LOCAL })
+ })
+})
diff --git a/src/stores/__tests__/die-alte-automatik-wahl-wird-einmal-geloescht.test.ts b/src/stores/__tests__/die-alte-automatik-wahl-wird-einmal-geloescht.test.ts
new file mode 100644
index 00000000..72f29a26
--- /dev/null
+++ b/src/stores/__tests__/die-alte-automatik-wahl-wird-einmal-geloescht.test.ts
@@ -0,0 +1,126 @@
+// @vitest-environment jsdom
+/**
+ * The old automatic Cloud pick is cleared once (3.0.5, 2026-10-05).
+ *
+ * Until 3.0.5 the app put the head of the hosted catalogue into the picker by
+ * itself: Llama 3.1 8B Turbo, the first hosted row that passed the 7B rule.
+ * It declines adult fiction, and a refusal in the history is copied by better
+ * models in the same chat. New accounts get no automatic pick any more, but an
+ * account that already has that model stored would keep chatting on it. A
+ * stored pick of exactly that model cannot be told from a deliberate one, so
+ * it is cleared one time. The marker makes it one time: a later deliberate
+ * pick of the same model stays.
+ *
+ * Driven through the real persist layer: the stored state is written to
+ * localStorage and the store rehydrates from it.
+ *
+ * Run: npx vitest run src/stores/__tests__/die-alte-automatik-wahl-wird-einmal-geloescht.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+vi.mock('@tauri-apps/api/core', () => ({ invoke: vi.fn(async () => undefined) }))
+vi.mock('../../api/backend', () => ({
+ isTauri: vi.fn(() => false),
+ backendCall: vi.fn(async () => undefined),
+}))
+vi.mock('../../api/ollama', () => ({ unloadModel: vi.fn(async () => undefined) }))
+vi.mock('../../api/lmstudio', () => ({ unloadLmStudioModel: vi.fn(async () => undefined) }))
+vi.mock('../../api/engine', () => ({ activateBuiltinModel: vi.fn(async () => undefined) }))
+
+import { useModelStore, RETIRED_AUTO_CLOUD_PICK } from '../modelStore'
+import { useSettingsStore } from '../settingsStore'
+import type { AIModel } from '../../types/models'
+
+const KEY = 'chat-models'
+const GLM = 'lu-cloud::glm-5.3'
+const LOCAL = 'openai::Qwen3-14B-Q4_K_M'
+
+interface Stored {
+ activeModel: string | null
+ lastLocalModel: string | null
+ lastCloudModel: string | null
+ autoCloudPickCleared?: boolean
+}
+
+async function startWith(stored: Stored) {
+ localStorage.setItem(KEY, JSON.stringify({ state: { categoryFilter: 'all', ...stored }, version: 0 }))
+ await useModelStore.persist.rehydrate()
+ return useModelStore.getState()
+}
+const onDisk = (): Stored => JSON.parse(localStorage.getItem(KEY)!).state
+
+const cloud = (name: string) => ({
+ name, model: name, size: 0, type: 'text' as const, provider: 'lu-cloud' as const, providerName: 'LU Cloud',
+}) as AIModel
+
+beforeEach(() => {
+ localStorage.clear()
+ useModelStore.setState({
+ models: [], activeModel: null, lastLocalModel: null, lastCloudModel: null, autoCloudPickCleared: false,
+ })
+ useSettingsStore.setState((s) => ({ settings: { ...s.settings, appMode: 'cloud' } }))
+})
+
+describe('an account that still carries the automatic pick', () => {
+ it('the model is the head of the hosted catalogue by its real id', () => {
+ expect(RETIRED_AUTO_CLOUD_PICK).toBe('lu-cloud::meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo')
+ })
+
+ it('THE FIX: the stored pick is cleared, and so is the memory of the Cloud side', async () => {
+ const s = await startWith({ activeModel: RETIRED_AUTO_CLOUD_PICK, lastLocalModel: LOCAL, lastCloudModel: RETIRED_AUTO_CLOUD_PICK })
+ expect(s.activeModel).toBeNull()
+ expect(s.lastCloudModel).toBeNull()
+ expect(s.lastLocalModel).toBe(LOCAL)
+ expect(s.autoCloudPickCleared).toBe(true)
+ })
+
+ it('a user in Local mode loses only the remembered Cloud side', async () => {
+ const s = await startWith({ activeModel: LOCAL, lastLocalModel: LOCAL, lastCloudModel: RETIRED_AUTO_CLOUD_PICK })
+ expect(s.activeModel).toBe(LOCAL)
+ expect(s.lastCloudModel).toBeNull()
+ })
+
+ it('the catalogue arriving afterwards does not put the model back', async () => {
+ await startWith({ activeModel: RETIRED_AUTO_CLOUD_PICK, lastLocalModel: null, lastCloudModel: RETIRED_AUTO_CLOUD_PICK })
+ useModelStore.getState().setModels([cloud(RETIRED_AUTO_CLOUD_PICK), cloud(GLM)])
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+
+ it('ONCE: picking that same model on purpose afterwards survives the next start', async () => {
+ await startWith({ activeModel: RETIRED_AUTO_CLOUD_PICK, lastLocalModel: null, lastCloudModel: RETIRED_AUTO_CLOUD_PICK })
+ useModelStore.getState().setModels([cloud(RETIRED_AUTO_CLOUD_PICK), cloud(GLM)])
+ useModelStore.getState().setActiveModel(RETIRED_AUTO_CLOUD_PICK)
+ // The marker went to disk together with the deliberate pick.
+ expect(onDisk()).toMatchObject({ activeModel: RETIRED_AUTO_CLOUD_PICK, autoCloudPickCleared: true })
+ // The next start of the app.
+ useModelStore.setState({ activeModel: null, lastCloudModel: null, autoCloudPickCleared: false })
+ localStorage.setItem(KEY, JSON.stringify({
+ state: { categoryFilter: 'all', activeModel: RETIRED_AUTO_CLOUD_PICK, lastLocalModel: null, lastCloudModel: RETIRED_AUTO_CLOUD_PICK, autoCloudPickCleared: true },
+ version: 0,
+ }))
+ await useModelStore.persist.rehydrate()
+ expect(useModelStore.getState().activeModel).toBe(RETIRED_AUTO_CLOUD_PICK)
+ expect(useModelStore.getState().lastCloudModel).toBe(RETIRED_AUTO_CLOUD_PICK)
+ })
+})
+
+describe('what the clearing leaves alone', () => {
+ it('NEGATIVE CONTROL: any other stored Cloud pick stays', async () => {
+ const s = await startWith({ activeModel: GLM, lastLocalModel: null, lastCloudModel: GLM })
+ expect(s.activeModel).toBe(GLM)
+ expect(s.lastCloudModel).toBe(GLM)
+ expect(s.autoCloudPickCleared).toBe(true)
+ })
+
+ it('NEGATIVE CONTROL: a stored local pick stays, and still seeds its memory (R2-27)', async () => {
+ const s = await startWith({ activeModel: LOCAL, lastLocalModel: null, lastCloudModel: null })
+ expect(s.activeModel).toBe(LOCAL)
+ expect(s.lastLocalModel).toBe(LOCAL)
+ })
+
+ it('a new install is marked as done, so its first deliberate pick is never touched', async () => {
+ await useModelStore.persist.rehydrate()
+ expect(useModelStore.getState().autoCloudPickCleared).toBe(true)
+ expect(useModelStore.getState().activeModel).toBeNull()
+ })
+})
diff --git a/src/stores/modelStore.ts b/src/stores/modelStore.ts
index 8b2dbcd7..aba6d221 100644
--- a/src/stores/modelStore.ts
+++ b/src/stores/modelStore.ts
@@ -10,6 +10,7 @@ import { activateBuiltinModel } from '../api/engine'
import { isLmStudioProvider } from '../lib/hf-to-provider'
import { isTauri, backendCall } from '../api/backend'
import { useChatStore } from './chatStore'
+import { useSettingsStore } from './settingsStore'
import { useGenerationStore } from './generationStore'
import { log } from '../lib/logger'
import { isLuEngineName } from '../lib/engine-name'
@@ -89,6 +90,15 @@ export interface PullState {
complete: boolean
}
+/**
+ * The hosted model the app picked by itself until 3.0.5: the head of the
+ * catalogue and the first row that passed the 7B rule (setModels and
+ * lib/active-model-mode). It declines adult fiction, and a refusal in the
+ * history is copied by better models in the same chat (measured 2026-10-05).
+ * No other hosted model was ever handed out that way.
+ */
+export const RETIRED_AUTO_CLOUD_PICK = 'lu-cloud::meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo'
+
interface ModelState {
models: AIModel[]
activeModel: string | null
@@ -115,6 +125,12 @@ interface ModelState {
* des anderen.
*/
lastCloudModel: string | null
+ /**
+ * The one-time clearing of the old automatic Cloud pick has run (see
+ * `RETIRED_AUTO_CLOUD_PICK`). Stored, so that a later deliberate pick of
+ * that same model stays.
+ */
+ autoCloudPickCleared: boolean
activePulls: Record<string, PullState>
isModelLoading: boolean
categoryFilter: ModelCategory
@@ -213,6 +229,7 @@ export const useModelStore = create<ModelState>()(
activeModel: null,
lastLocalModel: null,
lastCloudModel: null,
+ autoCloudPickCleared: false,
activePulls: {},
isModelLoading: false,
categoryFilter: 'all',
@@ -260,7 +277,18 @@ export const useModelStore = create<ModelState>()(
// 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)
+ //
+ // A hosted model is never an automatic choice, and in Cloud mode
+ // nothing is. The head of the hosted catalogue is Llama 3.1 8B
+ // Turbo, it passes the 7B rule, and a new account chatted on it
+ // without ever having picked it (measured 2026-10-05: it declines
+ // adult fiction, and a refusal in the history is then copied by
+ // every better model in the same chat). In Cloud the user names the
+ // model. Locally the rule stays: those are the user's own files.
+ const inCloud = useSettingsStore.getState().settings.appMode === 'cloud'
+ const firstChat = inCloud
+ ? undefined
+ : models.find((m) => m.provider !== 'lu-cloud' && canAutoSelectChat(m))
return {
models,
inventoryLoaded: true,
@@ -580,6 +608,7 @@ export const useModelStore = create<ModelState>()(
activeModel: state.activeModel,
lastLocalModel: state.lastLocalModel,
lastCloudModel: state.lastCloudModel,
+ autoCloudPickCleared: state.autoCloudPickCleared,
categoryFilter: state.categoryFilter,
}),
/**
@@ -595,7 +624,17 @@ export const useModelStore = create<ModelState>()(
* gespeicherter Wert ist immer die bessere Auskunft.
*/
onRehydrateStorage: () => (state) => {
- if (!state?.activeModel) return
+ if (!state) return
+ // Once, before anything else reads the pick: a stored Cloud pick that
+ // is exactly the model the app used to hand out by itself is not a
+ // pick. Nobody can tell it from a deliberate one, so it is cleared one
+ // time and the marker keeps a later pick of the same model.
+ if (!state.autoCloudPickCleared) {
+ if (state.activeModel === RETIRED_AUTO_CLOUD_PICK) state.activeModel = null
+ if (state.lastCloudModel === RETIRED_AUTO_CLOUD_PICK) state.lastCloudModel = null
+ state.autoCloudPickCleared = true
+ }
+ if (!state.activeModel) return
const istCloud = state.activeModel.startsWith('lu-cloud::')
if (istCloud) {
if (!state.lastCloudModel) state.lastCloudModel = state.activeModel