Files
slide/decks/gen2D/pages/request-journey.md
T
wonder f3abc5fdc6
Deploy Slides / build-and-deploy (push) Successful in 1m39s
fix: split overflowing slides to fit frankfurt theme header/footer bars
- eino-deep-dive.md: split slide 2 into code-only + explanation+SVG slides
- async-deep-dive.md: split slide 2 into code-only + progress+SVG slides
- harness.md: split slide 2 (4 Items + SVG) into two slides (2 Items each)
- request-journey.md: split into middleware/handler + pipeline/finalization slides

The frankfurt theme header (~40px) overlaps ~7px into the content zone,
leaving ~467px effective height. Dense slides with code+Items+images
exceeded this budget and were hidden behind the bars.
2026-05-31 00:01:33 +08:00

50 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 一次请求的完整旅程
从 HTTP 到像素 — 追踪一个生成请求的全链路
<div class="text-sm mt-2">
```
POST /api/v1/generate {prompt: "像素风骑士", assetType: "sprite", style: {artStyle: "pixel"}}
```
</div>
<v-clicks>
<Item title="① Middleware 层(~1ms)">
JWT 认证 → 解析 userID → 用户级限流(Redis Lua)→ 全局限流 → 放行
</Item>
<Item title="② Handler 层(~5ms)">
参数校验 → 去重检查 → 创建 Task(DB 写入)→ 入队 TaskQueue → 返回 `taskId`
</Item>
</v-clicks>
---
# 请求旅程 — 管线执行与收尾
耗时集中在管线阶段(~30s 占 95%)
<v-clicks>
<Item title="③ Pipeline 执行(~30s)">
goroutine 取任务 → PromptOptimizer → AssetGenerator → QualitySupervisor(可能重试)→ FormatAdapter(精灵表 + GIF)
</Item>
<Item title="④ 收尾(~2s)">
上传七牛云 Kodo → 写入 Asset 表 → 更新 Task 完成 → WebSocket 推送
</Item>
</v-clicks>
<div v-click class="mt-4 text-center text-gray-400 text-sm">
全程异步:前端拿到 taskId 后通过 WebSocket 实时监听进度变化
</div>
<!--
这就是一个请求的完整生命周期。注意看耗时分布:管线占了 95% 的时间,这就是为什么要做异步。
-->