mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
7a984bb6b7
* 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>
55 lines
1.1 KiB
TypeScript
55 lines
1.1 KiB
TypeScript
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,
|
|
],
|
|
};
|
|
}
|