Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: item data type wrong in iteration (#19709)

Joel486a66be54f5
diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
index 751d438d684..443329a9246 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
@@ -613,6 +613,7 @@ const getIterationItemType = ({
const isSystem = isSystemVar(valueSelector)
const targetVar = isSystem ? beforeNodesOutputVars.find(v => v.isStartNode) : beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId)
+
if (!targetVar)
return VarType.string
@@ -623,9 +624,9 @@ const getIterationItemType = ({
arrayType = curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type
}
else {
- for (let i = 1; i < valueSelector.length - 1; i++) {
+ for (let i = 1; i < valueSelector.length; i++) {
const key = valueSelector[i]
- const isLast = i === valueSelector.length - 2
+ const isLast = i === valueSelector.length - 1
curr = Array.isArray(curr) ? curr.find(v => v.variable === key) : []
if (isLast)