feat(backend): batch & loop node fix get input

This commit is contained in:
zhuangjie.1125
2025-07-21 18:30:36 +08:00
committed by 庄杰
parent 249c23c64b
commit 31621542c8
4 changed files with 317 additions and 24 deletions

View File

@@ -199,21 +199,16 @@ func (l *Loop) Execute(ctx context.Context, in map[string]any, opts ...nodes.Nes
currentKey := string(l.config.LoopNodeKey) + "#" + arrayKey
// Recursively expand map[string]any elements
if m, ok := ele.(map[string]any); ok {
var expand func(prefix string, val interface{})
expand = func(prefix string, val interface{}) {
if nestedMap, ok := val.(map[string]any); ok {
for k, v := range nestedMap {
expand(prefix+"#"+k, v)
}
} else {
input[prefix] = val
var expand func(prefix string, val interface{})
expand = func(prefix string, val interface{}) {
input[prefix] = val
if nestedMap, ok := val.(map[string]any); ok {
for k, v := range nestedMap {
expand(prefix+"#"+k, v)
}
}
expand(currentKey, m)
} else {
input[currentKey] = ele
}
expand(currentKey, ele)
}
return input, items, nil