T-576 增加生成和更新内容模式

This commit is contained in:
chengma
2026-07-09 17:44:03 +08:00
parent 9827c8c6d8
commit ab87be8223
17 changed files with 679 additions and 183 deletions
+8
View File
@@ -1510,3 +1510,11 @@
- 测试:`tests/test_ai.py` 覆盖 direct/cmhub 两路径的 `{旧标题}` 替换、旧标题不重复追加、旧行为兼容和其它占位符保留;`tests/test_gui.py` 覆盖「插入旧标题」按钮和光标插入行为。
- 文档:`docs/06-tasks.md` 将 T-549 标为 DONE;同步 `docs/04-architecture.md`、`docs/api.md`、`docs/routes.md`、`docs/cmhub-integration-design.md` 和 `docs/current-state.md`。
- 验证:`python -m ruff check app tests main.py` 通过;`py -3.10 -m compileall app main.py` 通过;`git diff --check` 通过;`py -3.10 -m unittest discover -s tests` 通过(252 tests)。
## 【2026-07-09】T-576 · ②③生成/更新内容模式下拉与缺失内容阻断
- 需求:②AI生成把「生成封面图片」checkbox 升级为「生成内容」下拉,支持只生成标题、只生成封面、生成标题和封面;③更新蝦皮把封面更新入口从⑤移到③左下角「更新内容」下拉,支持只更新标题、只更新封面、更新标题和封面。
- 配置:`app/appconfig.py` 新增 `ai.generate_mode` 与 `shopee_update.update_mode`,并继续兼容写回旧 `ai.generate_cover` / `shopee_update.allow_cover_update`;⑤普通设置页隐藏「允许更新封面」,仅保留兼容字段。
- 代码:`app/ai.py`、`GenerateWorker`、`GenerateTab` 支持三种生成模式和模式化进度/日志;`ApplyTab` 在开始更新/检查前按当前更新模式校验缺少的新标题或新封面,阻断时不创建 `ApplyWorker`、不打开 Chrome、不写失败状态;`ApplyWorker`/`editor.apply_task()` 按 `update_mode` 只执行本轮需要的标题或封面更新。
- 文档:新增/完成 `docs/tasks/T-576.md`,同步 `docs/02-requirements.md`、`docs/04-architecture.md`、`docs/api.md`、`docs/routes.md`、`docs/current-state.md`。
- 验证:`python -m compileall app main.py` 通过;`python -m unittest discover -s tests` 通过(313 tests);`git diff --check` 通过。