feat: expand gen2D deck with deep technical slides and interactive elements
Deploy Slides / build-and-deploy (push) Successful in 1m8s

- Add 5 new slide pages: eino-deep-dive, ratelimit-overview, ratelimit-lua, async-deep-dive, harness
- Add 4 new drawio SVGs: pipeline-detail, ratelimit, async-task, harness
- Update all existing slides with v-clicks progressive reveal
- Add presenter notes and interactive prompts
- Expand slides.md to register all new pages (16 → 25+ slides)
- Fix text overflow by trimming content per Item block
- Add Eino Graph deep dive: WithGenLocalState, Pre/Post Handler, branch routing
- Add rate limiting section: algorithm comparison, Lua script, Gin middleware
- Add async task deep dive: TaskQueue FIFO, context progress injection
- Add consistency section: style/pipeline/data/deployment 4-layer guarantees
This commit is contained in:
2026-05-30 22:42:23 +08:00
parent 659c22707b
commit 67ee76e58d
24 changed files with 878 additions and 33 deletions
+76
View File
@@ -0,0 +1,76 @@
# Eino Graph 深入 — 构建与编排
有向图构建与本地状态管理
<div class="mt-2">
```go {1-5|7-11|all}
g := compose.NewGraph[PipelineInput, PipelineOutput](
compose.WithGenLocalState(func(ctx context.Context) *PipelineState {
return &PipelineState{} // 每次调用获得全新状态
}),
)
g.AddLambdaNode(nodePromptOptimizer, &compose.Lambda{
StatePreHandler: preparePromptInput, // 从 state 读取输入
StatePostHandler: storePromptOutput, // 结果写回 state
})
```
</div>
<v-clicks>
<Item title="WithGenLocalState — 隔离的执行上下文">
每次 `graph.Invoke()` 调用生成独立的 `PipelineState`,避免并发调用间的状态污染。State 在节点间通过 Pre/Post Handler 流转。
</Item>
<Item title="StatePreHandler / StatePostHandler 模式">
PreHandler 从全局 State 提取当前节点所需字段;PostHandler 将节点输出写回 State。节点本身无状态,所有数据经 State 中转。
</Item>
</v-clicks>
---
# Eino Graph 深入 — 分支路由与重试
QualitySupervisor 驱动的条件分支
<div class="mt-2">
```go {1-10|all}
g.AddBranch(nodeQualitySupervisor, compose.NewGraphBranch(
func(ctx context.Context, _ PipelineInput) (string, error) {
var next string
_ = compose.ProcessState[*PipelineState](ctx,
func(_ context.Context, state *PipelineState) error {
next = state.NextNode // 质检结果决定路由
return nil
})
return next, nil
},
map[string]bool{
nodePromptOptimizer: true,
nodeFormatAdapter: true,
},
))
```
</div>
<v-clicks>
<Item title="路由逻辑">
质检通过 → FormatAdapter 直接输出;不通过且 retry < 3 → PromptOptimizer 重新优化;不通过且 retry >= 3 → FormatAdapter 降级输出。
</Item>
<Item title="管线全貌">
下图展示了完整的分支路由与重试机制,包括状态流转和降级路径。
</Item>
</v-clicks>
<div class="flex justify-center mt-2">
<img src="../public/pipeline-detail.svg" class="w-full max-h-[200px] object-contain" />
</div>