n8n-nodes-rooyai-model 1.0.3 → 1.0.4
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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
|
|
2
2
|
export declare class RooyaiChatModel implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
|
-
|
|
4
|
+
supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
|
|
5
5
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RooyaiChatModel = void 0;
|
|
4
|
+
const openai_1 = require("@langchain/openai");
|
|
4
5
|
class RooyaiChatModel {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.description = {
|
|
@@ -9,10 +10,19 @@ class RooyaiChatModel {
|
|
|
9
10
|
icon: 'file:rooyai.svg',
|
|
10
11
|
group: ['transform'],
|
|
11
12
|
version: 1,
|
|
12
|
-
description: 'Rooyai AI Chat Model',
|
|
13
|
-
defaults: {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
description: 'Rooyai AI Chat Model compatible with Agents',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Rooyai Chat Model',
|
|
16
|
+
},
|
|
17
|
+
codex: {
|
|
18
|
+
categories: ['AI'],
|
|
19
|
+
subcategories: {
|
|
20
|
+
AI: ['Language Models', 'Chat Models'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
inputs: [],
|
|
24
|
+
// 🔥 التعديل هنا: الاسم ده هو الصح 100% 🔥
|
|
25
|
+
outputs: ['ai_languageModel'],
|
|
16
26
|
credentials: [
|
|
17
27
|
{ name: 'rooyaiAccount', required: true },
|
|
18
28
|
{ name: 'rooyaiOpenAI', required: false },
|
|
@@ -34,48 +44,46 @@ class RooyaiChatModel {
|
|
|
34
44
|
name: 'model',
|
|
35
45
|
type: 'string',
|
|
36
46
|
default: 'gpt-4o',
|
|
37
|
-
displayOptions: { show: { provider: ['openai'] } },
|
|
38
47
|
},
|
|
39
48
|
{
|
|
40
|
-
displayName: '
|
|
41
|
-
name: '
|
|
42
|
-
type: '
|
|
43
|
-
default:
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
displayName: 'Messages',
|
|
48
|
-
name: 'messages',
|
|
49
|
-
type: 'string',
|
|
50
|
-
default: '',
|
|
49
|
+
displayName: 'Temperature',
|
|
50
|
+
name: 'temperature',
|
|
51
|
+
type: 'number',
|
|
52
|
+
default: 0.7,
|
|
53
|
+
typeOptions: { minValue: 0, maxValue: 2, numberStepSize: 0.1 },
|
|
51
54
|
},
|
|
52
55
|
],
|
|
53
56
|
};
|
|
54
57
|
}
|
|
55
|
-
async
|
|
56
|
-
const items = this.getInputData();
|
|
58
|
+
async supplyData(itemIndex) {
|
|
57
59
|
const credentials = await this.getCredentials('rooyaiAccount');
|
|
58
|
-
const provider = this.getNodeParameter('provider',
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const provider = this.getNodeParameter('provider', itemIndex);
|
|
61
|
+
const modelName = this.getNodeParameter('model', itemIndex);
|
|
62
|
+
const temperature = this.getNodeParameter('temperature', itemIndex);
|
|
63
|
+
let apiKey = '';
|
|
64
|
+
if (provider === 'openrouter') {
|
|
65
|
+
const creds = await this.getCredentials('rooyaiOpenRouter');
|
|
66
|
+
apiKey = creds.apiKey;
|
|
62
67
|
}
|
|
63
68
|
else {
|
|
64
|
-
|
|
69
|
+
const creds = await this.getCredentials('rooyaiOpenAI');
|
|
70
|
+
apiKey = creds.apiKey;
|
|
65
71
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
messages: [{ role: 'user', content: this.getNodeParameter('messages', 0) }],
|
|
72
|
+
const model = new openai_1.ChatOpenAI({
|
|
73
|
+
openAIApiKey: apiKey,
|
|
74
|
+
configuration: {
|
|
75
|
+
baseURL: 'http://35.226.94.120:3000/v1',
|
|
76
|
+
defaultHeaders: {
|
|
77
|
+
'x-rooyai-token': credentials.token,
|
|
78
|
+
'x-rooyai-provider': provider,
|
|
79
|
+
},
|
|
75
80
|
},
|
|
76
|
-
|
|
81
|
+
modelName: modelName,
|
|
82
|
+
temperature: temperature,
|
|
77
83
|
});
|
|
78
|
-
return
|
|
84
|
+
return {
|
|
85
|
+
response: model,
|
|
86
|
+
};
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
89
|
exports.RooyaiChatModel = RooyaiChatModel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-rooyai-model",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Rooyai AI Model Integration for n8n",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package"
|
|
@@ -26,7 +26,11 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"n8n-workflow": "^1.
|
|
29
|
+
"n8n-workflow": "^1.120.4",
|
|
30
30
|
"typescript": "^5.9.3"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@langchain/core": "^1.1.12",
|
|
34
|
+
"@langchain/openai": "^1.2.1"
|
|
31
35
|
}
|
|
32
36
|
}
|