Story 20: New Session button to clear chat history
- Added 'New Session' button in header with confirmation dialog - Clears frontend messages, streaming content, and loading state - Button has subtle styling with hover effects - Preserves project path, model selection, and tool settings - Backend context automatically cleared (no server-side history) - Fixed build errors by removing unused tokio watch channel - All quality checks passing (TypeScript, Biome, Clippy, builds) Tested and verified: - Button appears in header near model controls - Confirmation dialog prevents accidental clearing - Messages clear immediately after confirmation - Input remains ready for new conversation - Settings preserved across session clears
This commit is contained in:
39
.living_spec/stories/archive/20_start_new_session.md
Normal file
39
.living_spec/stories/archive/20_start_new_session.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Story 20: Start New Session / Clear Chat History
|
||||
|
||||
## User Story
|
||||
As a user, I want to be able to start a fresh conversation without restarting the entire application, so that I can begin a new task with completely clean context (both frontend and backend) while keeping the same project open.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [x] There is a visible "New Session" or "Clear Chat" button in the UI
|
||||
- [x] Clicking the button clears all messages from the chat history (frontend)
|
||||
- [x] The backend conversation context is also cleared (no message history retained)
|
||||
- [x] The input field remains enabled and ready for a new message
|
||||
- [x] The button asks for confirmation before clearing (to prevent accidental data loss)
|
||||
- [x] After clearing, the chat shows an empty state or welcome message
|
||||
- [x] The project path and model settings are preserved (only messages are cleared)
|
||||
- [x] Any ongoing streaming or tool execution is cancelled before clearing
|
||||
- [x] The action is immediate and provides visual feedback
|
||||
|
||||
## Out of Scope
|
||||
- Saving/exporting previous sessions before clearing
|
||||
- Multiple concurrent chat sessions or tabs
|
||||
- Undo functionality after clearing
|
||||
- Automatic session management or limits
|
||||
- Session history or recovery
|
||||
|
||||
## Technical Notes
|
||||
- Frontend state (`messages` and `streamingContent`) needs to be cleared
|
||||
- Backend conversation history must be cleared (no retained context from previous messages)
|
||||
- Backend may need a `clear_session` or `reset_context` command
|
||||
- Cancel any in-flight operations before clearing
|
||||
- Should integrate with the cancellation mechanism from Story 13 (if implemented)
|
||||
- Button should be placed in the header area near the model selector
|
||||
- Consider using a modal dialog for confirmation
|
||||
- State: `setMessages([])` to clear the frontend array
|
||||
- Backend: Clear the message history that gets sent to the LLM
|
||||
|
||||
## Design Considerations
|
||||
- Button placement: Header area (top right or near model controls)
|
||||
- Button style: Secondary/subtle to avoid accidental clicks
|
||||
- Confirmation dialog: "Are you sure? This will clear all messages and reset the conversation context."
|
||||
- Icon suggestion: 🔄 or "New" text label
|
||||
Reference in New Issue
Block a user