diff --git a/src/renderer/components/chat-area.ts b/src/renderer/components/chat-area.ts
index c4650d3..725d663 100644
--- a/src/renderer/components/chat-area.ts
+++ b/src/renderer/components/chat-area.ts
@@ -241,6 +241,14 @@ function renderToolCallCard(tc: ToolCallRecord): string {
if (args.selector) paramsHtml += `
选择器: ${escapeHtml(String(args.selector))}
`;
if (args.action) paramsHtml += `操作: ${escapeHtml(String(args.action))}
`;
+ // 失败/取消时显示错误信息(成功结果在工作空间工具页签查看)
+ let errorHtml = '';
+ if (tc.status === 'error' && tc.result?.error) {
+ errorHtml = `❌ ${escapeHtml(String(tc.result.error))}
`;
+ } else if (tc.status === 'cancelled') {
+ errorHtml = `🚫 用户取消了操作
`;
+ }
+
return ``;
}
-function formatFileSize(bytes: number): string {
- if (!bytes) return '0 B';
- const units = ['B', 'KB', 'MB', 'GB'];
- let i = 0;
- let size = bytes;
- while (size >= 1024 && i < units.length - 1) { size /= 1024; i++; }
- return `${size.toFixed(1)} ${units[i]}`;
-}
-
-export function updateLastAssistantMessage(content: string, think: string | null, stats: { eval_count?: number; total_duration?: number } | null, model?: string): void {
+export function updateLastAssistantMessage(content: string, think: string | null, _stats: unknown, model?: string): void {
const lastMsg = currentPlaceholder;
if (!lastMsg) return;
diff --git a/src/renderer/styles/style.css b/src/renderer/styles/style.css
index 1779fa9..ca81401 100644
--- a/src/renderer/styles/style.css
+++ b/src/renderer/styles/style.css
@@ -2062,6 +2062,15 @@ html, body {
color: var(--critical);
}
+.tool-call-error {
+ padding: 6px 14px;
+ font-size: 12px;
+ color: var(--critical);
+ border-top: 1px solid var(--border-subtle);
+ background: rgba(220, 53, 69, 0.04);
+ word-break: break-all;
+}
+
/* ── 聊天区域工具调用历史(可折叠)── */
.tool-calls-history {
margin: 8px 0;