main: 增强工具调用与消息流程

- 支持 tool.call 和 tool.result 消息类型处理
- 引入 Tool 调度与执行逻辑,支持超时与结果截断
- 增加 ToolRegistry 和 ToolExecutor 管理工具定义与执行
- 更新上下文构建与消息映射逻辑,适配工具闭环处理
- 扩展配置与环境变量,支持 Tool 调用相关选项
- 增强单元测试覆盖工具调用与执行情景
- 更新文档和 OpenAPI,新增工具相关说明与模型定义
This commit is contained in:
2025-12-22 12:36:59 +08:00
parent dcbd0338e6
commit 59d4831f00
23 changed files with 1253 additions and 103 deletions

View File

@@ -436,6 +436,8 @@ components:
- $ref: '#/components/schemas/MessageDeltaPayload'
- $ref: '#/components/schemas/RunCancelPayload'
- $ref: '#/components/schemas/RunErrorPayload'
- $ref: '#/components/schemas/ToolCallPayload'
- $ref: '#/components/schemas/ToolResultPayload'
- type: object
reply_to:
type: string
@@ -544,6 +546,38 @@ components:
raw_message:
type: string
nullable: true
ToolCallPayload:
type: object
properties:
run_id:
type: string
tool_run_id:
type: string
tool_call_id:
type: string
name:
type: string
arguments:
type: object
additionalProperties: true
ToolResultPayload:
type: object
properties:
run_id:
type: string
parent_run_id:
type: string
tool_call_id:
type: string
name:
type: string
status:
type: string
error:
type: string
nullable: true
truncated:
type: boolean
PaginationLinks:
type: object
properties: