Skip to content

Commit b1e173d

Browse files
committed
fix(ga): turn_end summary fallback prefers cleaned response body (_c) over args dict
1 parent 5b5a3e4 commit b1e173d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

ga.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,9 @@ def turn_end_callback(self, response, tool_calls, tool_results, turn, next_promp
553553
rsumm = re.search(r"<summary>(.*?)</summary>", _c, re.DOTALL)
554554
if rsumm: summary = rsumm.group(1).strip()
555555
else:
556-
tc = tool_calls[0]; tool_name, args = tc['tool_name'], tc['args'] # at least one because no_tool
557-
clean_args = {k: v for k, v in args.items() if not k.startswith('_')}
558-
summary = f"{tool_name}, args: {clean_args}"
559-
if tool_name == 'no_tool': summary = "直接回答了用户问题"
556+
tc = tool_calls[0]; clean_args = {k: v for k, v in tc['args'].items() if not k.startswith('_')} # at least one because no_tool
557+
summary = _c.strip() or smart_format("直接回答了用户问题" if tc['tool_name'] == 'no_tool' else f"{tc['tool_name']}, args: {clean_args}", max_str_len=40)
560558
next_prompt += "\n\n\n[SYSTEM] 必须在回复文本中包含<summary>!\n\n"
561-
summary = smart_format(summary.replace('\n', ''), max_str_len=40)
562559
summary = smart_format(summary.replace('\n', ''), max_str_len=80)
563560
self.history_info.append(f'[Agent] {summary}')
564561
_plan = self._in_plan_mode()

0 commit comments

Comments
 (0)