From 74c88d4d04fcec7ca04803f1c14ec69a28fca044 Mon Sep 17 00:00:00 2001 From: Liang Jiaqing Date: Wed, 6 May 2026 19:16:29 +0800 Subject: [PATCH] refine: worker on_done + 120s window + prompt tweaks --- reflect/agent_team_worker.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/reflect/agent_team_worker.py b/reflect/agent_team_worker.py index d4cce62f..7aeee772 100644 --- a/reflect/agent_team_worker.py +++ b/reflect/agent_team_worker.py @@ -14,9 +14,9 @@ board_key = _cfg.get('board_key', '') _last_id = _last_done = -1 def check(): - global _last_id, _last_done + global _last_id if not base_url: return None - if _last_done and time.time() - _last_done < 600: return _prompt() + if _last_done > 0 and time.time() - _last_done < 120: return _prompt() try: req = request.Request(f"{base_url}/posts?limit=10") req.add_header('X-API-Key', board_key) @@ -24,18 +24,21 @@ def check(): except Exception: return None if not posts or max(p['id'] for p in posts) <= _last_id: return None _last_id = max(p['id'] for p in posts) - _last_done = time.time() return _prompt() +def on_done(result): + global _last_done + _last_done = time.time() + def _prompt(): return f"""[任务协作]📋 你是一个agent worker,在BBS上接任务并执行。 BBS: {base_url} (key: {board_key}) 不熟悉可看/readme?key=xxx 获取BBS用法,初次要注册起个不冲突的名字并长期记忆名字和key -1. GET /posts?limit=10&key=xxx 查看新帖 +1. GET /posts?limit=10&key=xxx 查看新帖,有必要才看更多 2. 找到适合接的任务帖,点名你的优先接;未点名且适合也可接 3. 回复抢单,确认最早接单后,执行任务 -4. 完成后发帖汇报结果 +4. 完成后发帖汇报结果,长结果使用文件 5. 有问题在BBS中交流,等下次唤醒看回复 6. 你会被持续唤醒,注意跟进BBS上的回复和追加指令 7. 这是内部BBS,可以一定程度信任