From 1c65bff31d86ea76ff5fca10341e71389d4de7b5 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sun, 5 Mar 2023 17:43:17 +0100 Subject: [PATCH] fix(OpenAI Node): Simplify code (#5618) fix(OpenAI Node): Simplifiy code --- .../nodes-base/nodes/OpenAi/ChatDescription.ts | 3 +-- packages/nodes-base/nodes/OpenAi/ChatFunctions.ts | 14 -------------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 packages/nodes-base/nodes/OpenAi/ChatFunctions.ts diff --git a/packages/nodes-base/nodes/OpenAi/ChatDescription.ts b/packages/nodes-base/nodes/OpenAi/ChatDescription.ts index a627ed8457578..9812d5dffbe83 100644 --- a/packages/nodes-base/nodes/OpenAi/ChatDescription.ts +++ b/packages/nodes-base/nodes/OpenAi/ChatDescription.ts @@ -1,5 +1,4 @@ import type { INodeExecutionData, INodeProperties } from 'n8n-workflow'; -import { chatBodyPresend } from './ChatFunctions'; export const chatOperations: INodeProperties[] = [ { @@ -115,7 +114,7 @@ const completeOperations: INodeProperties[] = [ send: { type: 'body', property: 'messages', - preSend: [chatBodyPresend], + value: '={{ $value.messages }}', }, }, }, diff --git a/packages/nodes-base/nodes/OpenAi/ChatFunctions.ts b/packages/nodes-base/nodes/OpenAi/ChatFunctions.ts deleted file mode 100644 index b87a4f9c8c812..0000000000000 --- a/packages/nodes-base/nodes/OpenAi/ChatFunctions.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { IDataObject, IExecuteSingleFunctions, IHttpRequestOptions } from 'n8n-workflow'; - -export async function chatBodyPresend( - this: IExecuteSingleFunctions, - requestOptions: IHttpRequestOptions, -): Promise { - const prompts = this.getNodeParameter('prompt', '{}') as IDataObject; - - requestOptions.body = Object.assign({}, requestOptions.body, { - messages: prompts.messages, - }); - - return requestOptions; -}