n8n-nodes-purple-cat 0.1.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/CommandCodeApi.credentials.d.ts +9 -0
- package/dist/credentials/CommandCodeApi.credentials.d.ts.map +1 -0
- package/dist/credentials/CommandCodeApi.credentials.js +39 -0
- package/dist/credentials/CommandCodeApi.credentials.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/CommandCode/CommandCode.node.d.ts +6 -0
- package/dist/nodes/CommandCode/CommandCode.node.d.ts.map +1 -0
- package/dist/nodes/CommandCode/CommandCode.node.js +163 -0
- package/dist/nodes/CommandCode/CommandCode.node.js.map +1 -0
- package/dist/nodes/CommandCodeLm/CommandCodeLm.node.d.ts +9 -0
- package/dist/nodes/CommandCodeLm/CommandCodeLm.node.d.ts.map +1 -0
- package/dist/nodes/CommandCodeLm/CommandCodeLm.node.js +116 -0
- package/dist/nodes/CommandCodeLm/CommandCodeLm.node.js.map +1 -0
- package/package.json +34 -0
- package/src/credentials/CommandCodeApi.credentials.ts +40 -0
- package/src/index.ts +3 -0
- package/src/nodes/CommandCode/CommandCode.node.ts +177 -0
- package/src/nodes/CommandCode/commandcode.svg +4 -0
- package/src/nodes/CommandCodeLm/CommandCodeLm.node.ts +122 -0
- package/test.js +9 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class CommandCodeApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=CommandCodeApi.credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandCodeApi.credentials.d.ts","sourceRoot":"","sources":["../../src/credentials/CommandCodeApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACpD,IAAI,SAAoB;IACxB,WAAW,SAAsB;IACjC,gBAAgB,SAA4D;IAE5E,UAAU,EAAE,eAAe,EAAE,CAkB3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;CACH"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandCodeApi = void 0;
|
|
4
|
+
class CommandCodeApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'commandCodeApi';
|
|
7
|
+
this.displayName = 'Command Code API';
|
|
8
|
+
this.documentationUrl = 'https://github.com/yourusername/n8n-nodes-command-code';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Gateway URL',
|
|
12
|
+
name: 'gatewayUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: 'http://cmd.apps.marno.pro',
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'Your Command Code Gateway URL',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Gateway API Key',
|
|
20
|
+
name: 'gatewayKey',
|
|
21
|
+
type: 'string',
|
|
22
|
+
typeOptions: { password: true },
|
|
23
|
+
default: '',
|
|
24
|
+
required: true,
|
|
25
|
+
description: 'API key for gateway authentication',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
this.authenticate = {
|
|
29
|
+
type: 'generic',
|
|
30
|
+
properties: {
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: '=Bearer {{$credentials.gatewayKey}}',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CommandCodeApi = CommandCodeApi;
|
|
39
|
+
//# sourceMappingURL=CommandCodeApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandCodeApi.credentials.js","sourceRoot":"","sources":["../../src/credentials/CommandCodeApi.credentials.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAc;IAA3B;QACE,SAAI,GAAG,gBAAgB,CAAC;QACxB,gBAAW,GAAG,kBAAkB,CAAC;QACjC,qBAAgB,GAAG,wDAAwD,CAAC;QAE5E,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,+BAA+B;aAC7C;YACD;gBACE,WAAW,EAAE,iBAAiB;gBAC9B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;aAClD;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,qCAAqC;iBACrD;aACF;SACF,CAAC;IACJ,CAAC;CAAA;AAjCD,wCAiCC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,0CAA0C,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./credentials/CommandCodeApi.credentials"), exports);
|
|
18
|
+
__exportStar(require("./nodes/CommandCode/CommandCode.node"), exports);
|
|
19
|
+
__exportStar(require("./nodes/CommandCodeLm/CommandCodeLm.node"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2EAAyD;AACzD,uEAAqD;AACrD,2EAAyD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class CommandCode implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=CommandCode.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandCode.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/CommandCode/CommandCode.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAEtB,qBAAa,WAAY,YAAW,SAAS;IAC3C,WAAW,EAAE,oBAAoB,CAmH/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAkDxE"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandCode = void 0;
|
|
4
|
+
class CommandCode {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'Command Code',
|
|
8
|
+
name: 'commandCode',
|
|
9
|
+
icon: 'file:commandcode.svg',
|
|
10
|
+
group: ['transform'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{ $parameter["operation"] }}',
|
|
13
|
+
description: 'Use Command Code AI models',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Command Code',
|
|
16
|
+
},
|
|
17
|
+
inputs: ['main'],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'commandCodeApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Operation',
|
|
28
|
+
name: 'operation',
|
|
29
|
+
type: 'options',
|
|
30
|
+
noDataExpression: true,
|
|
31
|
+
options: [
|
|
32
|
+
{
|
|
33
|
+
name: 'Chat',
|
|
34
|
+
value: 'chat',
|
|
35
|
+
action: 'Send a chat message',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
default: 'chat',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Model',
|
|
42
|
+
name: 'model',
|
|
43
|
+
type: 'options',
|
|
44
|
+
options: [
|
|
45
|
+
{ name: 'Claude Sonnet 4.6', value: 'claude-sonnet-4-6' },
|
|
46
|
+
{ name: 'Claude Fable 5', value: 'claude-fable-5' },
|
|
47
|
+
{ name: 'Claude Opus 4.8', value: 'claude-opus-4-8' },
|
|
48
|
+
{ name: 'Claude Haiku 4.5', value: 'claude-haiku-4-5-20251001' },
|
|
49
|
+
{ name: 'GPT-5.5', value: 'gpt-5.5' },
|
|
50
|
+
{ name: 'GPT-5.4', value: 'gpt-5.4' },
|
|
51
|
+
{ name: 'GPT-5.4 Mini', value: 'gpt-5.4-mini' },
|
|
52
|
+
{ name: 'DeepSeek V4 Pro', value: 'deepseek/deepseek-v4-pro' },
|
|
53
|
+
{ name: 'DeepSeek V4 Flash', value: 'deepseek/deepseek-v4-flash' },
|
|
54
|
+
{ name: 'Kimi K2.7 Code', value: 'moonshotai/Kimi-K2.7-Code' },
|
|
55
|
+
{ name: 'Kimi K2.6', value: 'moonshotai/Kimi-K2.6' },
|
|
56
|
+
{ name: 'GLM 5.2', value: 'zai-org/GLM-5.2' },
|
|
57
|
+
{ name: 'GLM 5.1', value: 'zai-org/GLM-5.1' },
|
|
58
|
+
{ name: 'MiniMax M3', value: 'MiniMaxAI/MiniMax-M3' },
|
|
59
|
+
{ name: 'MiniMax M2.7', value: 'MiniMaxAI/MiniMax-M2.7' },
|
|
60
|
+
{ name: 'Mimo V2.5 Pro', value: 'xiaomi/mimo-v2.5-pro' },
|
|
61
|
+
{ name: 'Mimo V2.5', value: 'xiaomi/mimo-v2.5' },
|
|
62
|
+
{ name: 'Qwen 3.7 Max', value: 'Qwen/Qwen3.7-Max' },
|
|
63
|
+
{ name: 'Qwen 3.7 Plus', value: 'Qwen/Qwen3.7-Plus' },
|
|
64
|
+
{ name: 'Step 3.7 Flash', value: 'stepfun/Step-3.7-Flash' },
|
|
65
|
+
{ name: 'Gemini 3.5 Flash', value: 'google/gemini-3.5-flash' },
|
|
66
|
+
{ name: 'Gemini 3.1 Flash Lite', value: 'google/gemini-3.1-flash-lite' },
|
|
67
|
+
{ name: 'Nemotron 3 Ultra', value: 'nvidia/nemotron-3-ultra-550b-a55b' },
|
|
68
|
+
],
|
|
69
|
+
default: 'xiaomi/mimo-v2.5',
|
|
70
|
+
description: 'The model to use',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
displayName: 'Messages',
|
|
74
|
+
name: 'messages',
|
|
75
|
+
type: 'json',
|
|
76
|
+
default: '[]',
|
|
77
|
+
required: true,
|
|
78
|
+
description: 'Array of message objects with role and content',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Options',
|
|
82
|
+
name: 'options',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Option',
|
|
85
|
+
default: {},
|
|
86
|
+
options: [
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Temperature',
|
|
89
|
+
name: 'temperature',
|
|
90
|
+
type: 'number',
|
|
91
|
+
typeOptions: {
|
|
92
|
+
minValue: 0,
|
|
93
|
+
maxValue: 2,
|
|
94
|
+
numberPrecision: 1,
|
|
95
|
+
},
|
|
96
|
+
default: 0.7,
|
|
97
|
+
description: 'Sampling temperature',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Max Tokens',
|
|
101
|
+
name: 'maxTokens',
|
|
102
|
+
type: 'number',
|
|
103
|
+
typeOptions: {
|
|
104
|
+
minValue: 1,
|
|
105
|
+
maxValue: 32000,
|
|
106
|
+
},
|
|
107
|
+
default: 4096,
|
|
108
|
+
description: 'Maximum tokens to generate',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
displayName: 'System Prompt',
|
|
112
|
+
name: 'systemPrompt',
|
|
113
|
+
type: 'string',
|
|
114
|
+
typeOptions: { rows: 4 },
|
|
115
|
+
default: '',
|
|
116
|
+
description: 'System prompt for the model',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async execute() {
|
|
124
|
+
const items = this.getInputData();
|
|
125
|
+
const returnData = [];
|
|
126
|
+
const credentials = await this.getCredentials('commandCodeApi');
|
|
127
|
+
const gatewayUrl = credentials.gatewayUrl;
|
|
128
|
+
for (let i = 0; i < items.length; i++) {
|
|
129
|
+
const operation = this.getNodeParameter('operation', i);
|
|
130
|
+
if (operation === 'chat') {
|
|
131
|
+
const model = this.getNodeParameter('model', i);
|
|
132
|
+
const messagesStr = this.getNodeParameter('messages', i);
|
|
133
|
+
const options = this.getNodeParameter('options', i);
|
|
134
|
+
let messages = JSON.parse(messagesStr);
|
|
135
|
+
// Add system prompt if provided
|
|
136
|
+
if (options.systemPrompt) {
|
|
137
|
+
messages = [
|
|
138
|
+
{ role: 'system', content: options.systemPrompt },
|
|
139
|
+
...messages,
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
const response = await this.helpers.httpRequest({
|
|
143
|
+
method: 'POST',
|
|
144
|
+
url: `${gatewayUrl}/v1/chat/completions`,
|
|
145
|
+
body: {
|
|
146
|
+
model,
|
|
147
|
+
messages,
|
|
148
|
+
temperature: options.temperature ?? 0.7,
|
|
149
|
+
max_tokens: options.maxTokens ?? 4096,
|
|
150
|
+
stream: false,
|
|
151
|
+
},
|
|
152
|
+
json: true,
|
|
153
|
+
});
|
|
154
|
+
returnData.push({
|
|
155
|
+
json: response,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return [returnData];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.CommandCode = CommandCode;
|
|
163
|
+
//# sourceMappingURL=CommandCode.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandCode.node.js","sourceRoot":"","sources":["../../../src/nodes/CommandCode/CommandCode.node.ts"],"names":[],"mappings":";;;AAQA,MAAa,WAAW;IAAxB;QACE,gBAAW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workflow';
|
|
2
|
+
import { ChatOpenAI } from '@langchain/openai';
|
|
3
|
+
export declare class CommandCodeLm implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<{
|
|
6
|
+
response: ChatOpenAI<import("@langchain/openai").ChatOpenAICallOptions>;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=CommandCodeLm.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandCodeLm.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/CommandCodeLm/CommandCodeLm.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EAErB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,qBAAa,aAAc,YAAW,SAAS;IAC7C,WAAW,EAAE,oBAAoB,CAqF/B;IAEI,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM;;;CAyB/D"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandCodeLm = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const openai_1 = require("@langchain/openai");
|
|
6
|
+
class CommandCodeLm {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.description = {
|
|
9
|
+
displayName: 'Command Code Chat Model',
|
|
10
|
+
name: 'commandCodeLm',
|
|
11
|
+
icon: 'file:commandcode.svg',
|
|
12
|
+
group: ['transform'],
|
|
13
|
+
version: 1,
|
|
14
|
+
description: 'Use Command Code as a chat model for AI Agent',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'Command Code Chat Model',
|
|
17
|
+
},
|
|
18
|
+
inputs: [],
|
|
19
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.AiLanguageModel],
|
|
20
|
+
outputNames: ['Model'],
|
|
21
|
+
credentials: [
|
|
22
|
+
{
|
|
23
|
+
name: 'commandCodeApi',
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
properties: [
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Model',
|
|
30
|
+
name: 'model',
|
|
31
|
+
type: 'options',
|
|
32
|
+
options: [
|
|
33
|
+
{ name: 'Claude Sonnet 4.6', value: 'claude-sonnet-4-6' },
|
|
34
|
+
{ name: 'Claude Fable 5', value: 'claude-fable-5' },
|
|
35
|
+
{ name: 'Claude Opus 4.8', value: 'claude-opus-4-8' },
|
|
36
|
+
{ name: 'Claude Haiku 4.5', value: 'claude-haiku-4-5-20251001' },
|
|
37
|
+
{ name: 'GPT-5.5', value: 'gpt-5.5' },
|
|
38
|
+
{ name: 'GPT-5.4', value: 'gpt-5.4' },
|
|
39
|
+
{ name: 'GPT-5.4 Mini', value: 'gpt-5.4-mini' },
|
|
40
|
+
{ name: 'DeepSeek V4 Pro', value: 'deepseek/deepseek-v4-pro' },
|
|
41
|
+
{ name: 'DeepSeek V4 Flash', value: 'deepseek/deepseek-v4-flash' },
|
|
42
|
+
{ name: 'Kimi K2.7 Code', value: 'moonshotai/Kimi-K2.7-Code' },
|
|
43
|
+
{ name: 'Kimi K2.6', value: 'moonshotai/Kimi-K2.6' },
|
|
44
|
+
{ name: 'GLM 5.2', value: 'zai-org/GLM-5.2' },
|
|
45
|
+
{ name: 'GLM 5.1', value: 'zai-org/GLM-5.1' },
|
|
46
|
+
{ name: 'MiniMax M3', value: 'MiniMaxAI/MiniMax-M3' },
|
|
47
|
+
{ name: 'MiniMax M2.7', value: 'MiniMaxAI/MiniMax-M2.7' },
|
|
48
|
+
{ name: 'Mimo V2.5 Pro', value: 'xiaomi/mimo-v2.5-pro' },
|
|
49
|
+
{ name: 'Mimo V2.5', value: 'xiaomi/mimo-v2.5' },
|
|
50
|
+
{ name: 'Qwen 3.7 Max', value: 'Qwen/Qwen3.7-Max' },
|
|
51
|
+
{ name: 'Qwen 3.7 Plus', value: 'Qwen/Qwen3.7-Plus' },
|
|
52
|
+
{ name: 'Step 3.7 Flash', value: 'stepfun/Step-3.7-Flash' },
|
|
53
|
+
{ name: 'Gemini 3.5 Flash', value: 'google/gemini-3.5-flash' },
|
|
54
|
+
{ name: 'Gemini 3.1 Flash Lite', value: 'google/gemini-3.1-flash-lite' },
|
|
55
|
+
{ name: 'Nemotron 3 Ultra', value: 'nvidia/nemotron-3-ultra-550b-a55b' },
|
|
56
|
+
],
|
|
57
|
+
default: 'xiaomi/mimo-v2.5',
|
|
58
|
+
description: 'The model to use',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Options',
|
|
62
|
+
name: 'options',
|
|
63
|
+
type: 'collection',
|
|
64
|
+
placeholder: 'Add Option',
|
|
65
|
+
default: {},
|
|
66
|
+
options: [
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Temperature',
|
|
69
|
+
name: 'temperature',
|
|
70
|
+
type: 'number',
|
|
71
|
+
typeOptions: {
|
|
72
|
+
minValue: 0,
|
|
73
|
+
maxValue: 2,
|
|
74
|
+
numberPrecision: 1,
|
|
75
|
+
},
|
|
76
|
+
default: 0.7,
|
|
77
|
+
description: 'Sampling temperature',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Max Tokens',
|
|
81
|
+
name: 'maxTokens',
|
|
82
|
+
type: 'number',
|
|
83
|
+
typeOptions: {
|
|
84
|
+
minValue: 1,
|
|
85
|
+
maxValue: 32000,
|
|
86
|
+
},
|
|
87
|
+
default: 4096,
|
|
88
|
+
description: 'Maximum tokens to generate',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async supplyData(itemIndex) {
|
|
96
|
+
const credentials = await this.getCredentials('commandCodeApi');
|
|
97
|
+
const gatewayUrl = credentials.gatewayUrl;
|
|
98
|
+
const gatewayKey = credentials.gatewayKey;
|
|
99
|
+
const model = this.getNodeParameter('model', itemIndex);
|
|
100
|
+
const options = this.getNodeParameter('options', itemIndex);
|
|
101
|
+
const chatModel = new openai_1.ChatOpenAI({
|
|
102
|
+
apiKey: gatewayKey,
|
|
103
|
+
model,
|
|
104
|
+
temperature: options.temperature ?? 0.7,
|
|
105
|
+
maxTokens: options.maxTokens ?? 4096,
|
|
106
|
+
configuration: {
|
|
107
|
+
baseURL: `${gatewayUrl}/v1`,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
response: chatModel,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.CommandCodeLm = CommandCodeLm;
|
|
116
|
+
//# sourceMappingURL=CommandCodeLm.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandCodeLm.node.js","sourceRoot":"","sources":["../../../src/nodes/CommandCodeLm/CommandCodeLm.node.ts"],"names":[],"mappings":";;;AAAA,+CAKsB;AACtB,8CAA+C;AAE/C,MAAa,aAAa;IAA1B;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE;gBACR,IAAI,EAAE,yBAAyB;aAChC;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,kCAAmB,CAAC,eAAe,CAAC;YAC9C,WAAW,EAAE,CAAC,OAAO,CAAC;YACtB,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,gBAAgB;oBACtB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE;gBACV;oBACE,WAAW,EAAE,OAAO;oBACp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AAW,CAAC,UAAoB,CAAC;QAEpD,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAW,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAGzD,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,mBAAU,CAAC;YAC/B,MAAM,EAAE,UAAU;YAClB,KAAK;YACL,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG;YACvC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;YACpC,aAAa,EAAE;gBACb,OAAO,EAAE,GAAG,UAAU,KAAK;aAC5B;SACF,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ,EAAE,SAAS;SACpB,CAAC;IACJ,CAAC;CACF;AAjHD,sCAiHC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-purple-cat",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Purple cat node for n8n",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"dev": "tsc --watch"
|
|
9
|
+
},
|
|
10
|
+
"n8n": {
|
|
11
|
+
"n8nNodesApiVersion": 1,
|
|
12
|
+
"credentials": [
|
|
13
|
+
"dist/credentials/CommandCodeApi.credentials.js"
|
|
14
|
+
],
|
|
15
|
+
"nodes": [
|
|
16
|
+
"dist/nodes/CommandCode/CommandCode.node.js",
|
|
17
|
+
"dist/nodes/CommandCodeLm/CommandCodeLm.node.js"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^20.19.43",
|
|
22
|
+
"n8n-workflow": "^1.120.17",
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"n8n-workflow": "*"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [],
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@langchain/core": "^1.1.49"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IAuthenticateGeneric,
|
|
3
|
+
ICredentialType,
|
|
4
|
+
INodeProperties,
|
|
5
|
+
} from 'n8n-workflow';
|
|
6
|
+
|
|
7
|
+
export class CommandCodeApi implements ICredentialType {
|
|
8
|
+
name = 'commandCodeApi';
|
|
9
|
+
displayName = 'Command Code API';
|
|
10
|
+
documentationUrl = 'https://github.com/yourusername/n8n-nodes-command-code';
|
|
11
|
+
|
|
12
|
+
properties: INodeProperties[] = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Gateway URL',
|
|
15
|
+
name: 'gatewayUrl',
|
|
16
|
+
type: 'string',
|
|
17
|
+
default: 'http://cmd.apps.marno.pro',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'Your Command Code Gateway URL',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Gateway API Key',
|
|
23
|
+
name: 'gatewayKey',
|
|
24
|
+
type: 'string',
|
|
25
|
+
typeOptions: { password: true },
|
|
26
|
+
default: '',
|
|
27
|
+
required: true,
|
|
28
|
+
description: 'API key for gateway authentication',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
authenticate: IAuthenticateGeneric = {
|
|
33
|
+
type: 'generic',
|
|
34
|
+
properties: {
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: '=Bearer {{$credentials.gatewayKey}}',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeExecutionData,
|
|
4
|
+
INodeType,
|
|
5
|
+
INodeTypeDescription,
|
|
6
|
+
IHttpRequestMethods,
|
|
7
|
+
} from 'n8n-workflow';
|
|
8
|
+
|
|
9
|
+
export class CommandCode implements INodeType {
|
|
10
|
+
description: INodeTypeDescription = {
|
|
11
|
+
displayName: 'Command Code',
|
|
12
|
+
name: 'commandCode',
|
|
13
|
+
icon: 'file:commandcode.svg',
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
subtitle: '={{ $parameter["operation"] }}',
|
|
17
|
+
description: 'Use Command Code AI models',
|
|
18
|
+
defaults: {
|
|
19
|
+
name: 'Command Code',
|
|
20
|
+
},
|
|
21
|
+
inputs: ['main'],
|
|
22
|
+
outputs: ['main'],
|
|
23
|
+
credentials: [
|
|
24
|
+
{
|
|
25
|
+
name: 'commandCodeApi',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
properties: [
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Operation',
|
|
32
|
+
name: 'operation',
|
|
33
|
+
type: 'options',
|
|
34
|
+
noDataExpression: true,
|
|
35
|
+
options: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Chat',
|
|
38
|
+
value: 'chat',
|
|
39
|
+
action: 'Send a chat message',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
default: 'chat',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Model',
|
|
46
|
+
name: 'model',
|
|
47
|
+
type: 'options',
|
|
48
|
+
options: [
|
|
49
|
+
{ name: 'Claude Sonnet 4.6', value: 'claude-sonnet-4-6' },
|
|
50
|
+
{ name: 'Claude Fable 5', value: 'claude-fable-5' },
|
|
51
|
+
{ name: 'Claude Opus 4.8', value: 'claude-opus-4-8' },
|
|
52
|
+
{ name: 'Claude Haiku 4.5', value: 'claude-haiku-4-5-20251001' },
|
|
53
|
+
{ name: 'GPT-5.5', value: 'gpt-5.5' },
|
|
54
|
+
{ name: 'GPT-5.4', value: 'gpt-5.4' },
|
|
55
|
+
{ name: 'GPT-5.4 Mini', value: 'gpt-5.4-mini' },
|
|
56
|
+
{ name: 'DeepSeek V4 Pro', value: 'deepseek/deepseek-v4-pro' },
|
|
57
|
+
{ name: 'DeepSeek V4 Flash', value: 'deepseek/deepseek-v4-flash' },
|
|
58
|
+
{ name: 'Kimi K2.7 Code', value: 'moonshotai/Kimi-K2.7-Code' },
|
|
59
|
+
{ name: 'Kimi K2.6', value: 'moonshotai/Kimi-K2.6' },
|
|
60
|
+
{ name: 'GLM 5.2', value: 'zai-org/GLM-5.2' },
|
|
61
|
+
{ name: 'GLM 5.1', value: 'zai-org/GLM-5.1' },
|
|
62
|
+
{ name: 'MiniMax M3', value: 'MiniMaxAI/MiniMax-M3' },
|
|
63
|
+
{ name: 'MiniMax M2.7', value: 'MiniMaxAI/MiniMax-M2.7' },
|
|
64
|
+
{ name: 'Mimo V2.5 Pro', value: 'xiaomi/mimo-v2.5-pro' },
|
|
65
|
+
{ name: 'Mimo V2.5', value: 'xiaomi/mimo-v2.5' },
|
|
66
|
+
{ name: 'Qwen 3.7 Max', value: 'Qwen/Qwen3.7-Max' },
|
|
67
|
+
{ name: 'Qwen 3.7 Plus', value: 'Qwen/Qwen3.7-Plus' },
|
|
68
|
+
{ name: 'Step 3.7 Flash', value: 'stepfun/Step-3.7-Flash' },
|
|
69
|
+
{ name: 'Gemini 3.5 Flash', value: 'google/gemini-3.5-flash' },
|
|
70
|
+
{ name: 'Gemini 3.1 Flash Lite', value: 'google/gemini-3.1-flash-lite' },
|
|
71
|
+
{ name: 'Nemotron 3 Ultra', value: 'nvidia/nemotron-3-ultra-550b-a55b' },
|
|
72
|
+
],
|
|
73
|
+
default: 'xiaomi/mimo-v2.5',
|
|
74
|
+
description: 'The model to use',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Messages',
|
|
78
|
+
name: 'messages',
|
|
79
|
+
type: 'json',
|
|
80
|
+
default: '[]',
|
|
81
|
+
required: true,
|
|
82
|
+
description: 'Array of message objects with role and content',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
displayName: 'Options',
|
|
86
|
+
name: 'options',
|
|
87
|
+
type: 'collection',
|
|
88
|
+
placeholder: 'Add Option',
|
|
89
|
+
default: {},
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Temperature',
|
|
93
|
+
name: 'temperature',
|
|
94
|
+
type: 'number',
|
|
95
|
+
typeOptions: {
|
|
96
|
+
minValue: 0,
|
|
97
|
+
maxValue: 2,
|
|
98
|
+
numberPrecision: 1,
|
|
99
|
+
},
|
|
100
|
+
default: 0.7,
|
|
101
|
+
description: 'Sampling temperature',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Max Tokens',
|
|
105
|
+
name: 'maxTokens',
|
|
106
|
+
type: 'number',
|
|
107
|
+
typeOptions: {
|
|
108
|
+
minValue: 1,
|
|
109
|
+
maxValue: 32000,
|
|
110
|
+
},
|
|
111
|
+
default: 4096,
|
|
112
|
+
description: 'Maximum tokens to generate',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'System Prompt',
|
|
116
|
+
name: 'systemPrompt',
|
|
117
|
+
type: 'string',
|
|
118
|
+
typeOptions: { rows: 4 },
|
|
119
|
+
default: '',
|
|
120
|
+
description: 'System prompt for the model',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
128
|
+
const items = this.getInputData();
|
|
129
|
+
const returnData: INodeExecutionData[] = [];
|
|
130
|
+
|
|
131
|
+
const credentials = await this.getCredentials('commandCodeApi');
|
|
132
|
+
const gatewayUrl = credentials.gatewayUrl as string;
|
|
133
|
+
|
|
134
|
+
for (let i = 0; i < items.length; i++) {
|
|
135
|
+
const operation = this.getNodeParameter('operation', i) as string;
|
|
136
|
+
|
|
137
|
+
if (operation === 'chat') {
|
|
138
|
+
const model = this.getNodeParameter('model', i) as string;
|
|
139
|
+
const messagesStr = this.getNodeParameter('messages', i) as string;
|
|
140
|
+
const options = this.getNodeParameter('options', i) as {
|
|
141
|
+
temperature?: number;
|
|
142
|
+
maxTokens?: number;
|
|
143
|
+
systemPrompt?: string;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
let messages = JSON.parse(messagesStr);
|
|
147
|
+
|
|
148
|
+
// Add system prompt if provided
|
|
149
|
+
if (options.systemPrompt) {
|
|
150
|
+
messages = [
|
|
151
|
+
{ role: 'system', content: options.systemPrompt },
|
|
152
|
+
...messages,
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const response = await this.helpers.httpRequest({
|
|
157
|
+
method: 'POST' as IHttpRequestMethods,
|
|
158
|
+
url: `${gatewayUrl}/v1/chat/completions`,
|
|
159
|
+
body: {
|
|
160
|
+
model,
|
|
161
|
+
messages,
|
|
162
|
+
temperature: options.temperature ?? 0.7,
|
|
163
|
+
max_tokens: options.maxTokens ?? 4096,
|
|
164
|
+
stream: false,
|
|
165
|
+
},
|
|
166
|
+
json: true,
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
returnData.push({
|
|
170
|
+
json: response,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return [returnData];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INodeType,
|
|
3
|
+
INodeTypeDescription,
|
|
4
|
+
ISupplyDataFunctions,
|
|
5
|
+
NodeConnectionTypes,
|
|
6
|
+
} from 'n8n-workflow';
|
|
7
|
+
import { ChatOpenAI } from '@langchain/openai';
|
|
8
|
+
|
|
9
|
+
export class CommandCodeLm implements INodeType {
|
|
10
|
+
description: INodeTypeDescription = {
|
|
11
|
+
displayName: 'Command Code Chat Model',
|
|
12
|
+
name: 'commandCodeLm',
|
|
13
|
+
icon: 'file:commandcode.svg',
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
description: 'Use Command Code as a chat model for AI Agent',
|
|
17
|
+
defaults: {
|
|
18
|
+
name: 'Command Code Chat Model',
|
|
19
|
+
},
|
|
20
|
+
inputs: [],
|
|
21
|
+
outputs: [NodeConnectionTypes.AiLanguageModel],
|
|
22
|
+
outputNames: ['Model'],
|
|
23
|
+
credentials: [
|
|
24
|
+
{
|
|
25
|
+
name: 'commandCodeApi',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
properties: [
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Model',
|
|
32
|
+
name: 'model',
|
|
33
|
+
type: 'options',
|
|
34
|
+
options: [
|
|
35
|
+
{ name: 'Claude Sonnet 4.6', value: 'claude-sonnet-4-6' },
|
|
36
|
+
{ name: 'Claude Fable 5', value: 'claude-fable-5' },
|
|
37
|
+
{ name: 'Claude Opus 4.8', value: 'claude-opus-4-8' },
|
|
38
|
+
{ name: 'Claude Haiku 4.5', value: 'claude-haiku-4-5-20251001' },
|
|
39
|
+
{ name: 'GPT-5.5', value: 'gpt-5.5' },
|
|
40
|
+
{ name: 'GPT-5.4', value: 'gpt-5.4' },
|
|
41
|
+
{ name: 'GPT-5.4 Mini', value: 'gpt-5.4-mini' },
|
|
42
|
+
{ name: 'DeepSeek V4 Pro', value: 'deepseek/deepseek-v4-pro' },
|
|
43
|
+
{ name: 'DeepSeek V4 Flash', value: 'deepseek/deepseek-v4-flash' },
|
|
44
|
+
{ name: 'Kimi K2.7 Code', value: 'moonshotai/Kimi-K2.7-Code' },
|
|
45
|
+
{ name: 'Kimi K2.6', value: 'moonshotai/Kimi-K2.6' },
|
|
46
|
+
{ name: 'GLM 5.2', value: 'zai-org/GLM-5.2' },
|
|
47
|
+
{ name: 'GLM 5.1', value: 'zai-org/GLM-5.1' },
|
|
48
|
+
{ name: 'MiniMax M3', value: 'MiniMaxAI/MiniMax-M3' },
|
|
49
|
+
{ name: 'MiniMax M2.7', value: 'MiniMaxAI/MiniMax-M2.7' },
|
|
50
|
+
{ name: 'Mimo V2.5 Pro', value: 'xiaomi/mimo-v2.5-pro' },
|
|
51
|
+
{ name: 'Mimo V2.5', value: 'xiaomi/mimo-v2.5' },
|
|
52
|
+
{ name: 'Qwen 3.7 Max', value: 'Qwen/Qwen3.7-Max' },
|
|
53
|
+
{ name: 'Qwen 3.7 Plus', value: 'Qwen/Qwen3.7-Plus' },
|
|
54
|
+
{ name: 'Step 3.7 Flash', value: 'stepfun/Step-3.7-Flash' },
|
|
55
|
+
{ name: 'Gemini 3.5 Flash', value: 'google/gemini-3.5-flash' },
|
|
56
|
+
{ name: 'Gemini 3.1 Flash Lite', value: 'google/gemini-3.1-flash-lite' },
|
|
57
|
+
{ name: 'Nemotron 3 Ultra', value: 'nvidia/nemotron-3-ultra-550b-a55b' },
|
|
58
|
+
],
|
|
59
|
+
default: 'xiaomi/mimo-v2.5',
|
|
60
|
+
description: 'The model to use',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Options',
|
|
64
|
+
name: 'options',
|
|
65
|
+
type: 'collection',
|
|
66
|
+
placeholder: 'Add Option',
|
|
67
|
+
default: {},
|
|
68
|
+
options: [
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Temperature',
|
|
71
|
+
name: 'temperature',
|
|
72
|
+
type: 'number',
|
|
73
|
+
typeOptions: {
|
|
74
|
+
minValue: 0,
|
|
75
|
+
maxValue: 2,
|
|
76
|
+
numberPrecision: 1,
|
|
77
|
+
},
|
|
78
|
+
default: 0.7,
|
|
79
|
+
description: 'Sampling temperature',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Max Tokens',
|
|
83
|
+
name: 'maxTokens',
|
|
84
|
+
type: 'number',
|
|
85
|
+
typeOptions: {
|
|
86
|
+
minValue: 1,
|
|
87
|
+
maxValue: 32000,
|
|
88
|
+
},
|
|
89
|
+
default: 4096,
|
|
90
|
+
description: 'Maximum tokens to generate',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
async supplyData(this: ISupplyDataFunctions, itemIndex: number) {
|
|
98
|
+
const credentials = await this.getCredentials('commandCodeApi');
|
|
99
|
+
const gatewayUrl = credentials.gatewayUrl as string;
|
|
100
|
+
const gatewayKey = credentials.gatewayKey as string;
|
|
101
|
+
|
|
102
|
+
const model = this.getNodeParameter('model', itemIndex) as string;
|
|
103
|
+
const options = this.getNodeParameter('options', itemIndex) as {
|
|
104
|
+
temperature?: number;
|
|
105
|
+
maxTokens?: number;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const chatModel = new ChatOpenAI({
|
|
109
|
+
apiKey: gatewayKey,
|
|
110
|
+
model,
|
|
111
|
+
temperature: options.temperature ?? 0.7,
|
|
112
|
+
maxTokens: options.maxTokens ?? 4096,
|
|
113
|
+
configuration: {
|
|
114
|
+
baseURL: `${gatewayUrl}/v1`,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
response: chatModel,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
package/test.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Simple test to verify the node works
|
|
2
|
+
const { CommandCodeLm } = require('./dist/nodes/CommandCodeLm/CommandCodeLm.node');
|
|
3
|
+
|
|
4
|
+
const node = new CommandCodeLm();
|
|
5
|
+
console.log('Node name:', node.description.name);
|
|
6
|
+
console.log('Display name:', node.description.displayName);
|
|
7
|
+
console.log('Outputs:', node.description.outputs);
|
|
8
|
+
console.log('Credentials:', node.description.credentials);
|
|
9
|
+
console.log('Properties:', node.description.properties.map(p => p.name));
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*"],
|
|
17
|
+
"exclude": ["node_modules", "dist"]
|
|
18
|
+
}
|