mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(OpenAI Node): Simplify code (#5618)
fix(OpenAI Node): Simplifiy code
This commit is contained in:
parent
3c57062571
commit
1c65bff31d
|
@ -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 }}',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue