feat:在 Planner 中添加回复计数信息

This commit is contained in:
SengokuCola
2025-04-28 01:32:09 +08:00
parent c77f468dfc
commit 868e057444
4 changed files with 95 additions and 37 deletions

View File

@@ -277,7 +277,15 @@ def process_llm_tool_response(
if not success:
return False, {}, error_msg
# 新增检查:确保响应包含预期的工具调用部分
if len(normalized_response) != 3:
# 如果长度不为3说明LLM响应不包含工具调用部分这在期望工具调用的上下文中是错误的
error_msg = f"LLM响应未包含预期的工具调用部分: 元素数量{len(normalized_response)},响应内容:{normalized_response}"
logger.warning(f"{log_prefix}{error_msg}")
return False, {}, error_msg
# 使用新的工具调用处理函数
# 此时已知 normalized_response 长度必定为 3
success, valid_tool_calls, error_msg = process_llm_tool_calls(normalized_response, log_prefix)
if not success:
return False, {}, error_msg