fix(chat): move toolbar to Header and add New Session button

- Move ChatToolbar (session selector, refresh, thinking toggle) from
  the Chat page body into the Header component, so controls appear
  at the same level as the "Chat" title
- Add New Session button (+) to create a fresh conversation
- Add newSession action to chat store
- Header conditionally renders ChatToolbar only on /chat route
- Chat page fills full content area without duplicate toolbar
This commit is contained in:
Haze
2026-02-06 04:57:25 +08:00
Unverified
parent 3468d1bdf4
commit 94a6cecf2f
4 changed files with 43 additions and 15 deletions

View File

@@ -10,7 +10,6 @@ import { Card, CardContent } from '@/components/ui/card';
import { useChatStore } from '@/stores/chat';
import { useGatewayStore } from '@/stores/gateway';
import { LoadingSpinner } from '@/components/common/LoadingSpinner';
import { ChatToolbar } from './ChatToolbar';
import { ChatMessage } from './ChatMessage';
import { ChatInput } from './ChatInput';
import { extractText } from './message-utils';
@@ -63,13 +62,7 @@ export function Chat() {
const streamText = streamingMessage ? extractText(streamingMessage) : '';
return (
<div className="flex h-[calc(100vh-4rem)] flex-col">
{/* Toolbar: session selector, refresh, thinking toggle */}
<div className="flex items-center justify-between px-4 py-2 border-b">
<div /> {/* spacer */}
<ChatToolbar />
</div>
<div className="flex flex-col -m-6" style={{ height: 'calc(100vh - 3.5rem)' }}>
{/* Messages Area */}
<div className="flex-1 overflow-y-auto px-4 py-4">
<div className="max-w-4xl mx-auto space-y-4">