mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
assistant2: Add floating indicator when a response is streaming (#23096)
This PR adds a separate indicator at the bottom of the thread that shows when a response is being streamed (as well as how to cancel it): <img width="1309" alt="Screenshot 2025-01-13 at 4 19 07 PM" src="https://github.com/user-attachments/assets/b64f785b-d522-458d-b915-3f604890597f" /> Release Notes: - N/A
This commit is contained in:
parent
ae103fdf64
commit
830f45e56a
1 changed files with 25 additions and 2 deletions
|
@ -344,7 +344,30 @@ impl ActiveThread {
|
|||
}
|
||||
|
||||
impl Render for ActiveThread {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
list(self.list_state.clone()).flex_1().py_1()
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let is_streaming_completion = self.thread.read(cx).is_streaming();
|
||||
|
||||
v_flex()
|
||||
.size_full()
|
||||
.child(list(self.list_state.clone()).flex_grow())
|
||||
.child(
|
||||
h_flex()
|
||||
.absolute()
|
||||
.bottom_1()
|
||||
.flex_shrink()
|
||||
.justify_center()
|
||||
.w_full()
|
||||
.when(is_streaming_completion, |parent| {
|
||||
parent.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.p_1p5()
|
||||
.rounded_md()
|
||||
.bg(cx.theme().colors().elevated_surface_background)
|
||||
.child(Label::new("Generating…").size(LabelSize::Small))
|
||||
.child(Label::new("esc to cancel").size(LabelSize::Small)),
|
||||
)
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue