mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(OpenAI Node): Add a node to work with OpenAI (#4932)
* feat(OpenAI Node): Add a node to work with OpenAI * Added codex file for OpenAi node * Minor tweaks to Operation Image. * Minor tweaks to Resource Text. * Minor copy modification to Image:Create. * Removed "a Text" in Text operations names. * ⚡ Connect Response Format parameter and other improvements * ✨ Add "filter" postReceiveAction * ⚡ Rename operations and add spelling mistake again to example * ⚡ Rename another operation Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com> Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
54
packages/nodes-base/nodes/OpenAi/OpenAi.node.ts
Normal file
54
packages/nodes-base/nodes/OpenAi/OpenAi.node.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
import { imageFields, imageOperations } from './ImageDescription';
|
||||
import { textFields, textOperations } from './TextDescription';
|
||||
|
||||
export class OpenAi implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'OpenAI',
|
||||
name: 'openAi',
|
||||
icon: 'file:openAi.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume Open AI',
|
||||
defaults: {
|
||||
name: 'OpenAI',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'openAiApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
requestDefaults: {
|
||||
baseURL: 'https://api.openai.com',
|
||||
},
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Image',
|
||||
value: 'image',
|
||||
},
|
||||
{
|
||||
name: 'Text',
|
||||
value: 'text',
|
||||
},
|
||||
],
|
||||
default: 'text',
|
||||
},
|
||||
|
||||
...imageOperations,
|
||||
...imageFields,
|
||||
|
||||
...textOperations,
|
||||
...textFields,
|
||||
],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user