From bfcaf5a53ab97bc9283f86b35a93f712973181fb Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Fri, 19 Dec 2025 20:17:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B1=BB=E5=9E=8B):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E7=9B=B8=E5=85=B3=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 ToolCall 接口定义工具调用记录 - 添加 ToolResult 接口定义工具执行结果 - 支持图片数据、执行引擎和执行时间属性 --- src/types/index.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/types/index.ts b/src/types/index.ts index 60d3460..8bd9b18 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -27,6 +27,31 @@ export interface Message { role: 'user' | 'assistant'; content: string; timestamp: Date; + /** 工具调用记录 */ + toolCalls?: ToolCall[]; + /** 工具调用结果 */ + toolResults?: ToolResult[]; +} + +// 工具调用记录 +export interface ToolCall { + id: string; + name: string; + input: Record; +} + +// 工具调用结果 +export interface ToolResult { + toolUseId: string; + toolName: string; + content: string; + isError?: boolean; + /** 代码执行产生的图片(Base64) */ + images?: string[]; + /** 执行引擎 */ + engine?: 'pyodide' | 'piston'; + /** 执行时间 (ms) */ + executionTime?: number; } // 用户类型