Files
slide/decks/gen2D/pages/eino-graph.md
T

32 lines
826 B
Markdown
Raw Normal View History

# Eino 管线编排 — compose.Graph
<div class="mt-2">
```go
type PipelineInput struct {
UserID, ProjectID, TaskID string
Prompt, 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>
<Item title="graph.Build() — 构建管线">
`compose.NewGraph` 创建有向图,注册四节点。质检节点条件分支:通过 → 格式适配,不通过 → 回退提示词优化。
</Item>
<Item title="graph.Invoke() — 执行管线">
传入 `PipelineInput`,按拓扑顺序执行。每节点完成回调更新进度(5% → 25% → 60% → 80% → 100%)。
</Item>