mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
cleaner session changing
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user