fix: 任务创建后直接进入 running 状态,避免前端显示排队中

- 移除任务初始状态 pending,改为直接创建为 running
- 初始进度设为 5%,stage 设为 prompt_builder
- 更新文档以反映实际执行流程(无队列机制)
- 修复前端轮询时因竞态条件显示排队中的问题
This commit is contained in:
2026-05-25 18:16:21 +08:00
parent 0a4f1c44c0
commit 0847d126a2
3 changed files with 32 additions and 91 deletions
+3 -4
View File
@@ -423,8 +423,7 @@ POST /api/v1/prompt/optimize
"code": 0,
"message": "ok",
"data": {
"taskId": "task_xyz789",
"status": "pending"
"taskId": "task_xyz789"
}
}
```
@@ -466,8 +465,8 @@ POST /api/v1/prompt/optimize
| 字段 | 类型 | 说明 |
|------|------|------|
| `status` | string | 任务状态:`pending` / `running` / `completed` / `failed` |
| `stage` | string | 当前管线阶段,`running` 时有值 |
| `status` | string | 任务状态:`running` / `completed` / `failed` / `saving` |
| `stage` | string | 当前管线阶段,`running` 时有值:`prompt_builder` / `asset_generator` / `quality_supervisor` / `format_adapter` |
| `progress` | int | 0-100,整体进度 |
| `retryCount` | int | 质检重试次数 |
| `error` | string | 失败原因,仅 `failed` 时有值 |