fix(core): Fix support for multiple invocation of AI tools (#12141)

Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-12-11 13:47:13 +01:00
committed by GitHub
parent f4c2523419
commit c572c0648c
10 changed files with 605 additions and 226 deletions

View File

@@ -945,10 +945,11 @@ export class WorkflowDataProxy {
_type: string = 'string',
defaultValue?: unknown,
) => {
const { itemIndex, runIndex } = that;
if (!name || name === '') {
throw new ExpressionError("Add a key, e.g. $fromAI('placeholder_name')", {
runIndex: that.runIndex,
itemIndex: that.itemIndex,
runIndex,
itemIndex,
});
}
const nameValidationRegex = /^[a-zA-Z0-9_-]{0,64}$/;
@@ -956,20 +957,20 @@ export class WorkflowDataProxy {
throw new ExpressionError(
'Invalid parameter key, must be between 1 and 64 characters long and only contain lowercase letters, uppercase letters, numbers, underscores, and hyphens',
{
runIndex: that.runIndex,
itemIndex: that.itemIndex,
runIndex,
itemIndex,
},
);
}
const inputData =
that.runExecutionData?.resultData.runData[that.activeNodeName]?.[runIndex].inputOverride;
const placeholdersDataInputData =
that.runExecutionData?.resultData.runData[that.activeNodeName]?.[0].inputOverride?.[
NodeConnectionType.AiTool
]?.[0]?.[0].json;
inputData?.[NodeConnectionType.AiTool]?.[0]?.[itemIndex].json;
if (Boolean(!placeholdersDataInputData)) {
throw new ExpressionError('No execution data available', {
runIndex: that.runIndex,
itemIndex: that.itemIndex,
runIndex,
itemIndex,
type: 'no_execution_data',
});
}