n8n-nodes-rooyai-chat 0.1.0 → 0.2.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/credentials/RooyaiApi.credentials.d.ts +1 -2
- package/dist/credentials/RooyaiApi.credentials.js +0 -20
- package/dist/nodes/Rooyai/Rooyai.node.js +0 -11
- package/dist/nodes/Rooyai/RooyaiLangChainWrapper.d.ts +0 -2
- package/dist/nodes/Rooyai/RooyaiLangChainWrapper.js +0 -4
- package/package.json +2 -2
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IAuthenticateGeneric,
|
|
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
7
|
authenticate: IAuthenticateGeneric;
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
8
|
}
|
|
@@ -26,14 +26,6 @@ class RooyaiApi {
|
|
|
26
26
|
required: true,
|
|
27
27
|
description: 'Rooyai API base URL',
|
|
28
28
|
},
|
|
29
|
-
{
|
|
30
|
-
displayName: 'Optional Headers',
|
|
31
|
-
name: 'optionalHeaders',
|
|
32
|
-
type: 'string',
|
|
33
|
-
default: '',
|
|
34
|
-
placeholder: '{"X-Custom-Header": "value"}',
|
|
35
|
-
description: 'Additional headers as JSON object (optional)',
|
|
36
|
-
},
|
|
37
29
|
];
|
|
38
30
|
this.authenticate = {
|
|
39
31
|
type: 'generic',
|
|
@@ -43,18 +35,6 @@ class RooyaiApi {
|
|
|
43
35
|
},
|
|
44
36
|
},
|
|
45
37
|
};
|
|
46
|
-
this.test = {
|
|
47
|
-
request: {
|
|
48
|
-
baseURL: '={{$credentials.baseUrl}}',
|
|
49
|
-
url: '/chat',
|
|
50
|
-
method: 'POST',
|
|
51
|
-
body: {
|
|
52
|
-
model: 'gemini-2.0-flash',
|
|
53
|
-
messages: [{ role: 'user', content: 'Hi' }],
|
|
54
|
-
max_tokens: 10,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
38
|
}
|
|
59
39
|
}
|
|
60
40
|
exports.RooyaiApi = RooyaiApi;
|
|
@@ -138,7 +138,6 @@ class Rooyai {
|
|
|
138
138
|
const credentials = await this.getCredentials('rooyaiApi');
|
|
139
139
|
const apiKey = credentials.apiKey;
|
|
140
140
|
const baseUrl = credentials.baseUrl;
|
|
141
|
-
const optionalHeaders = credentials.optionalHeaders;
|
|
142
141
|
if (!apiKey) {
|
|
143
142
|
throw new Error('Rooyai API key not found in credentials.');
|
|
144
143
|
}
|
|
@@ -147,15 +146,6 @@ class Rooyai {
|
|
|
147
146
|
}
|
|
148
147
|
const modelName = this.getNodeParameter('model', itemIndex);
|
|
149
148
|
const options = this.getNodeParameter('options', itemIndex, {});
|
|
150
|
-
let parsedHeaders;
|
|
151
|
-
if (optionalHeaders) {
|
|
152
|
-
try {
|
|
153
|
-
parsedHeaders = JSON.parse(optionalHeaders);
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
throw new Error(`Invalid JSON in optional headers: ${error instanceof Error ? error.message : String(error)}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
149
|
if (this.logger) {
|
|
160
150
|
this.logger.info('Rooyai Chat Model initialized', {
|
|
161
151
|
model: modelName,
|
|
@@ -166,7 +156,6 @@ class Rooyai {
|
|
|
166
156
|
const model = new RooyaiLangChainWrapper_1.RooyaiLangChainWrapper({
|
|
167
157
|
apiKey,
|
|
168
158
|
baseUrl,
|
|
169
|
-
optionalHeaders: parsedHeaders,
|
|
170
159
|
model: modelName,
|
|
171
160
|
maxTokens: options.maxTokensToSample,
|
|
172
161
|
temperature: options.temperature ?? 0.7,
|
|
@@ -6,7 +6,6 @@ import { ISupplyDataFunctions } from 'n8n-workflow';
|
|
|
6
6
|
interface RooyaiLangChainWrapperParams {
|
|
7
7
|
apiKey: string;
|
|
8
8
|
baseUrl: string;
|
|
9
|
-
optionalHeaders?: Record<string, string>;
|
|
10
9
|
model: string;
|
|
11
10
|
temperature?: number;
|
|
12
11
|
maxTokens?: number;
|
|
@@ -17,7 +16,6 @@ export declare class RooyaiLangChainWrapper extends BaseChatModel {
|
|
|
17
16
|
lc_namespace: string[];
|
|
18
17
|
private apiKey;
|
|
19
18
|
private baseUrl;
|
|
20
|
-
private optionalHeaders?;
|
|
21
19
|
private model;
|
|
22
20
|
private temperature;
|
|
23
21
|
private maxTokens?;
|
|
@@ -17,7 +17,6 @@ class RooyaiLangChainWrapper extends chat_models_1.BaseChatModel {
|
|
|
17
17
|
this.lc_namespace = ['n8n', 'rooyai', 'chat'];
|
|
18
18
|
this.apiKey = params.apiKey;
|
|
19
19
|
this.baseUrl = params.baseUrl;
|
|
20
|
-
this.optionalHeaders = params.optionalHeaders;
|
|
21
20
|
this.model = params.model;
|
|
22
21
|
this.temperature = params.temperature ?? 0.7;
|
|
23
22
|
this.maxTokens = params.maxTokens;
|
|
@@ -34,9 +33,6 @@ class RooyaiLangChainWrapper extends chat_models_1.BaseChatModel {
|
|
|
34
33
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
35
34
|
'Content-Type': 'application/json',
|
|
36
35
|
};
|
|
37
|
-
if (this.optionalHeaders) {
|
|
38
|
-
Object.assign(headers, this.optionalHeaders);
|
|
39
|
-
}
|
|
40
36
|
const url = `${this.baseUrl}/chat`;
|
|
41
37
|
try {
|
|
42
38
|
const response = await axios_1.default.post(url, body, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-rooyai-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "n8n supply node for Rooyai Chat API - Provides Rooyai language models for use with Basic LLM Chain, AI Agent, and other AI nodes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"n8n-workflow": "*"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|