fix: 修复模板字段取值逻辑并补充调试日志
This commit is contained in:
@@ -148,7 +148,7 @@ func ModelLambda(ctx context.Context, input any) (any, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
g.Log().Debugf(ctx, "modelId:%v ,outputRes: %v", nodeInput.Config.ModelConfig.ModelId, outputRes)
|
||||
nodeInput.Config.OutputResult = outputRes
|
||||
return nodeInput, nil
|
||||
}
|
||||
|
||||
@@ -147,6 +147,8 @@ func HttpCallResultLambda(ctx context.Context, nodeInput *flowDto.NodeExecutionI
|
||||
}
|
||||
}
|
||||
|
||||
g.Log().Debugf(ctx, "httpCallResultLambda: body: %v", body)
|
||||
|
||||
// 构建请求参数
|
||||
ProcessValueSourceRecursive(body, nodeInput.Global)
|
||||
// 递归剥掉 {type, value/attrs} 包裹层,只保留 key/value
|
||||
|
||||
@@ -186,21 +186,21 @@ func resolveValueSource(global *flowDto.FlowExecutionInput, nodeId, field string
|
||||
}
|
||||
}
|
||||
default:
|
||||
for _, output := range nodeConfig.OutputResult {
|
||||
// 模型节点输出记录是单 key 的字面量扁平 key(如 "choices.attrs[0].attrs.delta.attrs.content"),
|
||||
// gjson 会把 . 和 [0] 当结构路径解析,无法命中字面量 key,故先按字面量 key 直接取值;
|
||||
// 未命中再回退 gjson 路径查询(兼容真正嵌套的输出结构)。
|
||||
if v, has := output[field]; has {
|
||||
value = v
|
||||
} else {
|
||||
if field == "templates" {
|
||||
value = nodeConfig.Templates
|
||||
if field == "templates" {
|
||||
value = nodeConfig.Templates
|
||||
} else {
|
||||
for _, output := range nodeConfig.OutputResult {
|
||||
// 模型节点输出记录是单 key 的字面量扁平 key(如 "choices.attrs[0].attrs.delta.attrs.content"),
|
||||
// gjson 会把 . 和 [0] 当结构路径解析,无法命中字面量 key,故先按字面量 key 直接取值;
|
||||
// 未命中再回退 gjson 路径查询(兼容真正嵌套的输出结构)。
|
||||
if v, has := output[field]; has {
|
||||
value = v
|
||||
} else {
|
||||
value = gjson.Get(gconv.String(output), field).Value()
|
||||
}
|
||||
}
|
||||
if !g.IsEmpty(value) {
|
||||
return value, gjson.Get(gconv.String(output), CleanFieldPath("refsName")).Value(), true
|
||||
if !g.IsEmpty(value) {
|
||||
return value, gjson.Get(gconv.String(output), CleanFieldPath("refsName")).Value(), true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user