Skip to content

Commit d884719

Browse files
thread view: Adjust thinking block UI (#36958)
Release Notes: - N/A Co-authored-by: Conrad Irwin <[email protected]>
1 parent bd4e943 commit d884719

File tree

1 file changed

+30
-47
lines changed

1 file changed

+30
-47
lines changed

crates/agent_ui/src/acp/thread_view.rs

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,47 +1644,41 @@ impl AcpThreadView {
16441644
let key = (entry_ix, chunk_ix);
16451645

16461646
let is_open = self.expanded_thinking_blocks.contains(&key);
1647-
let editor_bg = cx.theme().colors().editor_background;
1648-
let gradient_overlay = div()
1649-
.rounded_b_lg()
1650-
.h_full()
1651-
.absolute()
1652-
.w_full()
1653-
.bottom_0()
1654-
.left_0()
1655-
.bg(linear_gradient(
1656-
180.,
1657-
linear_color_stop(editor_bg, 1.),
1658-
linear_color_stop(editor_bg.opacity(0.2), 0.),
1659-
));
16601647

16611648
let scroll_handle = self
16621649
.entry_view_state
16631650
.read(cx)
16641651
.entry(entry_ix)
16651652
.and_then(|entry| entry.scroll_handle_for_assistant_message_chunk(chunk_ix));
16661653

1654+
let thinking_content = {
1655+
div()
1656+
.id(("thinking-content", chunk_ix))
1657+
.when_some(scroll_handle, |this, scroll_handle| {
1658+
this.track_scroll(&scroll_handle)
1659+
})
1660+
.when(!is_open, |this| this.max_h_12().opacity(0.6))
1661+
.text_ui_sm(cx)
1662+
.overflow_hidden()
1663+
.child(
1664+
self.render_markdown(chunk, default_markdown_style(false, false, window, cx)),
1665+
)
1666+
};
1667+
16671668
v_flex()
1668-
.rounded_md()
1669-
.border_1()
1670-
.border_color(self.tool_card_border_color(cx))
1669+
.gap_1()
16711670
.child(
16721671
h_flex()
16731672
.id(header_id)
16741673
.group(&card_header_id)
16751674
.relative()
16761675
.w_full()
1677-
.py_0p5()
1678-
.px_1p5()
1679-
.rounded_t_md()
1680-
.bg(self.tool_card_header_bg(cx))
16811676
.justify_between()
1682-
.border_b_1()
1683-
.border_color(self.tool_card_border_color(cx))
16841677
.child(
16851678
h_flex()
16861679
.h(window.line_height())
16871680
.gap_1p5()
1681+
.overflow_hidden()
16881682
.child(
16891683
Icon::new(IconName::ToolThink)
16901684
.size(IconSize::Small)
@@ -1698,7 +1692,7 @@ impl AcpThreadView {
16981692
if pending {
16991693
this.child("Thinking")
17001694
} else {
1701-
this.child("Thought Process")
1695+
this.child("Thought")
17021696
}
17031697
}),
17041698
),
@@ -1730,28 +1724,17 @@ impl AcpThreadView {
17301724
}
17311725
})),
17321726
)
1733-
.child(
1734-
div()
1735-
.relative()
1736-
.bg(editor_bg)
1737-
.rounded_b_lg()
1738-
.child(
1739-
div()
1740-
.id(("thinking-content", chunk_ix))
1741-
.when_some(scroll_handle, |this, scroll_handle| {
1742-
this.track_scroll(&scroll_handle)
1743-
})
1744-
.p_2()
1745-
.when(!is_open, |this| this.max_h_20())
1746-
.text_ui_sm(cx)
1747-
.overflow_hidden()
1748-
.child(self.render_markdown(
1749-
chunk,
1750-
default_markdown_style(false, false, window, cx),
1751-
)),
1752-
)
1753-
.when(!is_open && pending, |this| this.child(gradient_overlay)),
1754-
)
1727+
.when(is_open, |this| {
1728+
this.child(
1729+
div()
1730+
.relative()
1731+
.ml_1p5()
1732+
.pl_3p5()
1733+
.border_l_1()
1734+
.border_color(self.tool_card_border_color(cx))
1735+
.child(thinking_content),
1736+
)
1737+
})
17551738
.into_any_element()
17561739
}
17571740

@@ -1924,7 +1907,7 @@ impl AcpThreadView {
19241907
.when(has_location || use_card_layout, |this| this.px_1())
19251908
.when(has_location, |this| {
19261909
this.cursor(CursorStyle::PointingHand)
1927-
.rounded_sm()
1910+
.rounded(rems_from_px(3.)) // Concentric border radius
19281911
.hover(|s| s.bg(cx.theme().colors().element_hover.opacity(0.5)))
19291912
})
19301913
.overflow_hidden()
@@ -4247,7 +4230,7 @@ impl AcpThreadView {
42474230
return h_flex().id("thread-controls-container").child(
42484231
div()
42494232
.py_2()
4250-
.px_5()
4233+
.px(rems_from_px(22.))
42514234
.child(SpinnerLabel::new().size(LabelSize::Small)),
42524235
);
42534236
}

0 commit comments

Comments
 (0)