feat: 支持视频模型首帧参数及顺序执行逻辑
添加 FirstFrame 字段到模型信息结构体,重构视频节点数据转换处理,支持从上游节点获取视频配置并区分输出字段。实现视频结果重新上传至 OSS,修正字段匹配逻辑为精确匹配,并基于 return_last_frame 参数优化顺序执行中的首帧与内容传递。
This commit is contained in:
@@ -788,18 +788,41 @@ func VideoOptimizeNode(ctx context.Context, nodeInput *flowDto.NodeExecutionInpu
|
||||
}
|
||||
|
||||
func DataConversionNode(ctx context.Context, nodeInput *flowDto.NodeExecutionInput, skillName string, form []map[string]any, userForm []map[string]any) ([]node.NodeFormField, error) {
|
||||
if strings.Contains(nodeInput.Config.Name, "字幕") {
|
||||
if strings.Contains(nodeInput.Config.Name, "字幕") || strings.Contains(nodeInput.Config.Name, "视频") {
|
||||
jsonStr := ``
|
||||
for _, field := range nodeInput.Config.OutputConfig {
|
||||
jsonStr, _ = sjson.Set(jsonStr, field.Field, field.Value)
|
||||
}
|
||||
outputRes := make([]node.NodeFormField, 0)
|
||||
outputRes = append(outputRes, node.NodeFormField{
|
||||
Field: fmt.Sprintf("data_conversion"),
|
||||
Value: gconv.Map(jsonStr),
|
||||
Label: fmt.Sprintf("data_conversion"),
|
||||
Type: "string",
|
||||
})
|
||||
for _, field := range nodeInput.Config.OutputConfig {
|
||||
if strings.Contains(nodeInput.Config.Name, "视频") {
|
||||
for _, item := range nodeInput.Global.ExecutedNodes {
|
||||
refNode, ok := nodeInput.Global.ConfigMap[item.NodeId]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
for _, v := range refNode.FormConfig {
|
||||
if v.Field == field.Value {
|
||||
jsonStr, _ = sjson.Set(jsonStr, field.Field, v.Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
jsonStr, _ = sjson.Set(jsonStr, field.Field, field.Value)
|
||||
}
|
||||
}
|
||||
if strings.Contains(nodeInput.Config.Name, "视频") {
|
||||
outputRes = append(outputRes, node.NodeFormField{
|
||||
Field: fmt.Sprintf("data_content"),
|
||||
Value: gconv.Map(jsonStr),
|
||||
Label: fmt.Sprintf("data_content"),
|
||||
Type: "string",
|
||||
})
|
||||
} else {
|
||||
outputRes = append(outputRes, node.NodeFormField{
|
||||
Field: fmt.Sprintf("data_conversion"),
|
||||
Value: gconv.Map(jsonStr),
|
||||
Label: fmt.Sprintf("data_conversion"),
|
||||
Type: "string",
|
||||
})
|
||||
}
|
||||
return outputRes, nil
|
||||
}
|
||||
|
||||
@@ -1035,7 +1058,7 @@ func GetNodeContextContent(execInput *flowDto.FlowExecutionInput, nodeEntity *en
|
||||
// 取指定字段
|
||||
for _, f := range source.Field {
|
||||
for _, v := range refNode.FormConfig {
|
||||
if strings.Contains(v.Label, f) {
|
||||
if v.Label == f {
|
||||
input = append(input, v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user