feat: reasoning/thinking互通适配 + history窗口扩大 + summary提示强化

This commit is contained in:
Liang Jiaqing
2026-04-25 10:33:42 +08:00
parent 114dfdb211
commit cac3ba4769
3 changed files with 23 additions and 9 deletions

4
ga.py
View File

@@ -504,7 +504,7 @@ class GenericAgentHandler(BaseHandler):
def _get_anchor_prompt(self, skip=False):
if skip: return "\n"
h_str = "\n".join(self.history_info[-20:])
h_str = "\n".join(self.history_info[-40:])
prompt = f"\n### [WORKING MEMORY]\n<history>\n{h_str}\n</history>"
prompt += f"\nCurrent turn: {self.current_turn}\n"
if self.working.get('key_info'): prompt += f"\n<key_info>{self.working.get('key_info')}</key_info>"
@@ -523,7 +523,7 @@ class GenericAgentHandler(BaseHandler):
clean_args = {k: v for k, v in args.items() if not k.startswith('_')}
summary = f"调用工具{tool_name}, args: {clean_args}"
if tool_name == 'no_tool': summary = "直接回答了用户问题"
next_prompt += "\n[DANGER] 上一轮遗漏了<summary>需要按协议<summary>中输出极简单行摘要!"
next_prompt += "\n[DANGER] 遗漏了<summary>必须按协议一直在每次回复中用<summary>中输出极简单行摘要!"
summary = smart_format(summary, max_str_len=100)
self.history_info.append(f'[Agent] {summary}')
if turn % 65 == 0 and 'plan' not in str(self.working.get('related_sop')):