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:
Dave
2025-12-27 17:01:55 +00:00
parent 64d1b788be
commit b3dd5f5670
7 changed files with 131 additions and 43 deletions

View File

@@ -23,7 +23,6 @@ pub fn run() {
commands::search::search_files,
commands::shell::exec_shell,
commands::chat::chat,
commands::chat::cancel_chat,
commands::chat::get_ollama_models
])
.run(tauri::generate_context!())

View File

@@ -1,20 +1,14 @@
use std::path::PathBuf;
use std::sync::Mutex;
use tokio::sync::watch;
pub struct SessionState {
pub project_root: Mutex<Option<PathBuf>>,
pub cancel_tx: watch::Sender<bool>,
pub cancel_rx: watch::Receiver<bool>,
}
impl Default for SessionState {
fn default() -> Self {
let (cancel_tx, cancel_rx) = watch::channel(false);
Self {
project_root: Mutex::new(None),
cancel_tx,
cancel_rx,
}
}
}