feat:在 Planner 中添加回复计数信息
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user