- 新增 GitHub Issue 模板(Bug 报告、功能请求)和 Pull Request 模板 - 新增 Code of Conduct(贡献者行为准则)和 Security Policy(安全政策) - 新增 CI 工作流(GitHub Actions),包含 ruff 代码检查和导入验证 - 新增开发依赖文件 requirements-dev.txt 📦 build(ci): 配置 GitHub Actions 持续集成 - 在 push 到 main 分支和 pull request 时自动触发 CI - 添加 lint 任务执行 ruff 代码风格检查 - 添加 import-check 任务验证核心服务模块导入 ♻️ refactor(structure): 重构项目目录结构 - 将根目录的 6 个服务模块迁移至 services/ 包 - 更新所有相关文件的导入语句(main.py、ui/、services/) - 根目录仅保留 main.py 作为唯一 Python 入口文件 🔧 chore(config): 调整配置和资源文件路径 - 将 config.json 移至 config/ 目录,更新相关引用 - 将个人头像图片移至 assets/faces/ 目录,更新 .gitignore - 更新 Dockerfile 和 docker-compose.yml 中的配置路径 📝 docs(readme): 完善 README 文档 - 添加项目状态徽章(Python 版本、License、CI) - 更新项目结构图反映实际目录布局 - 修正使用指南中的 Tab 名称和操作路径 - 替换 your-username 占位符为格式提示 🗑️ chore(cleanup): 清理冗余文件 - 删除旧版备份文件、测试脚本、临时记录和运行日志 - 删除散落的个人图片文件(已归档至 assets/faces/)
7.6 KiB
Tasks
1. 迁移服务文件至 services/ 包(project-restructure)
-
1.1 将
config_manager.py移入services/Move-Item config_manager.py services\config_manager.py -
1.2 将
mcp_client.py移入services/Move-Item mcp_client.py services\mcp_client.py -
1.3 将
llm_service.py移入services/Move-Item llm_service.py services\llm_service.py -
1.4 将
sd_service.py移入services/Move-Item sd_service.py services\sd_service.py -
1.5 将
analytics_service.py移入services/Move-Item analytics_service.py services\analytics_service.py -
1.6 将
publish_queue.py移入services/Move-Item publish_queue.py services\publish_queue.py
2. 更新外部文件的绝对导入(main.py、ui/)
-
2.1 更新
main.py中的导入from config_manager import ConfigManager, OUTPUT_DIR→from services.config_manager import ConfigManager, OUTPUT_DIRfrom llm_service import LLMService→from services.llm_service import LLMService
-
2.2 更新
ui/app.py中的导入from config_manager import ConfigManager→from services.config_manager import ConfigManagerfrom sd_service import SDService, DEFAULT_NEGATIVE, FACE_IMAGE_PATH, ...→from services.sd_service import SDService, DEFAULT_NEGATIVE, FACE_IMAGE_PATH, ...from analytics_service import AnalyticsService→from services.analytics_service import AnalyticsServicefrom publish_queue import STATUS_LABELS→from services.publish_queue import STATUS_LABELS
-
2.3 更新
ui/tab_create.py中的导入(检查并替换所有根目录服务模块引用)
3. 更新 services/ 内部使用相对导入
-
3.1 更新
services/scheduler.pyfrom config_manager import ConfigManager, OUTPUT_DIR→from .config_manager import ConfigManager, OUTPUT_DIRfrom llm_service import LLMService→from .llm_service import LLMServicefrom sd_service import SDService→from .sd_service import SDServicefrom mcp_client import get_mcp_client→from .mcp_client import get_mcp_clientfrom analytics_service import AnalyticsService→from .analytics_service import AnalyticsService
-
3.2 更新
services/content.pyfrom config_manager import ConfigManager, OUTPUT_DIR→from .config_manager import ConfigManager, OUTPUT_DIRfrom llm_service import LLMService→from .llm_service import LLMServicefrom sd_service import SDService, get_sd_preset→from .sd_service import SDService, get_sd_presetfrom mcp_client import get_mcp_client→from .mcp_client import get_mcp_client
-
3.3 更新
services/hotspot.pyfrom llm_service import LLMService→from .llm_service import LLMServicefrom mcp_client import get_mcp_client→from .mcp_client import get_mcp_client
-
3.4 更新
services/engagement.pyfrom mcp_client import get_mcp_client→from .mcp_client import get_mcp_clientfrom llm_service import LLMService→from .llm_service import LLMService
-
3.5 更新
services/profile.pyfrom mcp_client import get_mcp_client→from .mcp_client import get_mcp_client
-
3.6 更新
services/persona.pyfrom config_manager import ConfigManager→from .config_manager import ConfigManager
-
3.7 检查
services/queue_ops.py、services/rate_limiter.py、services/autostart.py、services/connection.py有无根目录模块引用,按需更新
4. 回归验证——导入与语法检查
-
4.1 对所有修改文件执行 Python 语法验证
python -c " import ast, pathlib files = ['main.py','ui/app.py','ui/tab_create.py', 'services/scheduler.py','services/content.py', 'services/hotspot.py','services/engagement.py', 'services/profile.py','services/persona.py'] for f in files: ast.parse(pathlib.Path(f).read_text(encoding='utf-8')) print(f'OK: {f}') " -
4.2 执行核心服务导入验证
python -c "from services.config_manager import ConfigManager; print('config_manager OK')" python -c "from services.llm_service import LLMService; print('llm_service OK')" python -c "from services.sd_service import SDService; print('sd_service OK')" python -c "from services.mcp_client import get_mcp_client; print('mcp_client OK')" python -c "from services.analytics_service import AnalyticsService; print('analytics_service OK')" python -c "from services.publish_queue import STATUS_LABELS; print('publish_queue OK')" -
4.3 执行 UI 层导入验证
python -c "import ui.app; print('ui.app OK')" -
4.4 确认根目录无游离
.py业务文件Get-ChildItem -Path . -MaxDepth 1 -Filter "*.py" | Select-Object Name # 预期仅显示 main.py(以及测试脚本如 _test_config_save.py)
5. 添加社区健康文件(oss-community-health)
-
5.1 创建
.github/ISSUE_TEMPLATE/bug_report.md(Bug 报告模板) 包含:问题描述、复现步骤、预期行为、实际行为、环境信息(Python 版本、OS) -
5.2 创建
.github/ISSUE_TEMPLATE/feature_request.md(功能请求模板) 包含:背景/需求、期望解决方案、替代方案 -
5.3 创建
.github/pull_request_template.md(PR 模板) 包含:变更类型(Bug Fix / Feature / Docs / Refactor)、变更描述、测试说明、相关 Issue -
5.4 创建
CODE_OF_CONDUCT.md(Contributor Covenant v2.1 中文版) -
5.5 创建
SECURITY.md(安全漏洞报告政策) 包含:支持版本、私下报告方式(GitHub Security Advisory)、响应时间承诺
6. 添加 CI 工作流(oss-ci-workflow)
-
6.1 创建
requirements-dev.txt,包含ruff>=0.4.0 -
6.2 创建
.github/workflows/ci.yml- trigger:
pushtomain、pull_requesttomain - job
lint:pip install ruffruff check . --select E,F,W --ignore E501(宽松规则,忽略行长)
- job
import-check:pip install -r requirements.txtpython -c "from services.config_manager import ConfigManager"python -c "from services.llm_service import LLMService"python -c "from services.sd_service import SDService"
- trigger:
7. 完善 README(oss-readme-polish)
-
7.1 在 README 标题下方添加徽章(Python、MIT License、CI Status)
 [](LICENSE) [](https://github.com/<your-github-username>/autobot/actions/workflows/ci.yml)将
<your-github-username>替换为实际 GitHub 用户名 -
7.2 修正 README 中的「项目结构」章节,反映迁移后
services/的完整内容 -
7.3 全局搜索替换
your-username占位符Select-String -Path README.md -Pattern "your-username" # 确认所有出现位置后,手动或批量替换 -
7.4 检查「首次使用流程」中的 Tab 名称与实际 Gradio UI 一致
8. 最终验证
- 8.1 执行
git status确认所有变更文件符合预期 - 8.2 执行
git diff --stat确认无意外文件被修改 - 8.3 启动应用:
python main.py确认 Gradio UI 正常加载,无启动错误