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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: handle array item type error in struct output (#18452)
Joel5d9c67e97e60
diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.tsindex 7299bcb34ee..e6434cd8c52 100644--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts@@ -57,7 +57,14 @@ const inputVarTypeToVarType = (type: InputVarType): VarType => {} as any)[type] || VarType.string}-const structTypeToVarType = (type: Type): VarType => {+const structTypeToVarType = (type: Type, isArray?: boolean): VarType => {+ if (isArray) {+ return ({+ [Type.string]: VarType.arrayString,+ [Type.number]: VarType.arrayNumber,+ [Type.object]: VarType.arrayObject,+ } as any)[type] || VarType.string+ }return ({[Type.string]: VarType.string,[Type.number]: VarType.number,@@ -82,9 +89,12 @@ const findExceptVarInStructuredProperties = (properties: Record<string, StructFiObject.keys(properties).forEach((key) => {const item = properties[key]const isObj = item.type === Type.object+ const isArray = item.type === Type.array+ const arrayType = item.items?.type+if (!isObj && !filterVar({variable: key,- type: structTypeToVarType(item.type),+ type: structTypeToVarType(isArray ? arrayType! : item.type, isArray),}, [key])) {delete properties[key]return@@ -103,9 +113,11 @@ const findExceptVarInStructuredOutput = (structuredOutput: StructuredOutput, filObject.keys(properties).forEach((key) => {const item = properties[key]const isObj = item.type === Type.object+ const isArray = item.type === Type.array+ const arrayType = item.items?.typeif (!isObj && !filterVar({variable: key,- type: structTypeToVarType(item.type),+ type: structTypeToVarType(isArray ? arrayType! : item.type, isArray),}, [key])) {delete properties[key]return@@ -1314,9 +1326,12 @@ const varToValueSelectorList = (v: Var, parentValueSelector: ValueSelector, res:}if (isStructuredOutput) {Object.keys((v.children as StructuredOutput)?.schema?.properties || {}).forEach((key) => {+ const type = (v.children as StructuredOutput)?.schema?.properties[key].type+ const isArray = type === Type.array+ const arrayType = (v.children as StructuredOutput)?.schema?.properties[key].items?.typevarToValueSelectorList({variable: key,- type: structTypeToVarType((v.children as StructuredOutput)?.schema?.properties[key].type),+ type: structTypeToVarType(isArray ? arrayType! : type, isArray),}, [...parentValueSelector, v.variable], res)})}diff --git a/web/app/components/workflow/nodes/llm/types.ts b/web/app/components/workflow/nodes/llm/types.tsindex a4931f70178..c1d33a2e921 100644--- a/web/app/components/workflow/nodes/llm/types.ts+++ b/web/app/components/workflow/nodes/llm/types.ts@@ -25,6 +25,9 @@ export enum Type {boolean = 'boolean',object = 'object',array = 'array',+ arrayString = 'array[string]',+ arrayNumber = 'array[number]',+ arrayObject = 'array[object]',}export enum ArrayType {