@n8n/node-cli 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/commands/new/index.js +30 -1
- package/dist/commands/new/index.js.map +1 -1
- package/dist/commands/new/prompts.d.ts +2 -0
- package/dist/commands/new/prompts.js +46 -2
- package/dist/commands/new/prompts.js.map +1 -1
- package/dist/template/templates/index.d.ts +4 -0
- package/dist/template/templates/index.js +10 -2
- package/dist/template/templates/index.js.map +1 -1
- package/dist/template/templates/index.ts +8 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/README.md +46 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/nodes/ExampleChatMemory/ExampleChatMemory.node.json +18 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/nodes/ExampleChatMemory/ExampleChatMemory.node.ts +84 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/nodes/ExampleChatMemory/example.dark.svg +13 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/nodes/ExampleChatMemory/example.svg +13 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/nodes/ExampleChatMemory/memory.ts +29 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/package.json +50 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template/tsconfig.json +25 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template.d.ts +1 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template.js +14 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template.js.map +1 -0
- package/dist/template/templates/programmatic/ai/memory-custom/template.ts +9 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/README.md +46 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/credentials/ExampleApi.credentials.ts +54 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/icons/example.dark.svg +13 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/icons/example.svg +13 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/nodes/ExampleChatModel/ExampleChatModel.node.json +18 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/nodes/ExampleChatModel/ExampleChatModel.node.ts +113 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/nodes/ExampleChatModel/model.ts +115 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/package.json +52 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template/tsconfig.json +25 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template.d.ts +1 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template.js +14 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template.js.map +1 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom/template.ts +9 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/README.md +46 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/credentials/ExampleApi.credentials.ts +52 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/icons/example.dark.svg +13 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/icons/example.svg +13 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/nodes/ExampleChatModel/ExampleChatModel.node.json +18 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/nodes/ExampleChatModel/ExampleChatModel.node.ts +114 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/nodes/ExampleChatModel/common.ts +43 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/nodes/ExampleChatModel/model.ts +534 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/nodes/ExampleChatModel/properties.ts +130 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/package.json +52 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/tsconfig.json +25 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template.d.ts +1 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template.js +14 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template.js.map +1 -0
- package/dist/template/templates/programmatic/ai/model-ai-custom-example/template.ts +9 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/README.md +46 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/credentials/ExampleApi.credentials.ts +52 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/icons/example.dark.svg +13 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/icons/example.svg +13 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/nodes/ExampleChatModel/ExampleChatModel.node.json +18 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/nodes/ExampleChatModel/ExampleChatModel.node.ts +84 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/package.json +52 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template/tsconfig.json +25 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template.d.ts +1 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template.js +14 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template.js.map +1 -0
- package/dist/template/templates/programmatic/ai/model-openai-compatible/template.ts +9 -0
- package/dist/template/templates/programmatic/example/template/nodes/Example/Example.node.ts +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{nodePackageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package"
|
|
9
|
+
],
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "{{user.name}}",
|
|
12
|
+
"email": "{{user.email}}"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/<...>/n8n-nodes-<...>.git"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "n8n-node build",
|
|
20
|
+
"build:watch": "tsc --watch",
|
|
21
|
+
"dev": "n8n-node dev",
|
|
22
|
+
"lint": "n8n-node lint",
|
|
23
|
+
"lint:fix": "n8n-node lint --fix",
|
|
24
|
+
"release": "n8n-node release",
|
|
25
|
+
"prepublishOnly": "n8n-node prerelease"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"n8n": {
|
|
31
|
+
"n8nNodesApiVersion": 1,
|
|
32
|
+
"aiNodeSdkVersion": 1,
|
|
33
|
+
"strict": true,
|
|
34
|
+
"credentials": [
|
|
35
|
+
"dist/credentials/ExampleApi.credentials.js"
|
|
36
|
+
],
|
|
37
|
+
"nodes": [
|
|
38
|
+
"dist/nodes/ExampleChatModel/ExampleChatModel.node.js"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@n8n/node-cli": "*",
|
|
43
|
+
"eslint": "9.32.0",
|
|
44
|
+
"prettier": "3.6.2",
|
|
45
|
+
"release-it": "^19.0.4",
|
|
46
|
+
"typescript": "5.9.2"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"n8n-workflow": "*",
|
|
50
|
+
"@n8n/ai-node-sdk": "*"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/dist/template/templates/programmatic/ai/model-ai-custom-example/template/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"target": "es2019",
|
|
7
|
+
"lib": ["es2019", "es2020", "es2022.error"],
|
|
8
|
+
"removeComments": true,
|
|
9
|
+
"useUnknownInCatchVariables": false,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"preserveConstEnums": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"sourceMap": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"outDir": "./dist/"
|
|
23
|
+
},
|
|
24
|
+
"include": ["credentials/**/*", "nodes/**/*", "nodes/**/*.json", "package.json"]
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const customChatModelExampleTemplate: import("../../../../core").TemplateWithRun<object>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.customChatModelExampleTemplate = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const core_1 = require("../../../../core");
|
|
9
|
+
exports.customChatModelExampleTemplate = (0, core_1.createTemplate)({
|
|
10
|
+
name: 'OpenAI chat model node',
|
|
11
|
+
description: 'Chat model node with custom implementation',
|
|
12
|
+
path: node_path_1.default.join(__dirname, 'template'),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../../src/template/templates/programmatic/ai/model-ai-custom-example/template.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,2CAAkD;AAErC,QAAA,8BAA8B,GAAG,IAAA,qBAAc,EAAC;IAC5D,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,4CAA4C;IACzD,IAAI,EAAE,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { createTemplate } from '../../../../core';
|
|
4
|
+
|
|
5
|
+
export const customChatModelExampleTemplate = createTemplate({
|
|
6
|
+
name: 'OpenAI chat model node',
|
|
7
|
+
description: 'Chat model node with custom implementation',
|
|
8
|
+
path: path.join(__dirname, 'template'),
|
|
9
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# {{nodePackageName}}
|
|
2
|
+
|
|
3
|
+
This is an n8n community node. It lets you use _app/service name_ in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
_App/service name_ is _one or two sentences describing the service this node integrates with_.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation)
|
|
10
|
+
[Operations](#operations)
|
|
11
|
+
[Credentials](#credentials)
|
|
12
|
+
[Compatibility](#compatibility)
|
|
13
|
+
[Usage](#usage)
|
|
14
|
+
[Resources](#resources)
|
|
15
|
+
[Version history](#version-history)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
20
|
+
|
|
21
|
+
## Operations
|
|
22
|
+
|
|
23
|
+
_List the operations supported by your node._
|
|
24
|
+
|
|
25
|
+
## Credentials
|
|
26
|
+
|
|
27
|
+
_If users need to authenticate with the app/service, provide details here. You should include prerequisites (such as signing up with the service), available authentication methods, and how to set them up._
|
|
28
|
+
|
|
29
|
+
## Compatibility
|
|
30
|
+
|
|
31
|
+
_State the minimum n8n version, as well as which versions you test against. You can also include any known version incompatibility issues._
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
_This is an optional section. Use it to help users with any difficult or confusing aspects of the node._
|
|
36
|
+
|
|
37
|
+
_By the time users are looking for community nodes, they probably already know n8n basics. But if you expect new users, you can link to the [Try it out](https://docs.n8n.io/try-it-out/) documentation to help them get started._
|
|
38
|
+
|
|
39
|
+
## Resources
|
|
40
|
+
|
|
41
|
+
* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
42
|
+
* _Link to app/service documentation._
|
|
43
|
+
|
|
44
|
+
## Version history
|
|
45
|
+
|
|
46
|
+
_This is another optional section. If your node has multiple versions, include a short description of available versions and what changed, as well as any compatibility impact._
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICredentialDataDecryptedObject,
|
|
3
|
+
ICredentialTestRequest,
|
|
4
|
+
ICredentialType,
|
|
5
|
+
IHttpRequestOptions,
|
|
6
|
+
INodeProperties,
|
|
7
|
+
Icon,
|
|
8
|
+
} from 'n8n-workflow';
|
|
9
|
+
|
|
10
|
+
export class ExampleApi implements ICredentialType {
|
|
11
|
+
name = 'exampleApi';
|
|
12
|
+
|
|
13
|
+
displayName = 'Example API';
|
|
14
|
+
|
|
15
|
+
icon: Icon = { light: 'file:../icons/example.svg', dark: 'file:../icons/example.dark.svg' };
|
|
16
|
+
|
|
17
|
+
properties: INodeProperties[] = [
|
|
18
|
+
{
|
|
19
|
+
displayName: 'API Key',
|
|
20
|
+
name: 'apiKey',
|
|
21
|
+
type: 'string',
|
|
22
|
+
typeOptions: { password: true },
|
|
23
|
+
required: true,
|
|
24
|
+
default: '',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Base URL',
|
|
28
|
+
name: 'url',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
description: 'Override the default base URL for the API',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
test: ICredentialTestRequest = {
|
|
36
|
+
request: {
|
|
37
|
+
baseURL: '={{$credentials?.url}}',
|
|
38
|
+
url: '/models',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
async authenticate(
|
|
43
|
+
credentials: ICredentialDataDecryptedObject,
|
|
44
|
+
requestOptions: IHttpRequestOptions,
|
|
45
|
+
): Promise<IHttpRequestOptions> {
|
|
46
|
+
requestOptions.headers ??= {};
|
|
47
|
+
|
|
48
|
+
requestOptions.headers['Authorization'] = `Bearer ${credentials.apiKey}`;
|
|
49
|
+
|
|
50
|
+
return requestOptions;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="aquamarine"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
package/dist/template/templates/programmatic/ai/model-openai-compatible/template/icons/example.svg
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="darkblue"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "{{nodePackageName}}",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Development", "Developer Tools"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/org/repo?tab=readme-ov-file#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/org/repo?tab=readme-ov-file"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { INodeType, INodeTypeDescription, ISupplyDataFunctions } from 'n8n-workflow';
|
|
2
|
+
import { NodeConnectionTypes } from 'n8n-workflow';
|
|
3
|
+
import { supplyModel } from '@n8n/ai-node-sdk';
|
|
4
|
+
|
|
5
|
+
type ModelOptions = {
|
|
6
|
+
temperature?: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export class ExampleChatModel implements INodeType {
|
|
10
|
+
description: INodeTypeDescription = {
|
|
11
|
+
displayName: 'Example Chat Model',
|
|
12
|
+
name: 'exampleChatModel',
|
|
13
|
+
icon: { light: 'file:../../icons/example.svg', dark: 'file:../../icons/example.dark.svg' },
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: [1],
|
|
16
|
+
description: 'Chat model node for OpenAI API compatible providers',
|
|
17
|
+
defaults: {
|
|
18
|
+
name: 'Example Chat Model',
|
|
19
|
+
},
|
|
20
|
+
codex: {
|
|
21
|
+
categories: ['assistant'],
|
|
22
|
+
subcategories: {
|
|
23
|
+
AI: ['Language Models', 'Root Nodes'],
|
|
24
|
+
'Language Models': ['Chat Models (Recommended)'],
|
|
25
|
+
},
|
|
26
|
+
resources: {
|
|
27
|
+
primaryDocumentation: [],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
inputs: [],
|
|
32
|
+
|
|
33
|
+
outputs: [NodeConnectionTypes.AiLanguageModel],
|
|
34
|
+
outputNames: ['Model'],
|
|
35
|
+
credentials: [
|
|
36
|
+
{
|
|
37
|
+
name: 'exampleApi',
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
properties: [
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Model',
|
|
44
|
+
name: 'model',
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: '',
|
|
47
|
+
description: 'The model which will generate the completion',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Options',
|
|
51
|
+
name: 'options',
|
|
52
|
+
placeholder: 'Add Option',
|
|
53
|
+
description: 'Additional options to add',
|
|
54
|
+
type: 'collection',
|
|
55
|
+
default: {},
|
|
56
|
+
options: [
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Sampling Temperature',
|
|
59
|
+
name: 'temperature',
|
|
60
|
+
default: 0.7,
|
|
61
|
+
typeOptions: { maxValue: 2, minValue: 0, numberPrecision: 1 },
|
|
62
|
+
description:
|
|
63
|
+
'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.',
|
|
64
|
+
type: 'number',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
async supplyData(this: ISupplyDataFunctions, itemIndex: number) {
|
|
72
|
+
const credentials = await this.getCredentials('exampleApi');
|
|
73
|
+
const modelName = this.getNodeParameter('model', itemIndex) as string;
|
|
74
|
+
const options = this.getNodeParameter('options', itemIndex, {}) as ModelOptions;
|
|
75
|
+
|
|
76
|
+
return supplyModel(this, {
|
|
77
|
+
type: 'openai',
|
|
78
|
+
baseUrl: credentials.url as string,
|
|
79
|
+
apiKey: credentials.apiKey as string,
|
|
80
|
+
model: modelName,
|
|
81
|
+
temperature: options.temperature,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{nodePackageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package"
|
|
9
|
+
],
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "{{user.name}}",
|
|
12
|
+
"email": "{{user.email}}"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/<...>/n8n-nodes-<...>.git"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "n8n-node build",
|
|
20
|
+
"build:watch": "tsc --watch",
|
|
21
|
+
"dev": "n8n-node dev",
|
|
22
|
+
"lint": "n8n-node lint",
|
|
23
|
+
"lint:fix": "n8n-node lint --fix",
|
|
24
|
+
"release": "n8n-node release",
|
|
25
|
+
"prepublishOnly": "n8n-node prerelease"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"n8n": {
|
|
31
|
+
"n8nNodesApiVersion": 1,
|
|
32
|
+
"aiNodeSdkVersion": 1,
|
|
33
|
+
"strict": true,
|
|
34
|
+
"credentials": [
|
|
35
|
+
"dist/credentials/ExampleApi.credentials.js"
|
|
36
|
+
],
|
|
37
|
+
"nodes": [
|
|
38
|
+
"dist/nodes/ExampleChatModel/ExampleChatModel.node.js"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@n8n/node-cli": "*",
|
|
43
|
+
"eslint": "9.32.0",
|
|
44
|
+
"prettier": "3.6.2",
|
|
45
|
+
"release-it": "^19.0.4",
|
|
46
|
+
"typescript": "5.9.2"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"n8n-workflow": "*",
|
|
50
|
+
"@n8n/ai-node-sdk": "*"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/dist/template/templates/programmatic/ai/model-openai-compatible/template/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"target": "es2019",
|
|
7
|
+
"lib": ["es2019", "es2020", "es2022.error"],
|
|
8
|
+
"removeComments": true,
|
|
9
|
+
"useUnknownInCatchVariables": false,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"preserveConstEnums": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"sourceMap": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"outDir": "./dist/"
|
|
23
|
+
},
|
|
24
|
+
"include": ["credentials/**/*", "nodes/**/*", "nodes/**/*.json", "package.json"]
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const openaiChatModelTemplate: import("../../../../core").TemplateWithRun<object>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.openaiChatModelTemplate = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const core_1 = require("../../../../core");
|
|
9
|
+
exports.openaiChatModelTemplate = (0, core_1.createTemplate)({
|
|
10
|
+
name: 'OpenAI compatible chat model node',
|
|
11
|
+
description: 'Chat model node for OpenAI-compatible providers',
|
|
12
|
+
path: node_path_1.default.join(__dirname, 'template'),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../../src/template/templates/programmatic/ai/model-openai-compatible/template.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,2CAAkD;AAErC,QAAA,uBAAuB,GAAG,IAAA,qBAAc,EAAC;IACrD,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,iDAAiD;IAC9D,IAAI,EAAE,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;CACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { createTemplate } from '../../../../core';
|
|
4
|
+
|
|
5
|
+
export const openaiChatModelTemplate = createTemplate({
|
|
6
|
+
name: 'OpenAI compatible chat model node',
|
|
7
|
+
description: 'Chat model node for OpenAI-compatible providers',
|
|
8
|
+
path: path.join(__dirname, 'template'),
|
|
9
|
+
});
|
|
@@ -12,7 +12,7 @@ export class Example implements INodeType {
|
|
|
12
12
|
name: 'example',
|
|
13
13
|
icon: { light: 'file:example.svg', dark: 'file:example.dark.svg' },
|
|
14
14
|
group: ['input'],
|
|
15
|
-
version: 1,
|
|
15
|
+
version: [1],
|
|
16
16
|
description: 'Basic Example Node',
|
|
17
17
|
defaults: {
|
|
18
18
|
name: 'Example',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/node-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Official CLI for developing community nodes for n8n",
|
|
5
5
|
"bin": {
|
|
6
6
|
"n8n-node": "bin/n8n-node.mjs"
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"rimraf": "6.0.1",
|
|
46
46
|
"ts-morph": "^27.0.2",
|
|
47
47
|
"typescript-eslint": "^8.35.0",
|
|
48
|
-
"@n8n/eslint-plugin-community-nodes": "0.
|
|
48
|
+
"@n8n/eslint-plugin-community-nodes": "0.8.0",
|
|
49
|
+
"@n8n/ai-node-sdk": "0.2.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@eslint/js": "^9.29.0",
|
|
@@ -54,8 +55,8 @@
|
|
|
54
55
|
"typescript": "5.9.2",
|
|
55
56
|
"vitest": "^3.1.3",
|
|
56
57
|
"vitest-mock-extended": "^3.1.0",
|
|
57
|
-
"@n8n/
|
|
58
|
-
"@n8n/
|
|
58
|
+
"@n8n/typescript-config": "1.3.0",
|
|
59
|
+
"@n8n/vitest-config": "1.7.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"eslint": ">= 9"
|