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