feat(ai-studio): resume hosted image jobs

This commit is contained in:
chengma
2026-07-11 14:29:58 +08:00
parent cddadf6364
commit dcaf68fd07
9 changed files with 240 additions and 7 deletions
+8 -2
View File
@@ -3,7 +3,7 @@ id: T-594
title: AI工场 cmhub 托管生图故障恢复、计费一致性与运行回归
phase: 7
deps: [T-590, T-591]
status: TODO
status: DONE
created: 2026-07-11
---
@@ -36,4 +36,10 @@ AI工场会同时持有多张 cmhub 异步生图任务。基础编排和 GUI 接
## 执行记录
(完成后记录故障矩阵、状态决策与验证结果。)
- 2026-07-11:完成 AI工场 cmhub 托管生图恢复与状态收口。
- `image_studio.list_resumable_jobs(..., include_failed_downloads=True)` 支持把 failed 但已有 `task_id` 且无输出 asset 的任务纳入恢复队列,用于下载失败/本地保存失败后的继续查询。
- `image_studio_generation.resume_image_jobs()` 改用恢复队列:已有 `task_id` 的任务只 poll/download,不再 POST submit,不重复创建 job 或重复扣点。
- 新增 `ImageStudioResumeJobsWorker` 和 ⑥ AI工场「继续查询任务」按钮;无可续查任务时中文提示,有任务时复用现有进度/日志/刷新逻辑。
- 照片池任务行显示 submitted/running/failed/expired/cancelled 中文状态,并补充扣点、余额、`call_id`,便于计费和失败排障。
- 更新 `docs/routes.md`,明确继续查询不重复 submit、不重复扣点以及任务状态展示口径。
- 验证:主工作区 targeted 测试通过;因无关默认提示词脏文件仍会影响全量 unittest,已在干净 worktree 仅套用 T-594 diff 后运行 `python -m ruff check app tests main.py`、`py -3.10 -m compileall app main.py`、`py -3.10 -m unittest discover -s tests`(369 tests)和 `git diff --check`,全部通过。