assistant2: Adjust tool call accordion visuals (#25749)

Just fine-tuning it a bit more.

<img
src="https://github.com/user-attachments/assets/0d46af77-d111-40a3-9204-d5d8aa9d4886"
width="700px"/>

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-02-27 11:33:37 -03:00 committed by GitHub
parent 1f52aab7c7
commit 73ab5abee1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -396,26 +396,25 @@ impl ActiveThread {
.copied() .copied()
.unwrap_or_default(); .unwrap_or_default();
v_flex().px_2p5().child( div().px_2p5().child(
v_flex() v_flex()
.gap_1() .gap_1()
.bg(cx.theme().colors().editor_background)
.rounded_lg() .rounded_lg()
.border_1() .border_1()
.border_color(cx.theme().colors().border) .border_color(cx.theme().colors().border)
.shadow_sm()
.child( .child(
h_flex() h_flex()
.justify_between() .justify_between()
.py_1() .py_0p5()
.px_2() .pl_1()
.bg(cx.theme().colors().editor_foreground.opacity(0.05)) .pr_2()
.when(is_open, |element| element.border_b_1()) .bg(cx.theme().colors().editor_foreground.opacity(0.02))
.when(is_open, |element| element.border_b_1().rounded_t(px(6.)))
.when(!is_open, |element| element.rounded(px(6.)))
.border_color(cx.theme().colors().border) .border_color(cx.theme().colors().border)
.rounded_t(px(6.))
.child( .child(
h_flex() h_flex()
.gap_2() .gap_1()
.child(Disclosure::new("tool-use-disclosure", is_open).on_click( .child(Disclosure::new("tool-use-disclosure", is_open).on_click(
cx.listener({ cx.listener({
let tool_use_id = tool_use.id.clone(); let tool_use_id = tool_use.id.clone();
@ -431,12 +430,16 @@ impl ActiveThread {
)) ))
.child(Label::new(tool_use.name)), .child(Label::new(tool_use.name)),
) )
.child(Label::new(match tool_use.status { .child(
Label::new(match tool_use.status {
ToolUseStatus::Pending => "Pending", ToolUseStatus::Pending => "Pending",
ToolUseStatus::Running => "Running", ToolUseStatus::Running => "Running",
ToolUseStatus::Finished(_) => "Finished", ToolUseStatus::Finished(_) => "Finished",
ToolUseStatus::Error(_) => "Error", ToolUseStatus::Error(_) => "Error",
})), })
.size(LabelSize::XSmall)
.buffer_font(cx),
),
) )
.map(|parent| { .map(|parent| {
if !is_open { if !is_open {
@ -445,11 +448,13 @@ impl ActiveThread {
parent.child( parent.child(
v_flex() v_flex()
.gap_2()
.p_2p5()
.child( .child(
v_flex() v_flex()
.gap_0p5() .gap_0p5()
.py_1()
.px_2p5()
.border_b_1()
.border_color(cx.theme().colors().border)
.child(Label::new("Input:")) .child(Label::new("Input:"))
.child(Label::new( .child(Label::new(
serde_json::to_string_pretty(&tool_use.input) serde_json::to_string_pretty(&tool_use.input)
@ -460,12 +465,16 @@ impl ActiveThread {
ToolUseStatus::Finished(output) => parent.child( ToolUseStatus::Finished(output) => parent.child(
v_flex() v_flex()
.gap_0p5() .gap_0p5()
.py_1()
.px_2p5()
.child(Label::new("Result:")) .child(Label::new("Result:"))
.child(Label::new(output)), .child(Label::new(output)),
), ),
ToolUseStatus::Error(err) => parent.child( ToolUseStatus::Error(err) => parent.child(
v_flex() v_flex()
.gap_0p5() .gap_0p5()
.py_1()
.px_2p5()
.child(Label::new("Error:")) .child(Label::new("Error:"))
.child(Label::new(err)), .child(Label::new(err)),
), ),