Send full conversation history with each API request so the AI maintains context across exchanges. Add "New Chat" button to clear the conversation and start fresh. No persistent storage — session resets on page reload. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
## Context
|
|
|
|
Chat.razor currently constructs a `ChatRequest` with only the latest user message (line 161-164). The backend and Responses API already support multi-message input — no server changes needed. This is purely a client-side change.
|
|
|
|
## Goals / Non-Goals
|
|
|
|
**Goals:**
|
|
- Send full conversation history with each request for multi-turn context
|
|
- Add a "New Chat" button to reset the session
|
|
|
|
**Non-Goals:**
|
|
- Persistent conversation storage (explicitly deferred)
|
|
- Multiple conversation tabs/sidebar
|
|
- Token limit management or history truncation (small conversations for now)
|
|
|
|
## Decisions
|
|
|
|
### Decision 1: Send full _messages list minus the empty placeholder
|
|
|
|
When building the `ChatRequest`, include all messages from `_messages` except the last one (which is the empty assistant placeholder waiting for streaming). This gives the AI the full conversation context.
|
|
|
|
### Decision 2: New Chat button in the AppBar
|
|
|
|
Place a "New Chat" icon button in the `MudAppBar` (in MainLayout.razor or Chat.razor). Clicking it clears `_messages` and resets to the empty state. Disabled during streaming.
|
|
|
|
Alternative considered: putting it in the input area. Rejected — the AppBar is more natural and matches ChatGPT/Gemini placement.
|
|
|
|
## Risks / Trade-offs
|
|
|
|
- [No token limit management] → For long conversations, the full history could exceed the model's context window. Acceptable for now; truncation can be added later.
|