Files
storkit/.living_spec/stories/20_start_new_session.md
Dave 64d1b788be Story 18: Token-by-token streaming responses
- Backend: Added OllamaProvider::chat_stream() with newline-delimited JSON parsing
- Backend: Emit chat:token events for each token received from Ollama
- Backend: Added futures dependency and stream feature for reqwest
- Frontend: Added streamingContent state and chat:token event listener
- Frontend: Real-time token display with auto-scroll
- Frontend: Markdown and syntax highlighting support for streaming content
- Fixed all TypeScript errors (tsc --noEmit)
- Fixed all Biome warnings and errors
- Fixed all Clippy warnings
- Added comprehensive code quality documentation
- Added tsc --noEmit to verification checklist

Tested and verified:
- Tokens stream in real-time
- Auto-scroll works during streaming
- Tool calls interrupt streaming correctly
- Multi-turn conversations work
- Smooth performance with no lag
2025-12-27 16:50:18 +00:00

1.7 KiB

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 clean context while keeping the same project open.

Acceptance Criteria

  • There is a visible "New Session" or "Clear Chat" button in the UI
  • Clicking the button clears all messages from the chat history
  • The input field remains enabled and ready for a new message
  • The button asks for confirmation before clearing (to prevent accidental data loss)
  • After clearing, the chat shows an empty state or welcome message
  • The project path and model settings are preserved (only messages are cleared)
  • Any ongoing streaming or tool execution is cancelled before clearing
  • 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) needs to be cleared
  • Backend may need to be notified to cancel any in-flight operations
  • 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 array

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."
  • Icon suggestion: 🔄 or "New" text label