fix: 修复字幕节点数据转换逻辑
This commit is contained in:
@@ -776,6 +776,21 @@ 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, "字幕") {
|
||||
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",
|
||||
})
|
||||
return outputRes, nil
|
||||
}
|
||||
|
||||
jsonStr := ``
|
||||
jsonVal := "输出字段规范:"
|
||||
for _, field := range nodeInput.Config.OutputConfig {
|
||||
@@ -784,7 +799,6 @@ func DataConversionNode(ctx context.Context, nodeInput *flowDto.NodeExecutionInp
|
||||
}
|
||||
jsonVal += fmt.Sprintf("输出模板结构,仅修改每个字段对应数值:%s", jsonStr)
|
||||
nodeInput.Config.PromptContent = fmt.Sprintf("%s;%s", nodeInput.Config.PromptContent, jsonVal)
|
||||
|
||||
mapTaskResult, err := GetModelResult(ctx, "", nodeInput, skillName, form, userForm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user