@n8n/n8n-nodes-langchain 2.18.1 → 2.18.2
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/known/credentials.json +1 -0
- package/dist/known/nodes.json +4 -0
- package/dist/node-definitions/.nodes-hash +1 -1
- package/dist/node-definitions/index.ts +4 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/index.ts +12 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/index.schema.js +26 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/index.ts +21 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_audio/index.schema.js +18 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_audio/index.ts +10 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_audio/operation_text_to_speech.schema.js +32 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_audio/operation_text_to_speech.ts +75 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_image/index.schema.js +18 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_image/index.ts +10 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_image/operation_generate.schema.js +33 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_image/operation_generate.ts +64 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_text/index.schema.js +18 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_text/index.ts +10 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_text/operation_message.schema.js +31 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_text/operation_message.ts +82 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_video/index.schema.js +22 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_video/index.ts +15 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_video/operation_image_to_video.schema.js +36 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_video/operation_image_to_video.ts +103 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_video/operation_text_to_video.schema.js +33 -0
- package/dist/node-definitions/nodes/n8n-nodes-langchain/minimax/v1/resource_video/operation_text_to_video.ts +60 -0
- package/dist/nodes/vendors/MiniMax/MiniMax.node.d.ts +5 -0
- package/dist/nodes/vendors/MiniMax/MiniMax.node.js +15 -0
- package/dist/nodes/vendors/MiniMax/MiniMax.node.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/audio/index.d.ts +4 -0
- package/dist/nodes/vendors/MiniMax/actions/audio/index.js +62 -0
- package/dist/nodes/vendors/MiniMax/actions/audio/index.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/audio/tts.operation.d.ts +29 -0
- package/dist/nodes/vendors/MiniMax/actions/audio/tts.operation.js +252 -0
- package/dist/nodes/vendors/MiniMax/actions/audio/tts.operation.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/image/generate.operation.d.ts +29 -0
- package/dist/nodes/vendors/MiniMax/actions/image/generate.operation.js +159 -0
- package/dist/nodes/vendors/MiniMax/actions/image/generate.operation.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/image/index.d.ts +4 -0
- package/dist/nodes/vendors/MiniMax/actions/image/index.js +62 -0
- package/dist/nodes/vendors/MiniMax/actions/image/index.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/node.type.d.ts +9 -0
- package/dist/nodes/vendors/MiniMax/actions/node.type.js +3 -0
- package/dist/nodes/vendors/MiniMax/actions/node.type.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/router.d.ts +2 -0
- package/dist/nodes/vendors/MiniMax/actions/router.js +86 -0
- package/dist/nodes/vendors/MiniMax/actions/router.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/text/index.d.ts +4 -0
- package/dist/nodes/vendors/MiniMax/actions/text/index.js +62 -0
- package/dist/nodes/vendors/MiniMax/actions/text/index.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/text/message.operation.d.ts +29 -0
- package/dist/nodes/vendors/MiniMax/actions/text/message.operation.js +287 -0
- package/dist/nodes/vendors/MiniMax/actions/text/message.operation.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/versionDescription.d.ts +2 -0
- package/dist/nodes/vendors/MiniMax/actions/versionDescription.js +118 -0
- package/dist/nodes/vendors/MiniMax/actions/versionDescription.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/video/generate.i2v.operation.d.ts +29 -0
- package/dist/nodes/vendors/MiniMax/actions/video/generate.i2v.operation.js +324 -0
- package/dist/nodes/vendors/MiniMax/actions/video/generate.i2v.operation.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/video/generate.t2v.operation.d.ts +29 -0
- package/dist/nodes/vendors/MiniMax/actions/video/generate.t2v.operation.js +161 -0
- package/dist/nodes/vendors/MiniMax/actions/video/generate.t2v.operation.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/actions/video/index.d.ts +5 -0
- package/dist/nodes/vendors/MiniMax/actions/video/index.js +71 -0
- package/dist/nodes/vendors/MiniMax/actions/video/index.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/helpers/interfaces.d.ts +88 -0
- package/dist/nodes/vendors/MiniMax/helpers/interfaces.js +3 -0
- package/dist/nodes/vendors/MiniMax/helpers/interfaces.js.map +1 -0
- package/dist/nodes/vendors/MiniMax/minimax.svg +10 -0
- package/dist/nodes/vendors/MiniMax/transport/index.d.ts +14 -0
- package/dist/nodes/vendors/MiniMax/transport/index.js +60 -0
- package/dist/nodes/vendors/MiniMax/transport/index.js.map +1 -0
- package/dist/typecheck.tsbuildinfo +1 -1
- package/dist/types/credentials.json +1 -1
- package/dist/types/nodes.json +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { IDataObject } from 'n8n-workflow';
|
|
2
|
+
export interface ChatMessage {
|
|
3
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
4
|
+
content: string;
|
|
5
|
+
tool_call_id?: string;
|
|
6
|
+
tool_calls?: ToolCall[];
|
|
7
|
+
reasoning_content?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolFunction {
|
|
10
|
+
type: 'function';
|
|
11
|
+
function: {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
parameters?: IDataObject;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ToolCall {
|
|
18
|
+
id: string;
|
|
19
|
+
type: 'function';
|
|
20
|
+
function: {
|
|
21
|
+
name: string;
|
|
22
|
+
arguments: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface ChatCompletionResponse {
|
|
26
|
+
id: string;
|
|
27
|
+
object: string;
|
|
28
|
+
created: number;
|
|
29
|
+
model: string;
|
|
30
|
+
choices: Array<{
|
|
31
|
+
index: number;
|
|
32
|
+
message: {
|
|
33
|
+
role: string;
|
|
34
|
+
content: string | null;
|
|
35
|
+
reasoning_content?: string | null;
|
|
36
|
+
tool_calls?: ToolCall[];
|
|
37
|
+
};
|
|
38
|
+
finish_reason: string;
|
|
39
|
+
}>;
|
|
40
|
+
usage: {
|
|
41
|
+
prompt_tokens: number;
|
|
42
|
+
completion_tokens: number;
|
|
43
|
+
total_tokens: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface ImageGenerationResponse {
|
|
47
|
+
id: string;
|
|
48
|
+
data: {
|
|
49
|
+
image_urls?: string[];
|
|
50
|
+
image_base64?: string[];
|
|
51
|
+
};
|
|
52
|
+
metadata: {
|
|
53
|
+
success_count: number;
|
|
54
|
+
failed_count: number;
|
|
55
|
+
};
|
|
56
|
+
base_resp: {
|
|
57
|
+
status_code: number;
|
|
58
|
+
status_msg: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface VideoGenerationResponse {
|
|
62
|
+
task_id: string;
|
|
63
|
+
base_resp: {
|
|
64
|
+
status_code: number;
|
|
65
|
+
status_msg: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface T2AResponse {
|
|
69
|
+
data: {
|
|
70
|
+
audio: string;
|
|
71
|
+
status: number;
|
|
72
|
+
};
|
|
73
|
+
extra_info: {
|
|
74
|
+
audio_length: number;
|
|
75
|
+
audio_sample_rate: number;
|
|
76
|
+
audio_size: number;
|
|
77
|
+
bitrate: number;
|
|
78
|
+
audio_format: string;
|
|
79
|
+
audio_channel: number;
|
|
80
|
+
usage_characters: number;
|
|
81
|
+
word_count: number;
|
|
82
|
+
};
|
|
83
|
+
trace_id: string;
|
|
84
|
+
base_resp: {
|
|
85
|
+
status_code: number;
|
|
86
|
+
status_msg: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../nodes/vendors/MiniMax/helpers/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 490.16 411.7" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="minimax-grad" y1="205.85" x2="490.16" y2="205.85" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop offset="0" stop-color="#e4177f"/>
|
|
5
|
+
<stop offset="0.5" stop-color="#e73562"/>
|
|
6
|
+
<stop offset="1" stop-color="#e94e4a"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
<path fill="url(#minimax-grad)" d="M233.45,40.81a17.55,17.55,0,1,0-35.1,0V331.56a40.82,40.82,0,0,1-81.63,0V145a17.55,17.55,0,1,0-35.09,0v79.06a40.82,40.82,0,0,1-81.63,0V195.42a11.63,11.63,0,0,1,23.26,0v28.66a17.55,17.55,0,0,0,35.1,0V145A40.82,40.82,0,0,1,140,145V331.56a17.55,17.55,0,0,0,35.1,0V217.5h0V40.81a40.81,40.81,0,1,1,81.62,0V281.56a11.63,11.63,0,1,1-23.26,0Zm215.9,63.4A40.86,40.86,0,0,0,408.53,145V300.85a17.55,17.55,0,0,1-35.09,0v-260a40.82,40.82,0,0,0-81.63,0V370.89a17.55,17.55,0,0,1-35.1,0V330a11.63,11.63,0,1,0-23.26,0v40.86a40.81,40.81,0,0,0,81.62,0V40.81a17.55,17.55,0,0,1,35.1,0v260a40.82,40.82,0,0,0,81.63,0V145a17.55,17.55,0,1,1,35.1,0V281.56a11.63,11.63,0,0,0,23.26,0V145A40.85,40.85,0,0,0,449.35,104.21Z"/>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
type RequestParameters = {
|
|
3
|
+
headers?: IDataObject;
|
|
4
|
+
body?: IDataObject;
|
|
5
|
+
qs?: IDataObject;
|
|
6
|
+
option?: IDataObject;
|
|
7
|
+
};
|
|
8
|
+
export declare function apiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, parameters?: RequestParameters): Promise<any>;
|
|
9
|
+
export declare function pollVideoTask(this: IExecuteFunctions, taskId: string, pollIntervalMs?: number): Promise<{
|
|
10
|
+
fileId: string;
|
|
11
|
+
status: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function getVideoDownloadUrl(this: IExecuteFunctions, fileId: string): Promise<string>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiRequest = apiRequest;
|
|
4
|
+
exports.pollVideoTask = pollVideoTask;
|
|
5
|
+
exports.getVideoDownloadUrl = getVideoDownloadUrl;
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
async function apiRequest(method, endpoint, parameters) {
|
|
8
|
+
const { body, qs, option, headers } = parameters ?? {};
|
|
9
|
+
const credentials = await this.getCredentials('minimaxApi');
|
|
10
|
+
const baseUrl = credentials.url ?? 'https://api.minimax.io/v1';
|
|
11
|
+
const url = `${baseUrl}${endpoint}`;
|
|
12
|
+
const options = {
|
|
13
|
+
headers: headers ?? {},
|
|
14
|
+
method,
|
|
15
|
+
body,
|
|
16
|
+
qs,
|
|
17
|
+
url,
|
|
18
|
+
json: true,
|
|
19
|
+
};
|
|
20
|
+
if (option && Object.keys(option).length !== 0) {
|
|
21
|
+
Object.assign(options, option);
|
|
22
|
+
}
|
|
23
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'minimaxApi', options);
|
|
24
|
+
}
|
|
25
|
+
const VIDEO_TERMINAL_STATUSES = ['Success', 'Fail'];
|
|
26
|
+
const DEFAULT_POLL_INTERVAL_MS = 15_000;
|
|
27
|
+
const MAX_POLL_ATTEMPTS = 60;
|
|
28
|
+
async function pollVideoTask(taskId, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS) {
|
|
29
|
+
for (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {
|
|
30
|
+
const response = await apiRequest.call(this, 'GET', '/query/video_generation', {
|
|
31
|
+
qs: { task_id: taskId },
|
|
32
|
+
});
|
|
33
|
+
const status = response?.status;
|
|
34
|
+
if (VIDEO_TERMINAL_STATUSES.includes(status)) {
|
|
35
|
+
if (status === 'Fail') {
|
|
36
|
+
const errorCode = response?.base_resp?.status_code || 'UNKNOWN';
|
|
37
|
+
const errorMessage = response?.base_resp?.status_msg || 'Video generation task failed';
|
|
38
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Task failed: [${errorCode}] ${errorMessage}`);
|
|
39
|
+
}
|
|
40
|
+
const fileId = response?.file_id;
|
|
41
|
+
if (!fileId) {
|
|
42
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Video generation succeeded but no file_id was returned');
|
|
43
|
+
}
|
|
44
|
+
return { fileId, status };
|
|
45
|
+
}
|
|
46
|
+
await (0, n8n_workflow_1.sleep)(pollIntervalMs);
|
|
47
|
+
}
|
|
48
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Video task ${taskId} did not complete within the maximum polling time. You can query the task manually using the task ID.`);
|
|
49
|
+
}
|
|
50
|
+
async function getVideoDownloadUrl(fileId) {
|
|
51
|
+
const response = await apiRequest.call(this, 'GET', '/files/retrieve', {
|
|
52
|
+
qs: { file_id: fileId },
|
|
53
|
+
});
|
|
54
|
+
const downloadUrl = response?.file?.download_url;
|
|
55
|
+
if (!downloadUrl) {
|
|
56
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to retrieve download URL for file ${fileId}`);
|
|
57
|
+
}
|
|
58
|
+
return downloadUrl;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/vendors/MiniMax/transport/index.ts"],"names":[],"mappings":";;AAeA,gCA0BC;AAMD,sCAqCC;AAED,kDAiBC;AAjGD,+CAAyD;AASlD,KAAK,UAAU,UAAU,CAE/B,MAA2B,EAC3B,QAAgB,EAChB,UAA8B;IAE9B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,IAAI,EAAE,CAAC;IAEvD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAI,WAAW,CAAC,GAAc,IAAI,2BAA2B,CAAC;IAC3E,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAC;IAEpC,MA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