assistant2: Factor out ActiveThread view (#21555)

This PR factors a new `ActiveThread` view out of the `AssistantPanel` to
group together the state that pertains solely to the active view.

There was a bunch of related state on the `AssistantPanel` pertaining to
the active thread that needed to be initialized/reset together and it
makes for a clearer narrative is this state is encapsulated in its own
view.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-12-04 16:39:39 -05:00 committed by GitHub
parent 55ecb3c51b
commit a30ea2fc68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 396 additions and 291 deletions

View file

@ -52,8 +52,13 @@ impl ThreadStore {
})
}
pub fn recent_threads(&self, limit: usize, _cx: &ModelContext<Self>) -> Vec<Model<Thread>> {
self.threads.iter().take(limit).cloned().collect()
pub fn recent_threads(&self, limit: usize, cx: &ModelContext<Self>) -> Vec<Model<Thread>> {
self.threads
.iter()
.filter(|thread| !thread.read(cx).is_empty())
.take(limit)
.cloned()
.collect()
}
pub fn create_thread(&mut self, cx: &mut ModelContext<Self>) -> Model<Thread> {