diff --git a/src/utils/executionUtil.ts b/src/utils/executionUtil.ts index c8eaa3631d..976894a768 100644 --- a/src/utils/executionUtil.ts +++ b/src/utils/executionUtil.ts @@ -66,9 +66,19 @@ export const graphToPrompt = async ( for (const [i, widget] of widgets.entries()) { if (!widget.name || widget.options?.serialize === false) continue - inputs[widget.name] = widget.serializeValue + const widgetValue = widget.serializeValue ? await widget.serializeValue(node, i) : widget.value + // By default, Array values are reserved to represent node connections. + // We need to wrap the array as an object to avoid the misinterpretation + // of the array as a node connection. + // The backend automatically unwraps the object to an array during + // execution. + inputs[widget.name] = Array.isArray(widgetValue) + ? { + __value__: widgetValue + } + : widgetValue } }