From 58156eeeec17d809387ed960d3613551b2e339c2 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:02:15 +0300 Subject: [PATCH] fix(OpenAI Node): Allow to pass files ids as comma separated string in expressions (no-changelog) (#9240) --- .../vendors/OpenAi/actions/assistant/create.operation.ts | 7 +++++-- .../vendors/OpenAi/actions/assistant/update.operation.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/create.operation.ts b/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/create.operation.ts index 185e0d94f9..30664aebcc 100644 --- a/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/create.operation.ts +++ b/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/create.operation.ts @@ -62,7 +62,7 @@ const properties: INodeProperties[] = [ type: 'multiOptions', // eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-multi-options description: - 'The files to be used by the assistant, there can be a maximum of 20 files attached to the assistant', + 'The files to be used by the assistant, there can be a maximum of 20 files attached to the assistant. You can use expression to pass file IDs as an array or comma-separated string.', typeOptions: { loadOptionsMethod: 'getFiles', }, @@ -161,7 +161,10 @@ export async function execute(this: IExecuteFunctions, i: number): Promise file_id.trim()); + } const options = this.getNodeParameter('options', i, {}); if (options.failIfExists) { diff --git a/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/update.operation.ts b/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/update.operation.ts index 1fe365b505..bdf92c0d6b 100644 --- a/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/update.operation.ts +++ b/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/actions/assistant/update.operation.ts @@ -41,7 +41,7 @@ const properties: INodeProperties[] = [ type: 'multiOptions', // eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-multi-options description: - 'The files to be used by the assistant, there can be a maximum of 20 files attached to the assistant', + 'The files to be used by the assistant, there can be a maximum of 20 files attached to the assistant. You can use expression to pass file IDs as an array or comma-separated string.', typeOptions: { loadOptionsMethod: 'getFiles', }, @@ -116,6 +116,10 @@ export async function execute(this: IExecuteFunctions, i: number): Promise file_id.trim()); + } if ((file_ids as IDataObject[]).length > 20) { throw new NodeOperationError( this.getNode(), @@ -124,7 +128,7 @@ export async function execute(this: IExecuteFunctions, i: number): Promise