优化全能创作
This commit is contained in:
@@ -36,6 +36,8 @@ params json {model, resolution, ratio, duration} 会话
|
||||
pinned_refs json [Ref] 本会话锁定的实体(每轮无条件带上 → 锁脸锁商品)
|
||||
memory json {summary: str, artifacts: [ArtifactRef], turn_count: int}
|
||||
status "running" | "completed" | "failed"
|
||||
agent_status "idle" | "planning" | "awaiting_user" 整理方案态(与 status 正交);一团队同时只能有一个 planning
|
||||
agent_started_at datetime|null planning 开始时间(超时清扫用)
|
||||
last_active_at / is_deleted / purged_at
|
||||
```
|
||||
|
||||
@@ -124,7 +126,8 @@ created_at
|
||||
| GET/POST | `/api/ai/creations/` | 会话列表 / 新建(带首条消息即开聊) |
|
||||
| GET/PATCH/DELETE | `/api/ai/creations/{id}/` | 详情(含全部消息) / 改名 / 软删 |
|
||||
| GET | `/api/ai/creations/{id}/messages/?after_seq=` | 增量拉消息(轮询时只补新的) |
|
||||
| POST | `/api/ai/creations/{id}/send/` | 发消息 → **SSE 流**;`kind=confirm` 例外,返回 JSON |
|
||||
| POST | `/api/ai/creations/{id}/send/` | 发消息 → **202** `{conversation_id, agent_status}`(Celery 整理方案)+ poll;闸门短路径 **200**;`kind=confirm` → JSON 201;团队冲突 **409** |
|
||||
| POST | `/api/ai/creations/{id}/cancel/` | 终止整理方案 → **200** `{conversation_id, agent_status: idle}`(仅 `planning`);非 planning **409**。Redis 标 `omni:agent:cancel:{id}` + 立刻释放 `omni:agent:{team_id}`;Celery 在工具轮间隙停跑,已落库消息保留。不影响 confirm 出片 |
|
||||
| GET | `/api/ai/creations/{id}/tasks/{task_id}/poll/` | 轮询生成任务(视频用) |
|
||||
|
||||
`POST send/` 请求体:
|
||||
@@ -152,6 +155,11 @@ created_at
|
||||
| `done` | `{}` | 收流 |
|
||||
| `error` | `{detail, error}` | 已回滚积分 |
|
||||
|
||||
> **2026-09-11 更新:**`kind=text|elicit_answer` 的整理方案循环已迁到 Celery(`run_creation_agent_turn_task`)。
|
||||
> 离开/刷新页面不中断;前端按 `agent_status===planning` 轮询 `GET creations/{id}/` / `messages?after_seq=`。
|
||||
> 团队级 Redis 锁 `omni:agent:{team_id}` + DB `agent_status` 保证同时只有一个会话在整理方案;冲突返回 409「当前已有对话正在整理方案,请等待完成后再试」。
|
||||
> 下方 SSE 事件表保留作 `stream_creation_agent` 兼容/单测说明;生产主路径不再对浏览器推 SSE。
|
||||
|
||||
**铁律:视频 5–10 分钟,绝不在 SSE 里等。** 工具立刻返回 task_id → 落一条 `generating` 消息 → 发 `task` 事件 → 收流。前端轮询完成后把该消息替换成 `result`。
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user