Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ga.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def __init__(self, parent, last_history=None, cwd='./temp'):
self.history_info = last_history if last_history else []
self.code_stop_signal = []
self._done_hooks = []
self._blank_streak = 0

def _get_abs_path(self, path):
if not path: return ""
Expand Down Expand Up @@ -445,8 +446,13 @@ def do_no_tool(self, args, response):
content = getattr(response, 'content', '') or ""
thinking = getattr(response, 'thinking', '') or ""
if not response or (not content.strip() and not thinking.strip()):
self._blank_streak += 1
if self._blank_streak >= 3:
yield "[Error] LLM returned empty response 3 times consecutively. Aborting.\n"
return StepOutcome({}, next_prompt=None)
yield "[Warn] LLM returned an empty response. Retrying...\n"
return StepOutcome({}, next_prompt="[System] Blank response, regenerate and tooluse")
self._blank_streak = 0
if len(content) > 50 and ('[!!! 流异常中断' in content[-100:] or '!!!Error:' in content[-100:]):
return StepOutcome({}, next_prompt="[System] Incomplete response. Regenerate and tooluse.")
if 'max_tokens !!!]' in content[-100:]:
Expand Down