- main.py: 4360 → 146 lines (96.6% reduction), entry layer only - services/: rate_limiter, autostart, persona, connection, profile, hotspot, content, engagement, scheduler, queue_ops (10 business modules) - ui/app.py: all Gradio UI code extracted into build_app(cfg, analytics) - Fix: with gr.Blocks() indented inside build_app function - Fix: cfg.all property (not get_all method) - Fix: STATUS_LABELS, get_persona_keywords, fetch_proactive_notes imports - Fix: queue_ops module-level set_publish_callback moved into configure() - Fix: pub_queue.format_*() wrapped as queue_format_table/calendar helpers - All 14 files syntax-verified, build_app() runtime-verified - 58/58 tasks complete"
1.2 KiB
1.2 KiB
ADDED Requirements
Requirement: 互动自动化函数迁移至独立模块
系统 SHALL 将评论、点赞、收藏、回复等互动自动化函数从 main.py 提取至 services/engagement.py,包括:load_note_for_comment、ai_generate_comment、send_comment、fetch_my_notes、on_my_note_selected、fetch_my_note_comments、ai_reply_comment、send_reply、auto_comment_once、_auto_comment_with_log、auto_like_once、_auto_like_with_log、auto_favorite_once、_auto_favorite_with_log、auto_reply_once、_auto_reply_with_log、_auto_publish_with_log。
Scenario: 模块导入成功
- WHEN
main.py执行from services.engagement import auto_comment_once, auto_like_once等导入 - THEN 所有函数可正常调用
Scenario: 日志回调参数化
- WHEN
engagement.py中的_with_log函数需要追加日志时 - THEN 函数 SHALL 接收
log_fn参数(callable)用于写入日志,不直接依赖外部_auto_log列表
Scenario: 频率限制集成
- WHEN
auto_comment_once等函数执行前需要检查每日限额和冷却状态 - THEN 通过调用
rate_limiter模块中的函数实现,不在engagement.py内复制限流逻辑