mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
assistant2: Render placeholder thread title until summary is generated (#22723)
This PR ensures we render a "New Thread" placeholder title until a message has been sent, and thus, a summary is generated. https://github.com/user-attachments/assets/1c30e0ff-baaa-44ad-a1a2-42f1ce9fe0b0 Release Notes: - N/A
This commit is contained in:
parent
2023c43681
commit
c74e5f5de2
1 changed files with 10 additions and 1 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue