Skip to content

Commit

Permalink
fix(core): Fix resolving of $fromAI expression via `evaluateExpressio…
Browse files Browse the repository at this point in the history
…n` (#11397)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <[email protected]>
  • Loading branch information
OlegIvaniv and netroy authored Oct 24, 2024
1 parent 8608bae commit 2e64464
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2856,6 +2856,8 @@ async function getInputConnectionData(
connectedNode.typeVersion,
);

// TODO: create a new context object here based on the type of `connectedNode`, and avoid using `Object.assign` on context objects
// https://linear.app/n8n/issue/CAT-269
const context = Object.assign({}, this);

context.getNodeParameter = (
Expand Down Expand Up @@ -3758,14 +3760,16 @@ export function getExecuteFunctions(
continueOnFail: () => {
return continueOnFail(node);
},
evaluateExpression: (expression: string, itemIndex: number) => {
evaluateExpression(expression: string, itemIndex: number) {
return workflow.expression.resolveSimpleParameterValue(
`=${expression}`,
{},
runExecutionData,
runIndex,
itemIndex,
node.name,
// TODO: revert this back to `node.name` when we stop using `IExecuteFunctions` as the context object in AI nodes.
// https://linear.app/n8n/issue/CAT-269
this.getNode().name,
connectionInputData,
mode,
getAdditionalKeys(additionalData, mode, runExecutionData),
Expand Down

0 comments on commit 2e64464

Please sign in to comment.