- 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.0 KiB
1.0 KiB
ADDED Requirements
Requirement: 人设管理函数及常量迁移至独立模块
系统 SHALL 将人设相关的常量和函数从 main.py 提取至 services/persona.py,包括:DEFAULT_PERSONAS、RANDOM_PERSONA_LABEL、PERSONA_POOL_MAP、DEFAULT_TOPICS、DEFAULT_STYLES、DEFAULT_COMMENT_KEYWORDS、_match_persona_pools、get_persona_topics、get_persona_keywords、on_persona_changed、_resolve_persona。
Scenario: 常量可从模块导入
- WHEN
main.py执行from services.persona import DEFAULT_PERSONAS, PERSONA_POOL_MAP - THEN 常量值 SHALL 与迁移前完全一致
Scenario: 人设解析正确处理随机人设标签
- WHEN
_resolve_persona(RANDOM_PERSONA_LABEL)被调用 - THEN SHALL 返回从人设池中随机选取的人设文本,行为与迁移前一致
Scenario: 人设变更回调正常触发
- WHEN
on_persona_changed(persona_text)被调用 - THEN SHALL 返回更新后的话题列表和关键词列表,供 Gradio UI 使用