fix(OpenAI Node): Simplify code (#5618)

fix(OpenAI Node): Simplifiy code
This commit is contained in:
Jan Oberhauser 2023-03-05 17:43:17 +01:00 committed by GitHub
parent 3c57062571
commit 1c65bff31d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 16 deletions

View file

@ -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 }}',
},
},
},

View file

@ -1,14 +0,0 @@
import type { IDataObject, IExecuteSingleFunctions, IHttpRequestOptions } from 'n8n-workflow';
export async function chatBodyPresend(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
const prompts = this.getNodeParameter('prompt', '{}') as IDataObject;
requestOptions.body = Object.assign({}, requestOptions.body, {
messages: prompts.messages,
});
return requestOptions;
}