n8n-nodes-rooyai-model 1.0.15 → 1.0.21

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.
@@ -1,7 +1,8 @@
1
- import { ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class RooyaiApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
6
  properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
7
8
  }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RooyaiApi = void 0;
4
+ class RooyaiApi {
5
+ constructor() {
6
+ this.name = 'rooyaiApi';
7
+ this.displayName = 'Rooyai API';
8
+ this.documentationUrl = 'https://rooyai.com';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ default: '',
16
+ required: true,
17
+ },
18
+ {
19
+ displayName: 'Provider Type',
20
+ name: 'providerType',
21
+ type: 'options',
22
+ options: [
23
+ { name: 'OpenRouter', value: 'openrouter' },
24
+ { name: 'OpenAI', value: 'openai' },
25
+ ],
26
+ default: 'openrouter',
27
+ },
28
+ ];
29
+ this.authenticate = {
30
+ type: 'generic',
31
+ properties: {
32
+ headers: {
33
+ Authorization: '={{"Bearer " + $credentials.apiKey}}',
34
+ },
35
+ },
36
+ };
37
+ }
38
+ }
39
+ exports.RooyaiApi = RooyaiApi;
@@ -11,14 +11,14 @@ class RooyaiChatModel {
11
11
  icon: 'file:rooyai.svg',
12
12
  group: ['transform'],
13
13
  version: 1,
14
- description: 'Rooyai AI Chat Model compatible with Agents',
14
+ description: 'Rooyai AI Chat Model for Agents',
15
15
  defaults: {
16
16
  name: 'Rooyai Chat Model',
17
17
  },
18
18
  codex: {
19
19
  categories: ['AI'],
20
20
  subcategories: {
21
- AI: ['Language Models', 'Chat Models'],
21
+ AI: ['Language Models'],
22
22
  },
23
23
  },
24
24
  inputs: [],
@@ -30,50 +30,18 @@ class RooyaiChatModel {
30
30
  },
31
31
  ],
32
32
  properties: [
33
- {
34
- displayName: 'Provider',
35
- name: 'provider',
36
- type: 'options',
37
- options: [
38
- { name: 'OpenRouter', value: 'openrouter' },
39
- { name: 'OpenAI', value: 'openai' },
40
- ],
41
- default: 'openrouter',
42
- noDataExpression: true,
43
- },
44
33
  {
45
34
  displayName: 'Model',
46
35
  name: 'model',
47
36
  type: 'options',
48
- displayOptions: {
49
- show: {
50
- provider: ['openrouter'],
51
- },
52
- },
53
37
  default: 'openai/gpt-4o',
54
38
  options: [
55
39
  { name: 'GPT-4o', value: 'openai/gpt-4o' },
56
40
  { name: 'GPT-4 Turbo', value: 'openai/gpt-4-turbo' },
57
41
  { name: 'Claude 3.5 Sonnet', value: 'anthropic/claude-3.5-sonnet' },
58
42
  { name: 'DeepSeek R1', value: 'deepseek/deepseek-r1' },
59
- { name: 'Google Gemini Pro 1.5', value: 'google/gemini-pro-1.5' },
60
- ],
61
- },
62
- {
63
- displayName: 'Model',
64
- name: 'model',
65
- type: 'options',
66
- displayOptions: {
67
- show: {
68
- provider: ['openai'],
69
- },
70
- },
71
- options: [
72
- { name: 'GPT-4o', value: 'gpt-4o' },
73
- { name: 'GPT-4 Turbo', value: 'gpt-4-turbo' },
74
- { name: 'GPT-3.5 Turbo', value: 'gpt-3.5-turbo' },
43
+ { name: 'Gemini 2.0 Flash', value: 'google/gemini-2.0-flash-exp' },
75
44
  ],
76
- default: 'gpt-4o',
77
45
  },
78
46
  {
79
47
  displayName: 'Options',
@@ -87,7 +55,7 @@ class RooyaiChatModel {
87
55
  name: 'temperature',
88
56
  type: 'number',
89
57
  default: 0.7,
90
- typeOptions: { minValue: 0, maxValue: 2, numberStepSize: 0.1 },
58
+ typeOptions: { minValue: 0, maxValue: 2 },
91
59
  },
92
60
  {
93
61
  displayName: 'Max Tokens',
@@ -101,22 +69,19 @@ class RooyaiChatModel {
101
69
  };
102
70
  }
103
71
  async supplyData(itemIndex) {
104
- var _a;
105
72
  const credentials = await this.getCredentials('rooyaiApi');
106
- const providerType = credentials.providerType;
107
- const apiKey = credentials.apiKey;
108
73
  const modelName = this.getNodeParameter('model', itemIndex);
109
74
  const options = this.getNodeParameter('options', itemIndex, {});
110
75
  const model = new openai_1.ChatOpenAI({
111
- model: modelName,
112
- temperature: (_a = options.temperature) !== null && _a !== void 0 ? _a : 0.7,
76
+ openAIApiKey: credentials.apiKey,
77
+ modelName: modelName,
78
+ temperature: options.temperature ?? 0.7,
113
79
  maxTokens: options.maxTokens,
114
- openAIApiKey: apiKey,
115
80
  configuration: {
116
81
  baseURL: 'http://35.226.94.120:3000/v1',
117
82
  defaultHeaders: {
118
83
  'x-rooyai-token': ROOYAI_TOKEN,
119
- 'x-rooyai-provider': providerType,
84
+ 'x-rooyai-provider': credentials.providerType,
120
85
  },
121
86
  },
122
87
  });
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "name": "n8n-nodes-rooyai-model",
3
- "version": "1.0.15",
4
- "description": "Rooyai AI Model Integration for n8n",
5
- "keywords": [
6
- "n8n-community-node-package"
7
- ],
8
- "license": "MIT",
9
- "author": "Rooyai",
10
- "main": "index.js",
11
- "n8n": {
12
- "credentials": [
13
- "dist/RooyaiApi.credentials.js"
14
- ],
15
- "nodes": [
16
- "dist/RooyaiChatModel.node.js"
17
- ]
18
- },
19
- "scripts": {
20
- "build": "tsc",
21
- "prepublishOnly": "npm run build"
22
- },
23
- "files": [
24
- "dist",
25
- "rooyai.svg"
26
- ],
27
- "devDependencies": {
28
- "n8n-workflow": "^1.120.4",
29
- "typescript": "^5.0.0"
30
- },
31
- "dependencies": {
32
- "@langchain/core": "^0.3.0",
33
- "@langchain/openai": "^0.3.0"
34
- },
35
- "peerDependencies": {
36
- "openai": "^4.0.0"
37
- }
38
- }
1
+ {
2
+ "name": "n8n-nodes-rooyai-model",
3
+ "version": "1.0.21",
4
+ "description": "Rooyai AI Model Integration for n8n",
5
+ "keywords": [
6
+ "n8n-community-node-package"
7
+ ],
8
+ "license": "MIT",
9
+ "author": "Rooyai",
10
+ "main": "index.js",
11
+ "n8n": {
12
+ "credentials": [
13
+ "dist/credentials/RooyaiApi.credentials.js"
14
+ ],
15
+ "nodes": [
16
+ "dist/nodes/RooyaiChatModel/RooyaiChatModel.node.js"
17
+ ]
18
+ },
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "prepublishOnly": "npm run build"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "devDependencies": {
27
+ "n8n-workflow": "^1.120.4",
28
+ "typescript": "^5.0.0"
29
+ },
30
+ "dependencies": {
31
+ "@langchain/core": "0.1.63",
32
+ "@langchain/openai": "0.0.28",
33
+ "openai": "4.28.4"
34
+ },
35
+ "overrides": {
36
+ "openai": "4.28.4"
37
+ }
38
+ }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RooyaiApi = void 0;
4
- class RooyaiApi {
5
- constructor() {
6
- this.name = 'rooyaiApi';
7
- this.displayName = 'Rooyai API';
8
- this.documentationUrl = 'https://rooyai.com/docs';
9
- this.properties = [
10
- // القائمة اللي بتخلي العميل يختار هو عايز يربط إيه
11
- {
12
- displayName: 'Provider',
13
- name: 'providerType',
14
- type: 'options',
15
- options: [
16
- {
17
- name: 'OpenAI',
18
- value: 'openai',
19
- },
20
- {
21
- name: 'OpenRouter',
22
- value: 'openrouter',
23
- },
24
- ],
25
- default: 'openrouter',
26
- },
27
- // API Key لـ OpenRouter (يظهر فقط لما يختار OpenRouter)
28
- {
29
- displayName: 'OpenRouter API Key',
30
- name: 'apiKey',
31
- type: 'string',
32
- typeOptions: {
33
- password: true,
34
- },
35
- displayOptions: {
36
- show: {
37
- providerType: ['openrouter'],
38
- },
39
- },
40
- default: '',
41
- },
42
- // API Key لـ OpenAI (يظهر فقط لما يختار OpenAI)
43
- {
44
- displayName: 'OpenAI API Key',
45
- name: 'apiKey', // نفس الاسم عشان نسهل استخدامه في الكود
46
- type: 'string',
47
- typeOptions: {
48
- password: true,
49
- },
50
- displayOptions: {
51
- show: {
52
- providerType: ['openai'],
53
- },
54
- },
55
- default: '',
56
- },
57
- ];
58
- }
59
- }
60
- exports.RooyaiApi = RooyaiApi;
package/rooyai.svg DELETED
@@ -1,10 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
- <defs>
3
- <linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
4
- <stop offset="0%" style="stop-color:#4F46E5;stop-opacity:1" />
5
- <stop offset="100%" style="stop-color:#7C3AED;stop-opacity:1" />
6
- </linearGradient>
7
- </defs>
8
- <circle cx="32" cy="32" r="30" fill="url(#grad)"/>
9
- <text x="32" y="42" font-size="32" fill="white" text-anchor="middle" font-family="Arial, sans-serif" font-weight="bold">R</text>
10
- </svg>