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): the Chat button and the app start go back to the last chat
purple9e577b16f3e7
diff --git a/e2e/code-conversation-stays-in-code.spec.ts b/e2e/code-conversation-stays-in-code.spec.tsindex 17d0de10..6a50368b 100644--- a/e2e/code-conversation-stays-in-code.spec.ts+++ b/e2e/code-conversation-stays-in-code.spec.ts@@ -62,7 +62,8 @@ test('after a restart a Code conversation is not shown as a chat', async ({ pageawait expect(page.getByTestId('codex-transcript').getByText(MARKE)).toBeVisible()await page.reload()- // The app starts in the Chat tab, on the empty chat.+ // The app starts in the Chat tab, on the chat worked on last; there is none+ // here, so on the empty chat.await expect(page.locator('textarea').first()).toBeVisible()await expect(page.getByTestId('codex-transcript')).toHaveCount(0)await expect(page.getByText(MARKE)).toHaveCount(0)@@ -71,3 +72,43 @@ test('after a restart a Code conversation is not shown as a chat', async ({ pageawait page.getByRole('button', { name: 'Code', exact: true }).click()await expect(page.getByTestId('codex-transcript').getByText(MARKE)).toBeVisible()})++const CHAT_MARKE = 'Zeile aus dem Chat, zu der der Chat-Knopf zurueckfuehrt'++/** A plain chat with one exchange, worked on before the Code conversation. */+async function chatVerlauf(page: Page): Promise<void> {+ await page.evaluate(async (marke) => {+ const chatPath = '/src/stores/chatStore.ts'+ const chat = await import(/* @vite-ignore */ chatPath) as typeof import('../src/stores/chatStore')+ const id = chat.useChatStore.getState().createConversation('m', '', 'lu')+ chat.useChatStore.getState().addMessage(id, { id: 'cu1', role: 'user', content: 'hello', timestamp: Date.now() })+ chat.useChatStore.getState().addMessage(id, { id: 'ca1', role: 'assistant', content: marke, timestamp: Date.now() + 1 })+ await chat.flushChatPersist()+ }, CHAT_MARKE)+}++// Gegenprobe 01.10.2026: Chat, Code, Chat landed on an empty page and the app+// started empty after a Code session. Both now go back to the chat worked on last.+test('the Chat button goes back to the chat, and so does the start after a Code session', async ({ page }) => {+ await page.setViewportSize({ width: 1280, height: 800 })+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME })+ await seedOnboardingDone(page)+ await page.goto('/')+ await expect(page.getByRole('button', { name: 'New Chat' }).first()).toBeVisible()+ await chatVerlauf(page)+ await page.getByRole('button', { name: 'Code', exact: true }).click()+ await openNewChat(page)+ await codeVerlauf(page)+ await expect(page.getByTestId('codex-transcript').getByText(MARKE)).toBeVisible()++ await page.locator('button[title="Chat"][aria-label="Chat"]').first().click()+ await expect(page.getByText(CHAT_MARKE)).toBeVisible()+ await expect(page.getByText(MARKE)).toHaveCount(0)++ // Leave in Code, start again: the Chat tab opens on the same chat.+ await page.getByRole('button', { name: 'Code', exact: true }).click()+ await expect(page.getByTestId('codex-transcript').getByText(MARKE)).toBeVisible()+ await page.reload()+ await expect(page.getByText(CHAT_MARKE)).toBeVisible()+ await expect(page.getByTestId('codex-transcript')).toHaveCount(0)+})diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsxindex 3ecd7d6c..388eac2d 100644--- a/src/components/layout/Sidebar.tsx+++ b/src/components/layout/Sidebar.tsx@@ -433,7 +433,7 @@ export function Sidebar() {</button><div className="w-6 h-px bg-gray-200 dark:bg-white/10 my-1" /><button- onClick={() => { setChatMode('lu'); setActiveConversation(null); setView('chat'); setDispatchPicker(false) }}+ onClick={() => { setChatMode('lu'); setActiveConversation(latestConversationOfMode(useChatStore.getState().conversations, 'lu')); setView('chat'); setDispatchPicker(false) }}title="Chat"aria-label="Chat"className={railBtn(!isCodingMode && !isRemoteMode)}@@ -589,7 +589,7 @@ export function Sidebar() {</button>{/* Chat tab */}<button- onClick={() => { setChatMode('lu'); setActiveConversation(null); setView('chat'); setDispatchPicker(false) }}+ onClick={() => { setChatMode('lu'); setActiveConversation(latestConversationOfMode(useChatStore.getState().conversations, 'lu')); setView('chat'); setDispatchPicker(false) }}title="Chat"aria-label="Chat"className={`flex items-center gap-1.25 justify-center px-2.5 h-[var(--control-h-md)] rounded-[5px] font-medium transition-all flex-1 min-w-0 ${diff --git a/src/lib/__tests__/conversation-opens-in-its-own-tab.test.ts b/src/lib/__tests__/conversation-opens-in-its-own-tab.test.tsindex 825c139e..7300b667 100644--- a/src/lib/__tests__/conversation-opens-in-its-own-tab.test.ts+++ b/src/lib/__tests__/conversation-opens-in-its-own-tab.test.ts@@ -15,18 +15,22 @@ const convs = []describe('activeConversationAtStart', () => {- it('drops a Code conversation, the app starts in the Chat tab', () => {- expect(activeConversationAtStart(convs, 'code-new')).toBeNull()+ // 01.10.2026: instead of the empty page, the chat worked on last.+ it('a Code conversation gives way to the chat worked on last, the app starts in the Chat tab', () => {+ expect(activeConversationAtStart(convs, 'code-new')).toBe('legacy')})- it('drops any conversation of another tab', () => {- expect(activeConversationAtStart(convs, 'remote')).toBeNull()+ it('so does any conversation of another tab', () => {+ expect(activeConversationAtStart(convs, 'remote')).toBe('legacy')+ })+ it('with no chat at all it is the empty page', () => {+ expect(activeConversationAtStart([{ id: 'c', mode: 'codex', updatedAt: 1 }], 'c')).toBeNull()})it('keeps a chat, also one saved before conversations had a mode', () => {expect(activeConversationAtStart(convs, 'chat-old')).toBe('chat-old')expect(activeConversationAtStart(convs, 'legacy')).toBe('legacy')})- it('drops an id that no longer exists', () => {- expect(activeConversationAtStart(convs, 'gone')).toBeNull()+ it('an id that no longer exists opens the last chat, nothing active stays nothing', () => {+ expect(activeConversationAtStart(convs, 'gone')).toBe('legacy')expect(activeConversationAtStart(convs, null)).toBeNull()})})diff --git a/src/lib/conversation-mode.ts b/src/lib/conversation-mode.tsindex df2a9ee3..ba231798 100644--- a/src/lib/conversation-mode.ts+++ b/src/lib/conversation-mode.ts@@ -42,19 +42,25 @@ export function conversationMode(* rendered it as a plain chat with Agent off, and a "continue" typed there* went out without any tools (Gegenprobe on the real build, 30.09.2026). A* conversation that belongs to another tab therefore does not survive the- * start; the app opens on the empty chat, as it does for a newcomer.+ * start; the app opens on the chat worked on last instead, so a returning+ * user is where they left the Chat tab (Gegenprobe 01.10.2026: it opened+ * empty). Nothing active stays nothing active, and so does a newcomer.*/export function activeConversationAtStart(- conversations: ReadonlyArray<{ id: string } & ConversationModeSource>,+ conversations: ReadonlyArray<{ id: string; updatedAt?: number } & ConversationModeSource>,activeId: string | null | undefined,): string | null {if (!activeId) return nullconst conv = conversations.find((c) => c.id === activeId)- return conv && conversationMode(conv) === 'lu' ? activeId : null+ if (conv && conversationMode(conv) === 'lu') return activeId+ return latestConversationOfMode(conversations, 'lu')}/**- * The Code conversation the Code button returns to: the one worked on last.+ * The conversation the Code button (mode 'codex') and the Chat button (mode+ * 'lu') return to: the one worked on last. For Chat since 01.10.2026: Chat,+ * Code, Chat landed on an empty page while the chat was one click away.+ * "New Chat" is the way to an empty one.* The button used to clear the active conversation, so going to Chat and* back to Code while a run was in flight landed on the empty start page and* the running conversation had to be found in the list.