fix: 修复模板字段取值逻辑并补充调试日志

This commit is contained in:
2026-08-22 10:55:04 +08:00
parent 76b899133e
commit f34566d9ad
3 changed files with 15 additions and 13 deletions
+12 -12
View File
@@ -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
}
}
}
}