vidspotai-shared 1.0.58 → 1.0.59
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB;;;GAGG;AAGH,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB;;;GAGG;AAGH,eAAO,MAAM,+BAA+B,uBAAuB,CAAC;AAmGpE,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAuDf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoD3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6EjD,aAAa,CAAC,EACZ,QAAQ,EACR,UAAmB,EACnB,QAAY,EACZ,SAAiB,GAClB,EAAE,iBAAiB,GAAG,MAAM;CAW9B"}
|
|
@@ -20,39 +20,61 @@ const logger_1 = require("../../../../utils/logger");
|
|
|
20
20
|
// Marker prefix on errorMessage so sceneMonitor's classifier can suppress Slack
|
|
21
21
|
// alerts for user-input failures (image too small, unsupported format, etc.).
|
|
22
22
|
exports.MINIMAX_USER_INPUT_ERROR_PREFIX = "user_input_error: ";
|
|
23
|
-
function
|
|
23
|
+
function classifyMinimaxError(code, msg) {
|
|
24
24
|
const lower = (msg || "").toLowerCase();
|
|
25
25
|
// Input-validation errors — user can fix these by changing their input.
|
|
26
26
|
// Detected by message text because Minimax does not give a stable code for these.
|
|
27
27
|
if (lower.includes("first_frame_image") || lower.includes("last_frame_image") || lower.includes("subject_reference")) {
|
|
28
28
|
if (lower.includes("minimum pixel") || lower.includes("short side")) {
|
|
29
|
-
return
|
|
29
|
+
return { message: "Your input image is too small. Please upload an image at least 300px on the short side.", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
|
|
30
30
|
}
|
|
31
31
|
if (lower.includes("aspect ratio") || lower.includes("ratio")) {
|
|
32
|
-
return
|
|
32
|
+
return { message: "Your input image's aspect ratio is not supported. Please use a more standard ratio (e.g. 16:9, 9:16, 1:1).", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
|
|
33
33
|
}
|
|
34
34
|
if (lower.includes("format") || lower.includes("type")) {
|
|
35
|
-
return
|
|
35
|
+
return { message: "Your input image format is not supported. Please use JPEG or PNG.", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
|
|
36
36
|
}
|
|
37
37
|
if (lower.includes("size") || lower.includes("too large")) {
|
|
38
|
-
return
|
|
38
|
+
return { message: "Your input image is too large. Please upload a smaller image.", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
|
|
39
|
+
}
|
|
40
|
+
return { message: `Your input image was rejected by the provider: ${msg}`, code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
|
|
41
|
+
}
|
|
42
|
+
// Code 2013 = "invalid params". Sub-classify by message text — Minimax reuses
|
|
43
|
+
// this single code for prompt-too-long, prompt-empty, and other shape errors.
|
|
44
|
+
if (code === 2013) {
|
|
45
|
+
if (lower.includes("prompt is too long") || lower.includes("prompt too long") || (lower.includes("prompt") && lower.includes("too long"))) {
|
|
46
|
+
return { message: "Your prompt is too long for this model. Please shorten it and try again.", code: errors_1.USER_FACING_ERROR_CODES.PROMPT_TOO_LONG, isUserInput: true };
|
|
47
|
+
}
|
|
48
|
+
if (lower.includes("prompt")) {
|
|
49
|
+
return { message: `Your prompt was rejected by the provider: ${msg}. Please adjust it and try again.`, code: errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID, isUserInput: true };
|
|
39
50
|
}
|
|
40
|
-
return
|
|
51
|
+
return { message: `Invalid request parameters: ${msg}. Please adjust your input and try again.`, code: errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID, isUserInput: true };
|
|
41
52
|
}
|
|
42
53
|
switch (code) {
|
|
43
54
|
case 1026:
|
|
44
|
-
return
|
|
55
|
+
return { message: "Your request was declined because the prompt or input image contains content that violates the content policy. Please modify your prompt or use a different image and try again.", code: errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION, isUserInput: true };
|
|
45
56
|
case 1027:
|
|
46
|
-
return
|
|
57
|
+
return { message: "Your request was declined because the generated content was flagged for sensitive material. Please adjust your prompt and try again.", code: errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION, isUserInput: true };
|
|
47
58
|
case 1002:
|
|
48
|
-
return "The request was rejected due to a rate limit or quota issue. Please try again in a moment.";
|
|
59
|
+
return { message: "The request was rejected due to a rate limit or quota issue. Please try again in a moment.", code: errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_RATE_LIMITED, isUserInput: false };
|
|
49
60
|
case 1004:
|
|
50
|
-
return "Authorization failed for the video generation service. Please contact support.";
|
|
61
|
+
return { message: "Authorization failed for the video generation service. Please contact support.", isUserInput: false };
|
|
51
62
|
default:
|
|
52
|
-
|
|
53
|
-
return msg || `Generation failed (code ${code})`;
|
|
63
|
+
return { message: msg || `Generation failed (code ${code})`, isUserInput: false };
|
|
54
64
|
}
|
|
55
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Back-compat wrapper for callers that only need the string form (used by
|
|
68
|
+
* checkVideoStatus when persisting scene.errorMessage on async failures).
|
|
69
|
+
* Preserves the existing MINIMAX_USER_INPUT_ERROR_PREFIX marker so the
|
|
70
|
+
* sceneMonitor's classifier still suppresses Slack noise for user-input errors.
|
|
71
|
+
*/
|
|
72
|
+
function minimaxStatusToUserMessage(code, msg) {
|
|
73
|
+
const cls = classifyMinimaxError(code, msg);
|
|
74
|
+
return cls.isUserInput
|
|
75
|
+
? `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}${cls.message}`
|
|
76
|
+
: cls.message;
|
|
77
|
+
}
|
|
56
78
|
// Transient axios/network failures that warrant a retry.
|
|
57
79
|
const MINIMAX_TRANSIENT_NETWORK_CODES = new Set([
|
|
58
80
|
"ECONNRESET",
|
|
@@ -163,13 +185,14 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
163
185
|
// half-triggered scene with no task handle.
|
|
164
186
|
const baseStatus = response.base_resp?.status_code ?? 0;
|
|
165
187
|
if (baseStatus !== 0 || !response.task_id) {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
throw new errors_1.UserFacingError(
|
|
188
|
+
const cls = classifyMinimaxError(baseStatus, response.base_resp?.status_msg ?? "");
|
|
189
|
+
if (cls.isUserInput) {
|
|
190
|
+
// UserFacingError → logged as warn (no Slack page) AND serialized
|
|
191
|
+
// with `code` so the frontend can show a translated message.
|
|
192
|
+
throw new errors_1.UserFacingError(cls.message, cls.code);
|
|
171
193
|
}
|
|
172
|
-
|
|
194
|
+
// Provider-side failure the user cannot fix — Slack alert + raw debug context.
|
|
195
|
+
throw new Error(`Minimax video_generation returned no task_id (code ${baseStatus}): ${cls.message}`);
|
|
173
196
|
}
|
|
174
197
|
return { task: response.task_id, status: types_1.EVideoSceneStatus.TRIGGERED };
|
|
175
198
|
}
|
package/lib/utils/errors.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export declare const USER_FACING_ERROR_CODES: {
|
|
|
26
26
|
readonly VIDEO_PROVIDER_TIMEOUT: "VIDEO_PROVIDER_TIMEOUT";
|
|
27
27
|
readonly TTS_PROVIDER_TIMEOUT: "TTS_PROVIDER_TIMEOUT";
|
|
28
28
|
readonly TTS_PROVIDER_UNAVAILABLE: "TTS_PROVIDER_UNAVAILABLE";
|
|
29
|
+
readonly PROMPT_TOO_LONG: "PROMPT_TOO_LONG";
|
|
30
|
+
readonly PROMPT_INVALID: "PROMPT_INVALID";
|
|
31
|
+
readonly INPUT_IMAGE_REJECTED: "INPUT_IMAGE_REJECTED";
|
|
32
|
+
readonly CONTENT_POLICY_VIOLATION: "CONTENT_POLICY_VIOLATION";
|
|
29
33
|
};
|
|
30
34
|
export type UserFacingErrorCode = keyof typeof USER_FACING_ERROR_CODES;
|
|
31
35
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,iBAAiB,QAAQ;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAM1C,qEAAqE;IACrE,MAAM,IAAI;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAG7C;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,iBAAiB,QAAQ;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAM1C,qEAAqE;IACrE,MAAM,IAAI;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAG7C;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;CAU1B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
|
package/lib/utils/errors.js
CHANGED
|
@@ -32,4 +32,8 @@ exports.USER_FACING_ERROR_CODES = {
|
|
|
32
32
|
VIDEO_PROVIDER_TIMEOUT: "VIDEO_PROVIDER_TIMEOUT",
|
|
33
33
|
TTS_PROVIDER_TIMEOUT: "TTS_PROVIDER_TIMEOUT",
|
|
34
34
|
TTS_PROVIDER_UNAVAILABLE: "TTS_PROVIDER_UNAVAILABLE",
|
|
35
|
+
PROMPT_TOO_LONG: "PROMPT_TOO_LONG",
|
|
36
|
+
PROMPT_INVALID: "PROMPT_INVALID",
|
|
37
|
+
INPUT_IMAGE_REJECTED: "INPUT_IMAGE_REJECTED",
|
|
38
|
+
CONTENT_POLICY_VIOLATION: "CONTENT_POLICY_VIOLATION",
|
|
35
39
|
};
|