feat(scheduler): qzone.reply_comments 自动回评论 builtin + 管理页子任务区#158
Merged
Conversation
后端(PR-B6):
- 新 builtin `qzone.reply_comments`(scheduler/builtins/qzone_reply.py):
驱动一次内部 ChatService turn,system tail 指示模型 qzone_list_feed
拉自己最近 lookback_posts 条说说 → 跳过已回/自己的评论 → 对新评论
qzone_post_comment(人设口吻,至多 max_replies 条)→ 结束 turn。
audit dict = {ok, replies_posted, tids_scanned, skipped_seen, error?},
builtin 永不抛。
- 去重 sidecar `<DATA_DIR>/qzone_seen_comments/<persona_id>.json`
({version:1, seen:{tid:["uin:ts",...]}},slug 防穿越、per-tid 200 /
总 tid 100 封顶、原子写);已见列表注入 tail,turn 后从事件流回填。
- 公共骨架抽取 _qzone_chat.py:metadata/chat/persona-store/data-dir/
model 解析、InternalChatRequest 构造、带超时的事件流 drive
(ChatDriveOutcome 记录全部 tool_call/tool_result)、事件内省与
slug 守卫。qzone_daily 改为薄封装调用,audit 语义逐字段保持不变
(现有 33 个 daily 测试全绿,多样性/labels/harvest 逻辑未动)。
- admin 校验:_validate_qzone_reply(persona 必填;metadata.max_replies
1-10 / lookback_posts 1-20,非法 422 invalid_qzone_reply_args),
create/patch/resume 全走;trigger 运行时回退支持 reply 任务;JobOut
只读回显 max_replies/lookback_posts 供编辑回填。
前端:
- /scheduler/qzone 新增「评论自动回复」子任务区:persona 选择 +
QzoneSchedulePicker(新增 idPrefix 防重复 id)+ max_replies/
lookback_posts 数字输入(走 body.metadata),任务名
{persona}.qzone_reply,行为复用 QzoneJobRow(立即跑/编辑/启停/删除)。
- i18n schedulerQzone.reply.* en+zh-CN 双份。
测试:后端 +30(builtin 23 + admin 7),前端 +4 并适配双表单选择器;
ruff/mypy strict/lint-imports/vitest/typecheck 全绿。
Claude-Session: https://claude.ai/code/session_01PzzkxzLNdLrVCRAUyGtmEz
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR-B6 —
qzone.reply_comments定时自动回复评论(净新增,hermes 没有的能力)后端
qzone.reply_comments(scheduler/builtins/qzone_reply.py,镜像 qzone_daily 注册方式):驱动一次内部 ChatService turn,system tail 指示模型:qzone_list_feed拉自己的说说(qq_account 已知时钉死owner_uin,否则按my_uin过滤)→ 取最近lookback_posts条 → 跳过自己的评论与「已回复过」列表 → 对新评论qzone_post_comment(人设口吻,reply_to_uin=评论者,至多max_replies条)→ 直接结束 turn(不发说说、不提问)。NapCat 鉴权在 agent 侧工具执行器内,故必须走 chat turn。persona_id(必填) /qq_account?/max_replies(1-10, 默认 3) /lookback_posts(1-20, 默认 5),全部可选带默认、越界 clamp。<DATA_DIR>/qzone_seen_comments/<persona_id>.json:{version:1, seen:{tid:["uin:ts",...]}};slug 校验防路径穿越(镜像 feat(scheduler): QZone 日常发布多样性引擎 — 灵感种子 / 反重复 post-log / 多样性 tail / 发布抖动 (PR-B4) #155);per-tid 200 / 总 tid 100 封顶(LRU 式滚出);原子写;组 prompt 时注入「已回复过」块,turn 结束后从事件流收集成功的qzone_post_comment(非 error 且 envelope ok)回填。{ok, replies_posted, tids_scanned, skipped_seen, error?}+ persona/qq/tools_called/duration_ms;builtin 永不抛,一切失败折叠(chat_error/chat_timeout/chat_service_failed/persona_* 等)。scheduler/builtins/_qzone_chat.py:两个 builtin 共享 metadata/chat/persona-store/data-dir/model 解析、InternalChatRequest 构造、带超时的事件流 drive(ChatDriveOutcome记录全部 tool_call/tool_result)、事件内省、slug 守卫。qzone_daily改为薄封装,audit 语义逐字段不变——现有 33 个 daily 测试全绿零改动;多样性/labels/harvest 本体未动。_validate_qzone_reply(缺 persona / 越界 / 非 int → 422invalid_qzone_reply_args),create/PATCH/resume 三处生效;trigger 运行时回退支持 reply 任务并在 history 记replies=N;JobOut新增只读回显max_replies/lookback_posts(写入路径仍走 metadata)。前端
/scheduler/qzone新增「评论自动回复」子任务区:persona 选择 +QzoneSchedulePicker(新增可选idPrefixprop 避免双实例 id 冲突,默认值保持旧选择器不变)+max_replies/lookback_posts数字输入(随body.metadata提交);任务名{persona}.qzone_reply;行为复用QzoneJobRow(立即跑/编辑/启停/删除),编辑就地回填。schedulerQzone.reply.*en+zh-CN 双份(title/editTitle/help/maxRepliesLabel/maxRepliesHint/lookbackLabel/lookbackHint/empty)。验证
uv run ruff check(改动文件)✅uv run mypy python/packages/(strict, 611 files)✅uv run lint-imports(2 kept, 0 broken)✅env -u ANTHROPIC_BASE_URL uv run pytest tests/scheduler/ tests/test_admin_scheduler_qzone.py:196 passed(新增 backend 30:builtin 23 + admin 7)✅cd ui && pnpm test:161 files / 1254 passed(新增 4;守卫测试绿)✅pnpm typecheck:0 错误 ✅