n8n-nodes-rooyai-model 1.0.2 → 1.0.3

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.
@@ -0,0 +1,6 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class RooyaiAccount implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ properties: INodeProperties[];
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RooyaiAccount = void 0;
4
+ class RooyaiAccount {
5
+ constructor() {
6
+ this.name = 'rooyaiAccount';
7
+ this.displayName = 'Rooyai Account';
8
+ this.properties = [
9
+ {
10
+ displayName: 'Account Token',
11
+ name: 'token',
12
+ type: 'string',
13
+ typeOptions: { password: true },
14
+ default: '',
15
+ required: true,
16
+ },
17
+ ];
18
+ }
19
+ }
20
+ exports.RooyaiAccount = RooyaiAccount;
@@ -0,0 +1,5 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class RooyaiChatModel implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RooyaiChatModel = void 0;
4
+ class RooyaiChatModel {
5
+ constructor() {
6
+ this.description = {
7
+ displayName: 'Rooyai Chat Model',
8
+ name: 'rooyaiChatModel',
9
+ icon: 'file:rooyai.svg',
10
+ group: ['transform'],
11
+ version: 1,
12
+ description: 'Rooyai AI Chat Model',
13
+ defaults: { name: 'Rooyai Chat Model' },
14
+ inputs: ['main'],
15
+ outputs: ['main'],
16
+ credentials: [
17
+ { name: 'rooyaiAccount', required: true },
18
+ { name: 'rooyaiOpenAI', required: false },
19
+ { name: 'rooyaiOpenRouter', required: false },
20
+ ],
21
+ properties: [
22
+ {
23
+ displayName: 'Provider',
24
+ name: 'provider',
25
+ type: 'options',
26
+ options: [
27
+ { name: 'OpenAI', value: 'openai' },
28
+ { name: 'OpenRouter', value: 'openrouter' },
29
+ ],
30
+ default: 'openrouter',
31
+ },
32
+ {
33
+ displayName: 'Model',
34
+ name: 'model',
35
+ type: 'string',
36
+ default: 'gpt-4o',
37
+ displayOptions: { show: { provider: ['openai'] } },
38
+ },
39
+ {
40
+ displayName: 'Model',
41
+ name: 'model',
42
+ type: 'string',
43
+ default: 'openai/gpt-4o',
44
+ displayOptions: { show: { provider: ['openrouter'] } },
45
+ },
46
+ {
47
+ displayName: 'Messages',
48
+ name: 'messages',
49
+ type: 'string',
50
+ default: '',
51
+ },
52
+ ],
53
+ };
54
+ }
55
+ async execute() {
56
+ const items = this.getInputData();
57
+ const credentials = await this.getCredentials('rooyaiAccount');
58
+ const provider = this.getNodeParameter('provider', 0);
59
+ let providerCreds;
60
+ if (provider === 'openai') {
61
+ providerCreds = await this.getCredentials('rooyaiOpenAI');
62
+ }
63
+ else {
64
+ providerCreds = await this.getCredentials('rooyaiOpenRouter');
65
+ }
66
+ const response = await this.helpers.request({
67
+ method: 'POST',
68
+ url: 'http://35.226.94.120:3000/v1/chat/completions',
69
+ body: {
70
+ token: credentials.token,
71
+ provider,
72
+ apiKey: providerCreds.apiKey,
73
+ model: this.getNodeParameter('model', 0),
74
+ messages: [{ role: 'user', content: this.getNodeParameter('messages', 0) }],
75
+ },
76
+ json: true,
77
+ });
78
+ return [[{ json: response }]];
79
+ }
80
+ }
81
+ exports.RooyaiChatModel = RooyaiChatModel;
@@ -0,0 +1,6 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class RooyaiOpenAI implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ properties: INodeProperties[];
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RooyaiOpenAI = void 0;
4
+ class RooyaiOpenAI {
5
+ constructor() {
6
+ this.name = 'rooyaiOpenAI';
7
+ this.displayName = 'Rooyai OpenAI';
8
+ this.properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: { password: true },
14
+ default: '',
15
+ required: true,
16
+ },
17
+ ];
18
+ }
19
+ }
20
+ exports.RooyaiOpenAI = RooyaiOpenAI;
@@ -0,0 +1,6 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class RooyaiOpenRouter implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ properties: INodeProperties[];
6
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RooyaiOpenRouter = void 0;
4
+ class RooyaiOpenRouter {
5
+ constructor() {
6
+ this.name = 'rooyaiOpenRouter';
7
+ this.displayName = 'Rooyai OpenRouter';
8
+ this.properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: { password: true },
14
+ default: '',
15
+ required: true,
16
+ },
17
+ ];
18
+ }
19
+ }
20
+ exports.RooyaiOpenRouter = RooyaiOpenRouter;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "n8n-nodes-rooyai-model",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Rooyai AI Model Integration for n8n",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
7
7
  ],
