feat: 支持视频模型首帧参数及顺序执行逻辑
添加 FirstFrame 字段到模型信息结构体,重构视频节点数据转换处理,支持从上游节点获取视频配置并区分输出字段。实现视频结果重新上传至 OSS,修正字段匹配逻辑为精确匹配,并基于 return_last_frame 参数优化顺序执行中的首帧与内容传递。
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
flowDto "ai-agent/workflow/model/dto/flow"
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -292,7 +293,23 @@ func VideoModelLambda(ctx context.Context, input any) (any, error) {
|
||||
}
|
||||
videoUrl = newS + msg.FileURL
|
||||
} else {
|
||||
videoUrl = videoURL[0]
|
||||
var bytes []byte
|
||||
bytes, err = GetFileBytesFromURL(ctx, videoURL[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("下载图片失败: %w", err)
|
||||
}
|
||||
// 构造文件名
|
||||
fileName := fmt.Sprintf("ai_video_%d%s", time.Now().UnixMilli(), strings.ToLower(filepath.Ext(videoURL[0])))
|
||||
// 上传到你的OSS(你项目已有的Upload方法)
|
||||
var upResp *dto.UploadFileBytesRes
|
||||
upResp, err = Upload(ctx, &dto.UploadFileBytesReq{
|
||||
FileName: fileName,
|
||||
FileBytes: bytes,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("上传OSS失败: %w", err)
|
||||
}
|
||||
videoUrl = upResp.FileURL
|
||||
}
|
||||
|
||||
outputRes := make([]node.NodeFormField, 0)
|
||||
|
||||
Reference in New Issue
Block a user