diff --git a/ga.py b/ga.py index c7c20309d..fc8c56052 100644 --- a/ga.py +++ b/ga.py @@ -477,7 +477,7 @@ def _retry_or_exit(self, prompt): def do_no_tool(self, args, response): '''这是一个特殊工具,由引擎自主调用,不要包含在TOOLS_SCHEMA里。 当模型在一轮中未显式调用任何工具时,由引擎自动触发。 - 二次确认仅在回复几乎只包含/和一段大代码块时触发。''' + 二次确认也会在回复只有/元数据时触发。''' content = getattr(response, 'content', '') or "" thinking = getattr(response, 'thinking', '') or "" if not response or (not content.strip() and not thinking.strip()): @@ -487,6 +487,11 @@ def do_no_tool(self, args, response): return self._retry_or_exit("[System] Incomplete response. Regenerate and tooluse.") if 'max_tokens !!!]' in content[-100:]: return self._retry_or_exit("[System] max_tokens limit reached. Use multi small steps to do it.") + + visible_content = re.sub(r"<(?:thinking|summary)>[\s\S]*?", "", content, flags=re.IGNORECASE).strip() + if not visible_content: + yield "[Warn] LLM returned only thinking/summary metadata. Retrying...\n" + return self._retry_or_exit("[System] Incomplete response: only thinking/summary metadata was returned. Continue the task and use tools when action is required.") if self._in_plan_mode() and any(kw in content for kw in ['任务完成', '全部完成', '已完成所有', '🏁']): if 'VERDICT' not in content and '[VERIFY]' not in content and '验证subagent' not in content: