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: Render placeholder thread title until summary is generated (#22723)

Danilo Lealc74e5f5de20b
diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs
index 7e229251ef3..4c7a1f97e7a 100644
--- a/crates/assistant2/src/assistant_panel.rs
+++ b/crates/assistant2/src/assistant_panel.rs
@@ -300,6 +300,15 @@ impl AssistantPanel {
fn render_toolbar(&self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let focus_handle = self.focus_handle(cx);
+ let title = if self.thread.read(cx).is_empty() {
+ SharedString::from("New Thread")
+ } else {
+ self.thread
+ .read(cx)
+ .summary(cx)
+ .unwrap_or_else(|| SharedString::from("Loading Summary…"))
+ };
+
h_flex()
.id("assistant-toolbar")
.justify_between()
@@ -309,7 +318,7 @@ impl AssistantPanel {
.bg(cx.theme().colors().tab_bar_background)
.border_b_1()
.border_color(cx.theme().colors().border)
- .child(h_flex().children(self.thread.read(cx).summary(cx).map(Label::new)))
+ .child(h_flex().child(Label::new(title)))
.child(
h_flex()
.h_full()