Files
slide/decks/gen2D/pages/request-journey.md
T
wonder f0245e926d
Deploy Slides / build-and-deploy (push) Successful in 1m13s
feat: add 3 creative slides — tech decisions, request tracing, lessons learned
- why-not-x.md: Engineering decision rationale (Go vs Python, SQLite vs PG, etc.)
- request-journey.md: Full HTTP-to-pixel request tracing with timing breakdown
- lessons.md: 4 real engineering pitfalls and how they were solved
- Wire all 3 new pages into slides.md in logical positions
2026-05-30 22:46:23 +08:00

1.3 KiB
Raw Blame History

一次请求的完整旅程

从 HTTP 到像素 — 追踪一个生成请求的全链路

POST /api/v1/generate  {prompt: "像素风骑士", assetType: "sprite", style: {artStyle: "pixel"}}
JWT 认证 → 解析 userID → 用户级限流检查(Redis Lua)→ 全局限流检查 → 放行 参数绑定 + 校验 → 去重检查 `hash(prompt+type+params)` → 创建 Task(DB 写入)→ 入队 TaskQueue → 返回 `taskId` goroutine 取出任务 → PromptOptimizer(风格合并 + LLM)→ AssetGenerator(文生图 API)→ QualitySupervisor(视觉模型质检,可能重试)→ FormatAdapter(精灵表拆分 + GIF) 上传素材到七牛云 Kodo → 写入 Asset 表 → 更新 Task status=completed → WebSocket 推送完成通知
全程异步:前端拿到 taskId 后通过 WebSocket 实时监听进度变化