8
- "author": "Rooyai",
9
8
  "license": "MIT",
9
+ "author": "Rooyai",
10
+ "main": "index.js",
10
11
  "n8n": {
11
12
  "credentials": [
12
13
  "dist/RooyaiAccount.credentials.js",
@@ -17,8 +18,15 @@
17
18
  "dist/RooyaiChatModel.node.js"
18
19
  ]
19
20
  },
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
20
28
  "devDependencies": {
21
- "n8n-workflow": "*",
22
- "typescript": "*"
29
+ "n8n-workflow": "^1.0.0",
30
+ "typescript": "^5.9.3"
23
31
  }
24
32
  }
@@ -1,16 +0,0 @@
1
- import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
-
3
- export class RooyaiAccount implements ICredentialType {
4
- name = 'rooyaiAccount';
5
- displayName = 'Rooyai Account';
6
- properties: INodeProperties[] = [
7
- {
8
- displayName: 'Account Token',
9
- name: 'token',
10
- type: 'string',
11
- typeOptions: { password: true },
12
- default: '',
13
- required: true,
14
- },
15
- ];
16
- }
@@ -1,85 +0,0 @@
1
- import {
2
- IExecuteFunctions,
3
- INodeExecutionData,
4
- INodeType,
5
- INodeTypeDescription,
6
- } from 'n8n-workflow';
7
-
8
- export class RooyaiChatModel implements INodeType {
9
- description: INodeTypeDescription = {
10
- displayName: 'Rooyai Chat Model',
11
- name: 'rooyaiChatModel',
12
- icon: 'file:rooyai.svg',
13
- group: ['transform'],
14
- version: 1,
15
- description: 'Rooyai AI Chat Model',
16
- defaults: { name: 'Rooyai Chat Model' },
17
- inputs: ['main'],
18
- outputs: ['main'],
19
- credentials: [
20
- { name: 'rooyaiAccount', required: true },
21
- { name: 'rooyaiOpenAI', required: false },
22
- { name: 'rooyaiOpenRouter', required: false },
23
- ],
24
- properties: [
25
- {
26
- displayName: 'Provider',
27
- name: 'provider',
28
- type: 'options',
29
- options: [
30
- { name: 'OpenAI', value: 'openai' },
31
- { name: 'OpenRouter', value: 'openrouter' },
32
- ],
33
- default: 'openrouter',
34
- },
35
- {
36
- displayName: 'Model',
37
- name: 'model',
38
- type: 'string',
39
- default: 'gpt-4o',
40
- displayOptions: { show: { provider: ['openai'] } },
41
- },
42
- {
43
- displayName: 'Model',
44
- name: 'model',
45
- type: 'string',
46
- default: 'openai/gpt-4o',
47
- displayOptions: { show: { provider: ['openrouter'] } },
48
- },
49
- {
50
- displayName: 'Messages',
51
- name: 'messages',
52
- type: 'string',
53
- default: '',
54
- },
55
- ],
56
- };
57
-
58
- async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
59
- const items = this.getInputData();
60
- const credentials = await this.getCredentials('rooyaiAccount');
61
- const provider = this.getNodeParameter('provider', 0) as string;
62
-
63
- let providerCreds;
64
- if (provider === 'openai') {
65
- providerCreds = await this.getCredentials('rooyaiOpenAI');
66
- } else {
67
- providerCreds = await this.getCredentials('rooyaiOpenRouter');
68
- }
69
-
70
- const response = await this.helpers.request({
71
- method: 'POST',
72
- url: 'http://35.226.94.120:3000/v1/chat/completions',
73
- body: {
74
- token: credentials.token,
75
- provider,
76
- apiKey: providerCreds.apiKey,
77
- model: this.getNodeParameter('model', 0),
78
- messages: [{ role: 'user', content: this.getNodeParameter('messages', 0) }],
79
- },
80
- json: true,
81
- });
82
-
83
- return [[{ json: response }]];
84
- }
85
- }
@@ -1,16 +0,0 @@
1
- import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
-
3
- export class RooyaiOpenAI implements ICredentialType {
4
- name = 'rooyaiOpenAI';
5
- displayName = 'Rooyai OpenAI';
6
- properties: INodeProperties[] = [
7
- {
8
- displayName: 'API Key',
9
- name: 'apiKey',
10
- type: 'string',
11
- typeOptions: { password: true },
12
- default: '',
13
- required: true,
14
- },
15
- ];
16
- }
@@ -1,16 +0,0 @@
1
- import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
-
3
- export class RooyaiOpenRouter implements ICredentialType {
4
- name = 'rooyaiOpenRouter';
5
- displayName = 'Rooyai OpenRouter';
6
- properties: INodeProperties[] = [
7
- {
8
- displayName: 'API Key',
9
- name: 'apiKey',
10
- type: 'string',
11
- typeOptions: { password: true },
12
- default: '',
13
- required: true,
14
- },
15
- ];
16
- }