zhoujie b635108b89 refactor: split monolithic main.py into services/ + ui/ modules (improve-maintainability)
- 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"
2026-02-24 22:50:56 +08:00

1.2 KiB
Raw Blame History

ADDED Requirements

Requirement: 互动自动化函数迁移至独立模块

系统 SHALL 将评论、点赞、收藏、回复等互动自动化函数从 main.py 提取至 services/engagement.py,包括:load_note_for_commentai_generate_commentsend_commentfetch_my_noteson_my_note_selectedfetch_my_note_commentsai_reply_commentsend_replyauto_comment_once_auto_comment_with_logauto_like_once_auto_like_with_logauto_favorite_once_auto_favorite_with_logauto_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 内复制限流逻辑