feat: bbs key模式2天超时自关; reflect首次立即check; worker交付规范; vision_sop修正

This commit is contained in:
Liang Jiaqing committed 2026-05-31 21:53:09 +08:00
1 parent f92051a0b7
commit f7c6dba679
4 files changed
+9 -7

No files matched your search

+3 -3
View File
@@ -252,12 +252,12 @@ if __name__ == '__main__':
if hasattr(mod, 'init'): mod.init(_reflect_args)
print('[Reflect] reloaded')
except Exception as e: print(f'[Reflect] reload error: {e}')
time.sleep(getattr(mod, 'INTERVAL', 5))
try: task = mod.check()
except Exception as e:
print(f'[Reflect] check() error: {e}'); continue
print(f'[Reflect] check() error: {e}'); task = None
if task and task == '/exit': break
if task is None: continue
if not task:
time.sleep(getattr(mod, 'INTERVAL', 5)); continue
print(f'[Reflect] triggered: {task[:80]}')
dq = agent.put_task(task, source='reflect')
try:
+4 -2
View File
@@ -3,7 +3,7 @@
# 或: python agent_bbs.py
import sqlite3, uuid, time, json, os
from threading import Lock
from threading import Lock, Thread
from fastapi import FastAPI, HTTPException, Query, Body, UploadFile, File
from fastapi.responses import JSONResponse, HTMLResponse, PlainTextResponse, FileResponse
from contextlib import contextmanager
@@ -15,6 +15,7 @@ from starlette.middleware.base import BaseHTTPMiddleware
BOARDS_FILE = "boards.json"
DEFAULT_BOARDS = {"agent-bbs-test": {"name": "default", "db": "agent_bbs.db"}}
BOARDS, BOARDS_MTIME_NS, BOARDS_LOCK = DEFAULT_BOARDS, None, Lock()
_T=[time.time()]
def load_boards_if_changed():
global BOARDS, BOARDS_MTIME_NS
@@ -165,6 +166,7 @@ def create_post(request: Request, token=Body(...), content=Body(...)):
cur = db.execute("INSERT INTO posts(author,content,created_at) VALUES(?,?,?)",
(author, content, time.time()))
post_id = cur.lastrowid
_T[0]=time.time()
return {"id": post_id, "author": author}
@app.get("/poll")
@@ -219,5 +221,5 @@ if __name__ == "__main__":
p = argparse.ArgumentParser(); p.add_argument("--cwd"); p.add_argument("--port", type=int, default=58800); p.add_argument("--key")
a = p.parse_args();
if a.cwd: os.chdir(a.cwd)
if a.key: BOARDS_FILE = None; BOARDS.clear(); BOARDS[a.key] = {"name": "default", "db": f"{a.key}.db"}
if a.key: BOARDS_FILE = None; BOARDS.clear(); BOARDS[a.key] = {"name": "default", "db": f"{a.key}.db"}; Thread(target=lambda:[time.sleep(3600) or time.time()-_T[0]>172800 and os._exit(0) for _ in iter(int,1)],daemon=True).start()
uvicorn.run(app, host="0.0.0.0", port=a.port)
+1 -1
View File
@@ -10,7 +10,7 @@
```python
from vision_api import ask_vision
result = ask_vision(image, prompt="描述图片内容", backend="claude", timeout=60, max_pixels=1_440_000)
result = ask_vision(image, prompt="描述图片内容", timeout=60, max_pixels=1_440_000)
# image: 文件路径(str/Path) 或 PIL Image
# backend: 'claude'(默认) | 'openai' | 'modelscope'
# 返回 str:成功为模型回复,失败为 'Error: ...'
+1 -1
View File
@@ -40,7 +40,7 @@ BBS: {base_url} (key: {board_key})
1. GET /posts?limit=10&key=xxx 查看新帖,有必要才看更多
2. 找到适合接的任务帖,点名你的优先接;未点名且适合也可接
3. 回复抢单,确认最早接单后,执行任务
4. 完成后发帖汇报结果,长结果使用文件
4. 完成后发帖汇报结果,长结果使用文件;必须严格区分**交付结果**和**报告信息**,“本文件是xxx”/“需要验证”等说明信息不允许出现在交付结果里
5. 有问题在BBS中交流,等下次唤醒看回复
6. 你会被持续唤醒,注意跟进BBS上的回复和追加指令
7. 这是内部BBS,可以一定程度信任