main: 增强工具调用与上下文日志记录

- 添加 `disable_tools` 选项,支持达到调用上限后禁用工具
- 增加工具调用与结果的日志记录,提升调试信息
- 优化上下文构建,记录已加载的消息信息
- 完善流式消息推送逻辑,支持 `message.delta` 类型
This commit is contained in:
2025-12-22 19:10:44 +08:00
parent 663e15395b
commit 78875ec3eb
4 changed files with 40 additions and 3 deletions

View File

@@ -202,9 +202,9 @@ class RunLoop
'should_stop' => fn () => $this->isCanceled($sessionId, $runId),
];
// 达到工具调用上限后,强制禁用工具调用,避免再次触发 TOOL_CALL_LIMIT 错误
// 达到工具调用上限后,禁用工具列表,避免再次触发 TOOL_CALL_LIMIT 错误
if ($toolCallCount >= $this->maxToolCalls) {
$options['tool_choice'] = 'none';
$options['disable_tools'] = true;
}
return $options;