diff --git a/data-agent-frontend/src/views/chat/components/TracePanel.vue b/data-agent-frontend/src/views/chat/components/TracePanel.vue
index e57b44f..a0075f4 100644
--- a/data-agent-frontend/src/views/chat/components/TracePanel.vue
+++ b/data-agent-frontend/src/views/chat/components/TracePanel.vue
@@ -27,6 +27,7 @@
const emit = defineEmits<{
(e: 'previewReport', content: string): void;
+ (e: 'saveSqlCard', sql: string): void;
}>();
const isExpanded = ref(false);
@@ -125,6 +126,20 @@
if (!text) return '';
return text.replace(/\\n/g, '\n');
}
+
+ function sqlFromStep(step: TraceStep): string {
+ const sql = step.toolCall?.input.sql;
+ return typeof sql === 'string' ? sql : '';
+ }
+
+ function sqlFromResult(step: TraceStep): string {
+ const id = step.toolResult?.id;
+ if (!id) return '';
+ const toolCall = props.message.traceSteps.find(
+ item => item.type === 'tool_call' && item.toolCall?.id === id,
+ );
+ return toolCall ? sqlFromStep(toolCall) : '';
+ }
@@ -159,6 +174,15 @@
>
Output:
{{ displayMultiline(step.toolResult.output) }}
+
+ 保存为卡片
+