From c599ba64bc3c87635df76c47b0dd7b5cb5632c40 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 13 Jan 2025 16:09:01 -0500 Subject: [PATCH] assistant2: Only show the streaming indicator on the last Assistant message (#23090) This PR is a follow-up to #23078 to ensure that the streaming indicator only shows up on the last Assistant message. Release Notes: - N/A --- crates/assistant2/src/active_thread.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index 58dc92ebe2..5ef33c9352 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) -> 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()