d479504f12
Deploy Slides / build-and-deploy (push) Successful in 1m32s
- 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
48 lines
1.3 KiB
Markdown
48 lines
1.3 KiB
Markdown
# Eino 管线编排 — compose.Graph
|
|
|
|
四阶段智能体协作的核心实现
|
|
|
|
<div class="mt-2">
|
|
|
|
```go {all|1-8|10-15|17-22|24-28}
|
|
// 类型定义
|
|
type PipelineInput struct {
|
|
UserID string
|
|
ProjectID string
|
|
TaskID string
|
|
Prompt string
|
|
AssetType string
|
|
StyleMap map[string]string
|
|
}
|
|
|
|
type PipelineState struct {
|
|
OptimizedPrompt string
|
|
ImageURL string
|
|
QualityPassed bool
|
|
RetryCount int
|
|
}
|
|
|
|
type PipelineOutput struct {
|
|
AssetURL string
|
|
Metadata map[string]any
|
|
}
|
|
```
|
|
|
|
</div>
|
|
|
|
<v-clicks>
|
|
|
|
<Item title="graph.Build() — 构建管线">
|
|
使用 `compose.NewGraph[PipelineInput, PipelineOutput]()` 创建有向图,依次注册四个节点:PromptOptimizer → AssetGenerator → QualitySupervisor → FormatAdapter。质检节点支持条件分支:通过则进入格式适配,不通过则回退到提示词优化。
|
|
</Item>
|
|
|
|
<Item title="stateHandler — 状态管理">
|
|
通过 `AddLambda` 注册状态处理器,在节点间传递优化后的提示词、图片 URL、重试计数等状态。质检节点根据 `RetryCount` 决定重优化还是降级输出。
|
|
</Item>
|
|
|
|
<Item title="graph.Invoke() — 执行管线">
|
|
传入 `PipelineInput`,管线自动按拓扑顺序执行各节点。每个节点执行完成后通过回调更新进度(5% → 25% → 60% → 80% → 100%)。
|
|
</Item>
|
|
|
|
</v-clicks>
|