Files
slide/decks/gen2D/pages/eino-graph.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

1.3 KiB

Eino 管线编排 — compose.Graph

四阶段智能体协作的核心实现

// 类型定义
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
}
使用 `compose.NewGraph[PipelineInput, PipelineOutput]()` 创建有向图,依次注册四个节点:PromptOptimizer → AssetGenerator → QualitySupervisor → FormatAdapter。质检节点支持条件分支:通过则进入格式适配,不通过则回退到提示词优化。 通过 `AddLambda` 注册状态处理器,在节点间传递优化后的提示词、图片 URL、重试计数等状态。质检节点根据 `RetryCount` 决定重优化还是降级输出。 传入 `PipelineInput`,管线自动按拓扑顺序执行各节点。每个节点执行完成后通过回调更新进度(5% → 25% → 60% → 80% → 100%)。