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:
parent
55ecb3c51b
commit
a30ea2fc68
5 changed files with 396 additions and 291 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue