mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
fix: iteration file arry type
This commit is contained in:
parent
403fede432
commit
602d2486bd
|
@ -402,18 +402,19 @@ const getIterationItemType = ({
|
|||
beforeNodesOutputVars: NodeOutPutVar[]
|
||||
}): VarType => {
|
||||
const outputVarNodeId = valueSelector[0]
|
||||
const targetVar = beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId)
|
||||
const isSystem = isSystemVar(valueSelector)
|
||||
|
||||
const targetVar = isSystem ? beforeNodesOutputVars.find(v => v.isStartNode) : beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId)
|
||||
if (!targetVar)
|
||||
return VarType.string
|
||||
|
||||
let arrayType: VarType = VarType.string
|
||||
|
||||
const isSystem = isSystemVar(valueSelector)
|
||||
let curr: any = targetVar.vars
|
||||
|
||||
if (isSystem)
|
||||
return curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type;
|
||||
|
||||
if (isSystem) {
|
||||
arrayType = curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type
|
||||
}
|
||||
else {
|
||||
(valueSelector).slice(1).forEach((key, i) => {
|
||||
const isLast = i === valueSelector.length - 2
|
||||
curr = curr?.find((v: any) => v.variable === key)
|
||||
|
@ -425,6 +426,8 @@ const getIterationItemType = ({
|
|||
curr = curr.children
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
switch (arrayType as VarType) {
|
||||
case VarType.arrayString:
|
||||
return VarType.string
|
||||
|
@ -435,7 +438,7 @@ const getIterationItemType = ({
|
|||
case VarType.array:
|
||||
return VarType.any
|
||||
case VarType.arrayFile:
|
||||
return VarType.object
|
||||
return VarType.file
|
||||
default:
|
||||
return VarType.string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user