feat: tighten ai concurrency settings

This commit is contained in:
chengma
2026-07-08 08:55:01 +08:00
parent c2ae126aaf
commit 56e96d3ae1
10 changed files with 103 additions and 12 deletions
+8
View File
@@ -1483,3 +1483,11 @@
- 代码:`app/ai.py` 的 cmhub `image_url` 下载层新增最多 3 次安全重试,只复用同一个 `image_url`,不重新调用 cmhub 生图接口,避免重复扣点;下载总耗时超过 20 秒时发出 `cover_download` warning 事件。`app/gui/workers.py` 将该事件显示为“图片下载较慢”运行日志。
- 文档:同步 `docs/04-architecture.md`、`docs/api.md` 和 `docs/current-state.md`。
- 验证:`py -3.10 -m unittest discover -s tests -p "test_ai.py"` 通过(30 tests);`py -3.10 -m unittest discover -s tests -p "test_gui.py"` 通过(102 tests);`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` 通过(240 tests)。
## 【2026-07-08】T-547 · ⑤并发/重试上限收紧
- 需求:⑤设置页把「标题并发数」「图片并发数」上限收紧到 5,把「失败重试次数」上限收紧到 10,并避免历史 `config.json` 或手工配置绕过 UI 限制。
- 代码:`app/gui/tabs/settings.py` 的标题/图片并发 spin 范围改为 1..5,失败重试 spin 范围改为 0..10;`app/appconfig.py` 新增 AI 并发/重试范围常量和 `_clamp_int()`,加载/保存配置时把 `ai.title_concurrency`、`ai.image_concurrency`、`ai.retry` 夹紧到新范围,默认值 4/4/2 不变。
- 测试:`tests/test_appconfig.py` 覆盖旧配置超限值会归一到 1/5/10、正常值不变;`tests/test_gui.py` 覆盖三个 spin 的新范围。
- 文档:`docs/06-tasks.md` 将 T-547 标为 DONE;同步 `docs/04-architecture.md`、`docs/api.md`、`docs/routes.md` 和 `docs/current-state.md`。
- 验证:`py -3.10 -m unittest discover -s tests -p "test_appconfig.py"` 通过(15 tests);`py -3.10 -m unittest discover -s tests -p "test_gui.py"` 通过(102 tests);`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` 通过(244 tests)。