diff --git a/workflow/service/flow/lambda_node.go b/workflow/service/flow/lambda_node.go index 241b43f..48e4c8d 100644 --- a/workflow/service/flow/lambda_node.go +++ b/workflow/service/flow/lambda_node.go @@ -264,7 +264,7 @@ func VideoModelLambda(ctx context.Context, input any) (any, error) { if err != nil { return nil, err } - + videoUrl := "" videoURL := make([]string, 0) for _, v := range res { if strings.Contains(v.Field, "content") { @@ -274,37 +274,42 @@ func VideoModelLambda(ctx context.Context, input any) (any, error) { if g.IsEmpty(videoURL) { return nil, fmt.Errorf("视频合成失败:模型生成视频失败") } - waitRes, err := VideoConcat(ctx, videoURL) - if err != nil { - return nil, err - } - msg := new(flowDto.VideoCallbackReq) - if err = gconv.Struct(waitRes, msg); err != nil { - return nil, err - } - - urlPrefix, err := utils.GetFileAddressPrefix(ctx) - newS := strings.ReplaceAll(urlPrefix, g.Cfg().MustGet(ctx, "filePrefix").String(), g.Cfg().MustGet(ctx, "minioPrefix").String()) - if err != nil { - return nil, err + if len(videoURL) > 1 { + var waitRes any + waitRes, err = VideoConcat(ctx, videoURL) + if err != nil { + return nil, err + } + msg := new(flowDto.VideoCallbackReq) + if err = gconv.Struct(waitRes, msg); err != nil { + return nil, err + } + var urlPrefix string + urlPrefix, err = utils.GetFileAddressPrefix(ctx) + newS := strings.ReplaceAll(urlPrefix, g.Cfg().MustGet(ctx, "filePrefix").String(), g.Cfg().MustGet(ctx, "minioPrefix").String()) + if err != nil { + return nil, err + } + videoUrl = newS + msg.FileURL + } else { + videoUrl = videoURL[0] } outputRes := make([]node.NodeFormField, 0) if nodeInput.Config.IsSaveFile { outputRes = append(outputRes, node.NodeFormField{ Field: fmt.Sprintf("video_oss_url:content:%d", 0), - Value: msg.FileURL, + Value: videoUrl, Label: fmt.Sprintf("video_oss_url:content:%d", 0), Type: "string", }) - } else { - outputRes = append(outputRes, node.NodeFormField{ - Field: fmt.Sprintf("concat_video_url:content:%d", 0), - Value: newS + msg.FileURL, - Label: fmt.Sprintf("concat_video_url:content:%d", 0), - Type: "string", - }) } + outputRes = append(outputRes, node.NodeFormField{ + Field: fmt.Sprintf("concat_video_url:content:%d", 0), + Value: videoUrl, + Label: fmt.Sprintf("concat_video_url:content:%d", 0), + Type: "string", + }) nodeInput.Config.OutputResult = outputRes return nodeInput, nil