Thinking block UI pass

This commit is contained in:
Danilo Leal 2025-08-26 11:37:36 -03:00
parent 698d6557e1
commit b61b62ac25

View file

@ -20,11 +20,11 @@ use file_icons::FileIcons;
use fs::Fs; use fs::Fs;
use gpui::{ use gpui::{
Action, Animation, AnimationExt, AnyView, App, BorderStyle, ClickEvent, ClipboardItem, Action, Animation, AnimationExt, AnyView, App, BorderStyle, ClickEvent, ClipboardItem,
EdgesRefinement, ElementId, Empty, Entity, FocusHandle, Focusable, Hsla, Length, ListOffset, CursorStyle, EdgesRefinement, ElementId, Empty, Entity, FocusHandle, Focusable, Hsla, Length,
ListState, MouseButton, PlatformDisplay, SharedString, Stateful, StyleRefinement, Subscription, ListOffset, ListState, MouseButton, PlatformDisplay, SharedString, Stateful, StyleRefinement,
Task, TextStyle, TextStyleRefinement, Transformation, UnderlineStyle, WeakEntity, Window, Subscription, Task, TextStyle, TextStyleRefinement, Transformation, UnderlineStyle, WeakEntity,
WindowHandle, div, ease_in_out, linear_color_stop, linear_gradient, list, percentage, point, Window, WindowHandle, div, ease_in_out, linear_color_stop, linear_gradient, list, percentage,
prelude::*, pulsating_between, point, prelude::*, pulsating_between,
}; };
use language::Buffer; use language::Buffer;
@ -66,7 +66,6 @@ use crate::{
KeepAll, OpenAgentDiff, OpenHistory, RejectAll, ToggleBurnMode, ToggleProfileSelector, KeepAll, OpenAgentDiff, OpenHistory, RejectAll, ToggleBurnMode, ToggleProfileSelector,
}; };
const RESPONSE_PADDING_X: Pixels = px(19.);
pub const MIN_EDITOR_LINES: usize = 4; pub const MIN_EDITOR_LINES: usize = 4;
pub const MAX_EDITOR_LINES: usize = 8; pub const MAX_EDITOR_LINES: usize = 8;
@ -1533,7 +1532,7 @@ impl AcpThreadView {
AgentThreadEntry::ToolCall(tool_call) => { AgentThreadEntry::ToolCall(tool_call) => {
let has_terminals = tool_call.terminals().next().is_some(); let has_terminals = tool_call.terminals().next().is_some();
div().w_full().py_1().px_5().map(|this| { div().w_full().map(|this| {
if has_terminals { if has_terminals {
this.children(tool_call.terminals().map(|terminal| { this.children(tool_call.terminals().map(|terminal| {
self.render_terminal_tool_call( self.render_terminal_tool_call(
@ -1618,37 +1617,38 @@ impl AcpThreadView {
let is_open = self.expanded_thinking_blocks.contains(&key); let is_open = self.expanded_thinking_blocks.contains(&key);
v_flex() v_flex()
// .debug_bg_cyan()
.child( .child(
h_flex() h_flex()
.id(header_id) .id(header_id)
.group(&card_header_id) .group(&card_header_id)
.pr_1() // Ensure disclosure button is aligned with tool call disclosures
.relative() .relative()
.w_full() .w_full()
.gap_1p5() .justify_between()
.child( .child(
h_flex() h_flex()
.size_4() .h(window.line_height())
.justify_center() .gap_1p5()
.child(
div()
.group_hover(&card_header_id, |s| s.invisible().w_0())
.child( .child(
// div().debug_bg_magenta().child(
Icon::new(IconName::ToolThink) Icon::new(IconName::ToolThink)
.size(IconSize::Small) .size(IconSize::Small)
.color(Color::Muted), .color(Color::Muted),
// ),
)
.child(
div()
.text_size(self.tool_name_font_size())
.text_color(cx.theme().colors().text_muted)
.child("Thinking"),
), ),
) )
.child(
h_flex()
.absolute()
.inset_0()
.invisible()
.justify_center()
.group_hover(&card_header_id, |s| s.visible())
.child( .child(
Disclosure::new(("expand", entry_ix), is_open) Disclosure::new(("expand", entry_ix), is_open)
.opened_icon(IconName::ChevronUp) .opened_icon(IconName::ChevronUp)
.closed_icon(IconName::ChevronRight) .closed_icon(IconName::ChevronDown)
.visible_on_hover(&card_header_id)
.on_click(cx.listener({ .on_click(cx.listener({
move |this, _event, _window, cx| { move |this, _event, _window, cx| {
if is_open { if is_open {
@ -1659,14 +1659,6 @@ impl AcpThreadView {
cx.notify(); cx.notify();
} }
})), })),
),
),
)
.child(
div()
.text_size(self.tool_name_font_size())
.text_color(cx.theme().colors().text_muted)
.child("Thinking"),
) )
.on_click(cx.listener({ .on_click(cx.listener({
move |this, _event, _window, cx| { move |this, _event, _window, cx| {
@ -1685,7 +1677,7 @@ impl AcpThreadView {
.relative() .relative()
.mt_1p5() .mt_1p5()
.ml(rems(0.4)) .ml(rems(0.4))
.pl_4() .pl_3p5()
.border_l_1() .border_l_1()
.border_color(self.tool_card_border_color(cx)) .border_color(self.tool_card_border_color(cx))
.text_ui_sm(cx) .text_ui_sm(cx)