fix: thinking非空时不再误判为空响应触发重试

This commit is contained in:
Liang Jiaqing
2026-04-24 09:29:12 +08:00
parent 6974853695
commit f334994ab6

3
ga.py
View File

@@ -441,7 +441,8 @@ class GenericAgentHandler(BaseHandler):
当模型在一轮中未显式调用任何工具时,由引擎自动触发。 当模型在一轮中未显式调用任何工具时,由引擎自动触发。
二次确认仅在回复几乎只包含<thinking>/<summary>和一段大代码块时触发。''' 二次确认仅在回复几乎只包含<thinking>/<summary>和一段大代码块时触发。'''
content = getattr(response, 'content', '') or "" content = getattr(response, 'content', '') or ""
if not response or not content.strip(): thinking = getattr(response, 'thinking', '') or ""
if not response or (not content.strip() and not thinking.strip()):
yield "[Warn] LLM returned an empty response. Retrying...\n" yield "[Warn] LLM returned an empty response. Retrying...\n"
return StepOutcome({}, next_prompt="[System] Blank response, regenerate and tooluse") return StepOutcome({}, next_prompt="[System] Blank response, regenerate and tooluse")
if len(content) > 100 and ('未收到完整响应 !!!]' in content[-100:] or '!!!Error: [SSL:' in content[-100:]): if len(content) > 100 and ('未收到完整响应 !!!]' in content[-100:] or '!!!Error: [SSL:' in content[-100:]):