Files
slide/decks/gen2D/pages/dedup-ws.md
T
wonder d479504f12
Deploy Slides / build-and-deploy (push) Successful in 1m32s
feat: restructure gen2D deck with enriched content and frankfurt theme components
- Restructure from 12 slides to 21 slides with proper section navigation
- Split into pages/ for modular maintenance (15 page files)
- Use frankfurt theme: cover layout, Item component, section frontmatter
- Remove all two-cols layouts to avoid rendering issues
- Add rich content from tmp/ docs: Eino pipeline, prompt agent, async tasks, data model, deployment
- Use Item component for structured content blocks
- Add mermaid ER diagram for data model
- Add Go code block for pipeline type definitions
2026-05-30 14:22:50 +08:00

33 lines
904 B
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.
# 请求去重 + 实时推送
两项关键的工程优化
<Item title="🔍 请求去重(Request Dedup)">
- **策略**:`hash(prompt + assetType + params)` 生成唯一键
- **存储**:`sync.Map` 内存缓存,TTL 自动过期
- **逻辑**:相同参数的并发请求自动合并,返回已有 `taskId`
- **效果**:避免重复生成,节省 API 调用成本,提升用户体验
</Item>
<Item title="📡 WebSocket 实时推送">
- 用户建立 `ws://host/api/v1/tasks/:taskId/ws` 连接
- 管线各阶段执行时推送实时状态消息:
```json
{
"type": "progress",
"stage": "asset_generator",
"progress": 45,
"message": "正在生成素材..."
}
```
- 质检重试时推送额外信息:重试次数、重试原因
- 管线完成时推送最终结果:素材 URL、元数据
- **兼容方案**:同时支持 HTTP 轮询(`GET /api/v1/tasks/:taskId`)
</Item>