From ec91a8dc82b337ec9ceee55ffbb24645173a33ed Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 23 Jan 2025 16:54:16 -0500 Subject: [PATCH] assistant2: Expose `ActiveThread::thread` via a getter (#23577) This PR exposes the `thread` file on the `ActiveThread` via a getter rather than exposing the field directly. Release Notes: - N/A --- crates/assistant2/src/active_thread.rs | 6 +++++- crates/assistant2/src/assistant_panel.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index e87bae48cc..948ac37bac 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -22,7 +22,7 @@ pub struct ActiveThread { workspace: WeakView, language_registry: Arc, tools: Arc, - pub(crate) thread: Model, + thread: Model, messages: Vec, list_state: ListState, rendered_messages_by_id: HashMap>, @@ -68,6 +68,10 @@ impl ActiveThread { this } + pub fn thread(&self) -> &Model { + &self.thread + } + pub fn is_empty(&self) -> bool { self.messages.is_empty() } diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index fefbc49c4d..d98e238613 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -432,7 +432,7 @@ impl AssistantPanel { } pub(crate) fn active_thread(&self, cx: &AppContext) -> Model { - self.thread.read(cx).thread.clone() + self.thread.read(cx).thread().clone() } pub(crate) fn delete_thread(&mut self, thread_id: &ThreadId, cx: &mut ViewContext) {