cleaner session changing

This commit is contained in:
Tyler Longwell
2025-11-30 11:10:50 -05:00
parent 45cffaf6fd
commit f377a663cc
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -506,12 +506,14 @@ impl Component for ChatComponent {
self.last_width = area.width;
}
// If state cleared (new session), clear cache
// If state cleared (new session), clear cache and reset scroll
if state.messages.len() < self.sealed_count {
self.cached_items.clear();
self.cached_mapping.clear();
self.sealed_count = 0;
self.last_tool_context.clear();
self.list_state = ListState::default();
self.stick_to_bottom = true;
}
// Determine how many messages are "sealed"
+2
View File
@@ -106,6 +106,8 @@ fn handle_chat(state: &mut AppState, action: &Action) -> bool {
Action::CreateNewSession | Action::ResumeSession(_) | Action::ForkFromMessage(_) => {
state.is_working = true;
state.active_popup = ActivePopup::None;
state.messages.clear();
state.todos.clear();
true
}
Action::Error(e) => {