feat(类型): 添加工具调用相关类型定义
- 添加 ToolCall 接口定义工具调用记录 - 添加 ToolResult 接口定义工具执行结果 - 支持图片数据、执行引擎和执行时间属性
This commit is contained in:
parent
c59dee8db9
commit
bfcaf5a53a
@ -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<string, unknown>;
|
||||
}
|
||||
|
||||
// 工具调用结果
|
||||
export interface ToolResult {
|
||||
toolUseId: string;
|
||||
toolName: string;
|
||||
content: string;
|
||||
isError?: boolean;
|
||||
/** 代码执行产生的图片(Base64) */
|
||||
images?: string[];
|
||||
/** 执行引擎 */
|
||||
engine?: 'pyodide' | 'piston';
|
||||
/** 执行时间 (ms) */
|
||||
executionTime?: number;
|
||||
}
|
||||
|
||||
// 用户类型
|
||||
|
||||
Loading…
Reference in New Issue
Block a user