agent: Use a banner for the auto-retry message (#33661)
Follow-up to https://github.com/zed-industries/zed/pull/33275 so we use the Banner component to display the auto-retry messages in the thread. Release Notes: - N/A
This commit is contained in:
parent
6e77e8405b
commit
3db452eec7
1 changed files with 15 additions and 33 deletions
|
@ -47,8 +47,8 @@ use std::time::Duration;
|
||||||
use text::ToPoint;
|
use text::ToPoint;
|
||||||
use theme::ThemeSettings;
|
use theme::ThemeSettings;
|
||||||
use ui::{
|
use ui::{
|
||||||
Disclosure, KeyBinding, PopoverMenuHandle, Scrollbar, ScrollbarState, TextSize, Tooltip,
|
Banner, Disclosure, KeyBinding, PopoverMenuHandle, Scrollbar, ScrollbarState, TextSize,
|
||||||
prelude::*,
|
Tooltip, prelude::*,
|
||||||
};
|
};
|
||||||
use util::ResultExt as _;
|
use util::ResultExt as _;
|
||||||
use util::markdown::MarkdownCodeBlock;
|
use util::markdown::MarkdownCodeBlock;
|
||||||
|
@ -58,6 +58,7 @@ use zed_llm_client::CompletionIntent;
|
||||||
|
|
||||||
const CODEBLOCK_CONTAINER_GROUP: &str = "codeblock_container";
|
const CODEBLOCK_CONTAINER_GROUP: &str = "codeblock_container";
|
||||||
const EDIT_PREVIOUS_MESSAGE_MIN_LINES: usize = 1;
|
const EDIT_PREVIOUS_MESSAGE_MIN_LINES: usize = 1;
|
||||||
|
const RESPONSE_PADDING_X: Pixels = px(19.);
|
||||||
|
|
||||||
pub struct ActiveThread {
|
pub struct ActiveThread {
|
||||||
context_store: Entity<ContextStore>,
|
context_store: Entity<ContextStore>,
|
||||||
|
@ -1874,9 +1875,6 @@ impl ActiveThread {
|
||||||
this.scroll_to_top(cx);
|
this.scroll_to_top(cx);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// For all items that should be aligned with the LLM's response.
|
|
||||||
const RESPONSE_PADDING_X: Pixels = px(19.);
|
|
||||||
|
|
||||||
let show_feedback = thread.is_turn_end(ix);
|
let show_feedback = thread.is_turn_end(ix);
|
||||||
let feedback_container = h_flex()
|
let feedback_container = h_flex()
|
||||||
.group("feedback_container")
|
.group("feedback_container")
|
||||||
|
@ -2537,34 +2535,18 @@ impl ActiveThread {
|
||||||
ix: usize,
|
ix: usize,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Stateful<Div> {
|
) -> Stateful<Div> {
|
||||||
let colors = cx.theme().colors();
|
let message = div()
|
||||||
div().id(("message-container", ix)).py_1().px_2().child(
|
|
||||||
v_flex()
|
|
||||||
.w_full()
|
|
||||||
.bg(colors.editor_background)
|
|
||||||
.rounded_sm()
|
|
||||||
.child(
|
|
||||||
h_flex()
|
|
||||||
.w_full()
|
|
||||||
.p_2()
|
|
||||||
.gap_2()
|
|
||||||
.child(
|
|
||||||
div().flex_none().child(
|
|
||||||
Icon::new(IconName::Warning)
|
|
||||||
.size(IconSize::Small)
|
|
||||||
.color(Color::Warning),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
v_flex()
|
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.min_w_0()
|
.min_w_0()
|
||||||
.text_size(TextSize::Small.rems(cx))
|
.text_size(TextSize::XSmall.rems(cx))
|
||||||
.text_color(cx.theme().colors().text_muted)
|
.text_color(cx.theme().colors().text_muted)
|
||||||
.children(message_content),
|
.children(message_content);
|
||||||
),
|
|
||||||
),
|
div()
|
||||||
)
|
.id(("message-container", ix))
|
||||||
|
.py_1()
|
||||||
|
.px_2p5()
|
||||||
|
.child(Banner::new().severity(ui::Severity::Warning).child(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_message_thinking_segment(
|
fn render_message_thinking_segment(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue