Refactor ToolCallStatus enum to flat variants (#36356)
Replace nested Allowed variant with distinct statuses for clearer status handling. Release Notes: - N/A
This commit is contained in:
parent
da8a692ec0
commit
5895fac377
3 changed files with 72 additions and 70 deletions
|
@ -1053,14 +1053,10 @@ impl AcpThreadView {
|
|||
let card_header_id = SharedString::from("inner-tool-call-header");
|
||||
|
||||
let status_icon = match &tool_call.status {
|
||||
ToolCallStatus::Allowed {
|
||||
status: acp::ToolCallStatus::Pending,
|
||||
}
|
||||
| ToolCallStatus::WaitingForConfirmation { .. } => None,
|
||||
ToolCallStatus::Allowed {
|
||||
status: acp::ToolCallStatus::InProgress,
|
||||
..
|
||||
} => Some(
|
||||
ToolCallStatus::Pending
|
||||
| ToolCallStatus::WaitingForConfirmation { .. }
|
||||
| ToolCallStatus::Completed => None,
|
||||
ToolCallStatus::InProgress => Some(
|
||||
Icon::new(IconName::ArrowCircle)
|
||||
.color(Color::Accent)
|
||||
.size(IconSize::Small)
|
||||
|
@ -1071,16 +1067,7 @@ impl AcpThreadView {
|
|||
)
|
||||
.into_any(),
|
||||
),
|
||||
ToolCallStatus::Allowed {
|
||||
status: acp::ToolCallStatus::Completed,
|
||||
..
|
||||
} => None,
|
||||
ToolCallStatus::Rejected
|
||||
| ToolCallStatus::Canceled
|
||||
| ToolCallStatus::Allowed {
|
||||
status: acp::ToolCallStatus::Failed,
|
||||
..
|
||||
} => Some(
|
||||
ToolCallStatus::Rejected | ToolCallStatus::Canceled | ToolCallStatus::Failed => Some(
|
||||
Icon::new(IconName::Close)
|
||||
.color(Color::Error)
|
||||
.size(IconSize::Small)
|
||||
|
@ -1146,15 +1133,23 @@ impl AcpThreadView {
|
|||
tool_call.content.is_empty(),
|
||||
cx,
|
||||
)),
|
||||
ToolCallStatus::Allowed { .. } | ToolCallStatus::Canceled => v_flex()
|
||||
.w_full()
|
||||
.children(tool_call.content.iter().map(|content| {
|
||||
div()
|
||||
.child(
|
||||
self.render_tool_call_content(entry_ix, content, tool_call, window, cx),
|
||||
)
|
||||
.into_any_element()
|
||||
})),
|
||||
ToolCallStatus::Pending
|
||||
| ToolCallStatus::InProgress
|
||||
| ToolCallStatus::Completed
|
||||
| ToolCallStatus::Failed
|
||||
| ToolCallStatus::Canceled => {
|
||||
v_flex()
|
||||
.w_full()
|
||||
.children(tool_call.content.iter().map(|content| {
|
||||
div()
|
||||
.child(
|
||||
self.render_tool_call_content(
|
||||
entry_ix, content, tool_call, window, cx,
|
||||
),
|
||||
)
|
||||
.into_any_element()
|
||||
}))
|
||||
}
|
||||
ToolCallStatus::Rejected => v_flex().size_0(),
|
||||
};
|
||||
|
||||
|
@ -1467,12 +1462,7 @@ impl AcpThreadView {
|
|||
|
||||
let tool_failed = matches!(
|
||||
&tool_call.status,
|
||||
ToolCallStatus::Rejected
|
||||
| ToolCallStatus::Canceled
|
||||
| ToolCallStatus::Allowed {
|
||||
status: acp::ToolCallStatus::Failed,
|
||||
..
|
||||
}
|
||||
ToolCallStatus::Rejected | ToolCallStatus::Canceled | ToolCallStatus::Failed
|
||||
);
|
||||
|
||||
let output = terminal_data.output();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue