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(chat): restore mode-missing-means-lu default and finish review teil15
purple6c369e885b4b
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsxindex abb96b54..6bb232af 100644--- a/src/components/chat/ChatView.tsx+++ b/src/components/chat/ChatView.tsx@@ -38,6 +38,7 @@ import { RecentChats } from './RecentChats'import { useUIStore } from '../../stores/uiStore'import { useCompareStore } from '../../stores/compareStore'import { exportConversation } from '../../lib/chat-export'+import { conversationMode } from '../../lib/conversation-mode'import { PermissionOverrideBar } from './PermissionOverrideBar'import { CodexView } from './CodexView'import { useCodexStore } from '../../stores/codexStore'@@ -92,7 +93,8 @@ export function ChatView() {// Reiterwechsel den Zustand zuruecksetzt. 'codex' bleibt aussen vor// (eigene Ansicht, CodexView, siehe chatMode-Weiche oben); 'openclaw' hat// keinen aktiven Einstiegspunkt in der UI und bleibt deshalb unberuehrt.- if (conv.mode !== 'lu' && conv.mode !== 'remote') return false+ const mode = conversationMode(conv)+ if (mode !== 'lu' && mode !== 'remote') return falsereturn conv.messages.filter((m) => m.role !== 'system' && !m.hidden).length === 0})const activeModel = useModelStore((s) => s.activeModel)@@ -503,7 +505,7 @@ export function ChatView() {<div className="flex-1 min-h-0 flex flex-col items-center justify-center overflow-y-auto scrollbar-thin py-4 px-3"><divdata-testid="chat-landing"- className="flex flex-col items-center text-center gap-2"+ className="w-full max-w-[var(--lu-measure)] flex flex-col items-center text-center gap-2"><imgsrc={MONOGRAM}diff --git a/src/components/chat/RecentChats.tsx b/src/components/chat/RecentChats.tsxindex e30098cd..94361458 100644--- a/src/components/chat/RecentChats.tsx+++ b/src/components/chat/RecentChats.tsx@@ -14,6 +14,7 @@ import { useChatStore } from '../../stores/chatStore'import { useUIStore } from '../../stores/uiStore'import { useCodexStore } from '../../stores/codexStore'import { timeAgo } from '../../lib/time-ago'+import { conversationMode } from '../../lib/conversation-mode'/** Same cut as the web list: plain chats only, newest first, eight rows. */const MAX_ROWS = 8@@ -29,7 +30,7 @@ export function RecentChats() {// The chat you are already looking at is not a place to go back to. On the// no-chat screen nothing is active, so nothing is dropped there..filter((c) => c.id !== activeConversationId)- .filter((c) => (c.mode ?? 'lu') === 'lu')+ .filter((c) => conversationMode(c) === 'lu').sort((a, b) => b.updatedAt - a.updatedAt).slice(0, MAX_ROWS)diff --git a/src/components/chat/__tests__/leer-aktive-unterhaltung.test.ts b/src/components/chat/__tests__/leer-aktive-unterhaltung.test.tsindex da8c8d1a..efdc4cc4 100644--- a/src/components/chat/__tests__/leer-aktive-unterhaltung.test.ts+++ b/src/components/chat/__tests__/leer-aktive-unterhaltung.test.ts@@ -25,6 +25,15 @@* einen dispatchten Remote-Chat vor der ersten Mobil-Nachricht, weil die* Bedingung `conv.mode !== 'lu'` jeden anderen Modus ausschloss. `mode:* 'remote'` zaehlt jetzt mit (Fix in ChatView.tsx, activeConvIsEmpty).+ *+ * BLOCKER (review-teil15.md): der A3-Umbau schrieb die Bedingung als+ * `conv.mode !== 'lu' && conv.mode !== 'remote'` und liess dabei die alte+ * Vorbelegung "kein mode-Feld heisst lu" fallen. Fuer eine Unterhaltung ohne+ * `mode` (Chats von vor 5382d831, oder importiert ueber+ * lib/parsers/chatbot-export.ts) lautete das Ergebnis wieder `false`, also+ * derselbe leere Hauptbereich wie das urspruengliche F1-Symptom. Fix: die+ * Vorbelegung sitzt jetzt in genau einer Stelle, `lib/conversation-mode.ts`,+ * und ChatView.tsx wie RecentChats.tsx lesen beide von dort.*/import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'import { createElement } from 'react'@@ -103,6 +112,21 @@ describe('F1: eine aktive, leere Unterhaltung zeigt nie einen komplett leeren Haexpect(screen.getByTestId('chat-landing')).toBeTruthy()})+ it('BLOCKER-FIX (review-teil15.md): eine leere Unterhaltung OHNE mode-Feld zeigt den Leerzustand, nicht eine leere Flaeche', () => {+ // Pre-Migration-Chats (mode eingefuehrt 5382d831, 05.04.2026) und Importe+ // ueber chatbot-export.ts tragen kein `mode`-Feld. `conv.mode` ist hier+ // absichtlich `undefined`, nicht `'lu'`.+ useUIStore.setState({ sidebarOpen: true })+ const { mode: _mode, ...withoutMode } = conv('legacy', 'Legacy Chat', NOW)+ useChatStore.setState({+ conversations: [withoutMode as Conversation],+ activeConversationId: 'legacy',+ })+ render(createElement(ChatView))+ expect(screen.getByTestId('chat-landing')).toBeTruthy()+ expect(screen.getByText('Ask LU anything')).toBeTruthy()+ })+it('A3: ein dispatchter, noch leerer Remote-Chat zeigt denselben Leerzustand-Block, nicht eine leere Flaeche', () => {useUIStore.setState({ sidebarOpen: true })useChatStore.setState({@@ -114,7 +138,7 @@ describe('F1: eine aktive, leere Unterhaltung zeigt nie einen komplett leeren Haexpect(screen.getByText('Ask LU anything')).toBeTruthy()})- it('A3-NEGATIVKONTROLLE: ein Remote-Chat mit der ersten Nachricht weicht dem Transkript, wie bei lu', () => {+ it('A3-WAECHTER (keine Negativkontrolle fuer diesen Fix, siehe review-teil15.md Auflage 3): ein Remote-Chat mit der ersten Nachricht weicht dem Transkript, wie bei lu; waere auch ohne den A3-Fix gruen, weil ein Remote-Chat vor A3 nie einen Landing-Block zeigte', () => {useUIStore.setState({ sidebarOpen: true })useChatStore.setState({conversations: [{diff --git a/src/lib/conversation-mode.ts b/src/lib/conversation-mode.tsnew file mode 100644index 00000000..4edf07e8--- /dev/null+++ b/src/lib/conversation-mode.ts@@ -0,0 +1,34 @@+/**+ * The chat mode a conversation runs under, with the legacy default applied.+ *+ * `Conversation.mode` (src/types/chat.ts) is optional. It was introduced on+ * 2026-04-05 (5382d831); every conversation saved before that date has no+ * `mode` field at all, `migratePersistedChat` (chatStore.ts) does not add one+ * on load, and the store deliberately has no version/migrate step. Imported+ * conversations are the same story: `chatbot-export.ts` builds Conversation+ * objects with no `mode` field either.+ *+ * The house rule for an absent `mode` has always been "treat it as `lu`"+ * (RecentChats.tsx originally, `(c.mode ?? 'lu') === 'lu'`). Review Teil 15+ * found that rule re-implemented ad hoc in ChatView.tsx and, in one spot,+ * dropped: `conv.mode !== 'lu' && conv.mode !== 'remote'` reads `false` for+ * `undefined`, so a pre-migration or imported conversation with no messages+ * showed a blank main area instead of the empty-state landing block. One+ * reader here keeps that rule in exactly one place.+ */++import type { Conversation } from '../types/chat'++/** The conversation shape this needs. Kept structural, like+ * conversation-model.ts, so a partial conversation can ask too. */+export interface ConversationModeSource {+ mode?: Conversation['mode']+}++/** `conv.mode`, defaulted to `'lu'` for a conversation that predates the+ * field or came in through an importer that never set it. */+export function conversationMode(+ conv: ConversationModeSource | null | undefined,+): NonNullable<Conversation['mode']> {+ return conv?.mode ?? 'lu'+}