Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant2: Only show the streaming indicator on the last Assistant message (#23090)

Marshall Bowersc599ba64bc3c
diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs
index 58dc92ebe2c..5ef33c9352c 100644
--- a/crates/assistant2/src/active_thread.rs
+++ b/crates/assistant2/src/active_thread.rs
@@ -242,6 +242,7 @@ impl ActiveThread {
fn render_message(&self, ix: usize, cx: &mut ViewContext<Self>) -> AnyElement {
let message_id = self.messages[ix];
+ let is_last_message = ix == self.messages.len() - 1;
let Some(message) = self.thread.read(cx).message(message_id) else {
return Empty.into_any();
};
@@ -294,7 +295,9 @@ impl ActiveThread {
)
.child(div().p_2p5().text_ui(cx).child(markdown.clone()))
.when(
- message.role == Role::Assistant && is_streaming_completion,
+ message.role == Role::Assistant
+ && is_last_message
+ && is_streaming_completion,
|parent| {
parent.child(
h_flex()