Merge branch 'develop' of gitee.com:hezhaohui123/gen2d into feat/async-generate-pipeline

Signed-off-by: 何朝晖 <hezhaohui0807@163.com>
This commit is contained in:
2026-05-25 06:38:14 +00:00
committed by Gitee
29 changed files with 896 additions and 244 deletions
+14
View File
@@ -4,6 +4,8 @@ import (
"context"
"fmt"
"gen2d/internal/logger"
"github.com/cloudwego/eino/compose"
)
@@ -101,20 +103,32 @@ func NewGenerateGraph() (*compose.Graph[PipelineInput, PipelineOutput], error) {
// RunPipeline 编译并执行生成管线。
func RunPipeline(ctx context.Context, in PipelineInput) (*PipelineOutput, error) {
l := logger.FromCtx(ctx)
l.Info("pipeline started",
"asset_type", in.AssetType,
"tags", in.Tags,
"resolution", in.Params.Resolution,
)
g, err := NewGenerateGraph()
if err != nil {
l.Error("pipeline create graph failed", "error", err)
return nil, fmt.Errorf("create graph: %w", err)
}
r, err := g.Compile(ctx, compose.WithMaxRunSteps(20))
if err != nil {
l.Error("pipeline compile failed", "error", err)
return nil, fmt.Errorf("compile graph: %w", err)
}
output, err := r.Invoke(ctx, in)
if err != nil {
l.Error("pipeline invoke failed", "error", err)
return nil, fmt.Errorf("invoke pipeline: %w", err)
}
l.Info("pipeline completed", "asset_count", len(output.Assets))
return &output, nil
}