Initial AI manga platform

This commit is contained in:
www
2026-06-15 17:45:28 +08:00
commit 7a8191650f
267 changed files with 105987 additions and 0 deletions
@@ -0,0 +1,146 @@
# 15_任务队列_错误重试_稳定性设计
## 1. 队列列表
```text
novel_queue
parse_queue
story_queue
character_queue
episode_queue
script_queue
storyboard_queue
image_queue
audio_queue
subtitle_queue
video_queue
qc_queue
review_queue
analytics_queue
```
---
## 2. 任务状态
```text
pending
running
success
failed
retrying
cancelled
manual_required
skipped
```
---
## 3. 幂等设计
幂等 key
```text
project_id + episode_id + shot_id + task_type + input_hash
```
重复提交时:
```text
已有成功结果 → 返回结果
任务运行中 → 返回任务状态
失败可重试 → 按规则重试
```
---
## 4. 重试规则
```text
文本任务:2 次
图片任务:3 次
视频合成:2 次
TTS2 次
质检:1 次
```
连续失败进入:
```text
manual_required
```
---
## 5. 失败处理
失败必须记录:
```text
错误码
错误信息
输入参数
Provider 响应
重试次数
是否扣额度
是否可恢复
```
---
## 6. 队列隔离
图片生成和视频合成不能共用队列,避免视频任务堵塞所有任务。
---
## 7. 并发限制
```text
每用户同时 1-2 个正式项目
每项目图片并发 3-5
每 Provider 独立限流
视频合成单独限流
```
---
## 8. 服务器重启恢复
系统启动后扫描:
```text
running 超时任务
retrying 超时任务
video_rendering 中断任务
```
处理:
```text
重新入队
标记失败
转人工
```
---
## 9. 成本安全
系统错误导致的重试不重复扣用户额度。
用户主动重生、主动大改,需要扣额度或重新计费。
---
## 10. 队列监控
后台显示:
```text
等待任务数
运行任务数
失败任务数
平均耗时
Provider 错误率
队列积压
```