diff --git a/Cargo.lock b/Cargo.lock index c2320b812f..b0be95f3e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1841,7 +1841,7 @@ dependencies = [ [[package]] name = "dbx" -version = "0.5.31" +version = "0.5.32" dependencies = [ "anyhow", "base64 0.22.1", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "dbx-web" -version = "0.5.31" +version = "0.5.32" dependencies = [ "aes-gcm 0.10.3", "argon2", diff --git a/apps/desktop/src/components/editor/AiAssistant.vue b/apps/desktop/src/components/editor/AiAssistant.vue index a9231137f5..9b9dc8861f 100644 --- a/apps/desktop/src/components/editor/AiAssistant.vue +++ b/apps/desktop/src/components/editor/AiAssistant.vue @@ -229,6 +229,14 @@ function appendAssistantReasoning(assistantIdx: number, delta: string) { } const expandedReasoning = ref>(new Set()); +const expandedSteps = ref>(new Set()); + +function toggleStep(key: string) { + const next = new Set(expandedSteps.value); + if (next.has(key)) next.delete(key); + else next.add(key); + expandedSteps.value = next; +} function agentStepIcon(tone: AiAgentStepTone) { if (tone === "danger") return CircleSlash; @@ -252,11 +260,15 @@ function agentStepClass(tone: AiAgentStepTone): string { } } -function agentStepTitle(step: AiAgentStepItem): string { - if (step.titleKey) return t(step.titleKey, step.titleParams || {}); - const tool = step.titleParams?.tool; - if (tool) return `${t(step.labelKey)}: ${tool}`; - return t(step.labelKey); +/** Extract tool result content from the AgentEvent result value */ +function extractToolResultContent(result: unknown): string | undefined { + if (!result) return undefined; + if (typeof result === "string") return result; + if (typeof result === "object" && result !== null && "content" in result) { + const content = (result as Record).content; + return typeof content === "string" ? content : JSON.stringify(content); + } + return JSON.stringify(result); } function toggleReasoning(index: number) { @@ -527,6 +539,10 @@ async function send() { tone: (e.type === "tool_call_start" ? "active" : e.is_error ? "danger" : "success") as AiAgentStepTone, titleKey: undefined, titleParams: { tool: e.tool_name || "" }, + toolName: e.tool_name, + toolArgs: e.type === "tool_call_start" ? (e.args as Record) : undefined, + toolResult: e.type === "tool_call_end" && !e.is_error ? extractToolResultContent(e.result) : undefined, + isError: e.type === "tool_call_end" ? e.is_error : undefined, })); msg.agentSteps = steps; } @@ -552,6 +568,10 @@ async function send() { tone: e.type === "tool_call_start" ? "active" : e.is_error ? "danger" : "success", titleKey: undefined, titleParams: { tool: e.tool_name || "" }, + toolName: e.tool_name, + toolArgs: e.type === "tool_call_start" ? (e.args as Record) : undefined, + toolResult: e.type === "tool_call_end" && !e.is_error ? extractToolResultContent(e.result) : undefined, + isError: e.type === "tool_call_end" ? e.is_error : undefined, })); } // Fallback: use aiAgentPlan for backward compatibility @@ -774,11 +794,20 @@ const messageRenderer = computed(() => { -
- - - {{ t(step.labelKey) }} - +
+
+ +
+
{{ step.toolArgs.sql }}
+
{{ step.toolResult }}
+
{{ step.toolResult }}
+
+