Co-authored-by: 崔朋 <peng.cui@smyze.cn>
This commit is contained in:
1 parent
8b7d4e0a82
commit
67817ccf4c
2 files changed
+2
-2
No files matched your search
@@ -580,7 +580,7 @@ class GenericAgentHandler(BaseHandler):
|
||||
next_prompt += f"\n\n[DANGER] Turn {turn}. Call update_working_checkpoint to save key context. Stop ineffective retries; if no progress, switch strategy: 1) Probe physical boundaries 2) **Re-read relevant SOPs**"
|
||||
elif turn % 31 == 0:
|
||||
next_prompt += f"\n\n[DANGER] Turn {turn}. Write checkpoints/key findings/tried approaches to a **file** for future reference (not only working_checkpoint!). Avoid losing critical info."
|
||||
elif turn % 10 == 0: next_prompt += get_global_memory()
|
||||
elif turn % 10 == 0: next_prompt += f'<global_memory>{get_global_memory()}</global_memory>'
|
||||
|
||||
if _plan and turn >= 10 and turn % 5 == 0:
|
||||
next_prompt = f"[Plan Hint] 正在计划模式。必须 file_read({_plan}) 确认当前步骤,回复开头引用:📌 当前步骤:...\n\n" + next_prompt
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ def compress_history_tags(messages, keep_recent=10, max_len=800, force=False, in
|
||||
if compress_history_tags._cd % interval != 0: return messages
|
||||
_before = sum(len(json.dumps(m, ensure_ascii=False)) for m in messages)
|
||||
_pats = {tag: re.compile(rf'(<{tag}>)([\s\S]*?)(</{tag}>)') for tag in ('thinking', 'think', 'tool_use', 'tool_result')}
|
||||
_hist_pat = re.compile(r'<(history|key_info|earlier_context)>[\s\S]*?</\1>')
|
||||
_hist_pat = re.compile(r'<(history|key_info|earlier_context|global_memory)>[\s\S]*?</\1>')
|
||||
def _trunc_str(s): return s[:max_len//2] + '\n...[Truncated]...\n' + s[-max_len//2:] if isinstance(s, str) and len(s) > max_len else s
|
||||
def _trunc(text):
|
||||
text = _hist_pat.sub(lambda m: f'<{m.group(1)}>[...]</{m.group(1)}>', text)
|
||||
|
||||
Reference in new issue
Block a user