vidspotai-shared 1.0.41 → 1.0.43
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/lib/globals/plans.d.ts +5 -0
- package/lib/globals/plans.d.ts.map +1 -1
- package/lib/globals/plans.js +15 -1
- package/lib/models/user.model.d.ts +7 -0
- package/lib/models/user.model.d.ts.map +1 -1
- package/lib/services/aiGen/providers/minimax/minimax.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/minimax/minimax.service.js +24 -2
- package/lib/services/credit.service.d.ts.map +1 -1
- package/lib/services/credit.service.js +23 -6
- package/lib/services/tts/providers/elevenlabs.service.d.ts.map +1 -1
- package/lib/services/tts/providers/elevenlabs.service.js +42 -22
- package/package.json +1 -1
package/lib/globals/plans.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { TPaymentPlans } from "./types";
|
|
2
2
|
export declare const PAYMENT_PLANS: Partial<TPaymentPlans>;
|
|
3
|
+
export declare const CREDIT_TOPUP_MIN = 20;
|
|
4
|
+
export declare const CREDIT_TOPUP_EXPIRY_MONTHS = 12;
|
|
5
|
+
export declare const CREDIT_TOPUP_RATE: (credits: number) => number;
|
|
6
|
+
/** Returns the Stripe charge amount in cents for a given credit count */
|
|
7
|
+
export declare const CREDIT_TOPUP_AMOUNT_CENTS: (credits: number) => number;
|
|
3
8
|
//# sourceMappingURL=plans.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../src/globals/plans.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAEd,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,aAAa,CAqChD,CAAC"}
|
|
1
|
+
{"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../src/globals/plans.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EAEd,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,aAAa,CAqChD,CAAC;AAGF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,MAInD,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,GAAI,SAAS,MAAM,KAAG,MACJ,CAAC"}
|
package/lib/globals/plans.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PAYMENT_PLANS = void 0;
|
|
6
|
+
exports.CREDIT_TOPUP_AMOUNT_CENTS = exports.CREDIT_TOPUP_RATE = exports.CREDIT_TOPUP_EXPIRY_MONTHS = exports.CREDIT_TOPUP_MIN = exports.PAYMENT_PLANS = void 0;
|
|
7
7
|
const config_1 = __importDefault(require("./config"));
|
|
8
8
|
const types_1 = require("./types");
|
|
9
9
|
exports.PAYMENT_PLANS = {
|
|
@@ -44,6 +44,20 @@ exports.PAYMENT_PLANS = {
|
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
+
// Credit top-up pricing (tiered; always more expensive than subscription rate of $0.20/credit)
|
|
48
|
+
exports.CREDIT_TOPUP_MIN = 20;
|
|
49
|
+
exports.CREDIT_TOPUP_EXPIRY_MONTHS = 12;
|
|
50
|
+
const CREDIT_TOPUP_RATE = (credits) => {
|
|
51
|
+
if (credits < 50)
|
|
52
|
+
return 0.35;
|
|
53
|
+
if (credits < 150)
|
|
54
|
+
return 0.3;
|
|
55
|
+
return 0.25;
|
|
56
|
+
};
|
|
57
|
+
exports.CREDIT_TOPUP_RATE = CREDIT_TOPUP_RATE;
|
|
58
|
+
/** Returns the Stripe charge amount in cents for a given credit count */
|
|
59
|
+
const CREDIT_TOPUP_AMOUNT_CENTS = (credits) => Math.round(credits * (0, exports.CREDIT_TOPUP_RATE)(credits) * 100);
|
|
60
|
+
exports.CREDIT_TOPUP_AMOUNT_CENTS = CREDIT_TOPUP_AMOUNT_CENTS;
|
|
47
61
|
// export const SUBSCRIPTION_PLAN_DETAILS: TSubscriptionPlanDetails = {
|
|
48
62
|
// [ESUBSCRIPTION_PLANS.BASIC]: {
|
|
49
63
|
// price: 20,
|
|
@@ -27,6 +27,13 @@ export interface IUserCredts {
|
|
|
27
27
|
total: number;
|
|
28
28
|
consumed: number;
|
|
29
29
|
reserved?: number;
|
|
30
|
+
purchased?: {
|
|
31
|
+
total: number;
|
|
32
|
+
consumed: number;
|
|
33
|
+
expiresAt: string;
|
|
34
|
+
lastPurchasedAt: string;
|
|
35
|
+
sessionId?: string;
|
|
36
|
+
};
|
|
30
37
|
}
|
|
31
38
|
export interface IUserSubscription {
|
|
32
39
|
status: ESUBSCRIPTION_STATUS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,SAAS,EACT,kBAAkB,EAElB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;IACtC,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;IAC3D,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE;QAEf,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;QACrD,aAAa,EAAE,IAAI,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,UAAU,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"user.model.d.ts","sourceRoot":"","sources":["../../src/models/user.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EACL,SAAS,EACT,kBAAkB,EAElB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;IACtC,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAAC;IAC3D,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE;QAEf,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;QACrD,aAAa,EAAE,IAAI,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,SAAS,CAAC,EAAE,UAAU,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,oBAAoB,CAAC;IAE7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAOrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAiClB,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IAiCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA4B3B,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"}
|
|
@@ -12,6 +12,28 @@ const helpers_1 = require("../../helpers");
|
|
|
12
12
|
const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
|
|
13
13
|
const helpers_2 = require("../../../../utils/helpers");
|
|
14
14
|
const logger_1 = require("../../../../utils/logger");
|
|
15
|
+
/**
|
|
16
|
+
* Maps Minimax base_resp status codes to user-facing error messages.
|
|
17
|
+
* Raw codes like "1026 input new_sensitive" are never shown to users.
|
|
18
|
+
*/
|
|
19
|
+
function minimaxStatusToUserMessage(code, msg) {
|
|
20
|
+
const lower = msg.toLowerCase();
|
|
21
|
+
switch (code) {
|
|
22
|
+
case 1026:
|
|
23
|
+
// Input (prompt or image) flagged by content moderation
|
|
24
|
+
return "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.";
|
|
25
|
+
case 1027:
|
|
26
|
+
// Generated output flagged by content moderation
|
|
27
|
+
return "Your request was declined because the generated content was flagged for sensitive material. Please adjust your prompt and try again.";
|
|
28
|
+
case 1002:
|
|
29
|
+
return "The request was rejected due to a rate limit or quota issue. Please try again in a moment.";
|
|
30
|
+
case 1004:
|
|
31
|
+
return "Authorization failed for the video generation service. Please contact support.";
|
|
32
|
+
default:
|
|
33
|
+
// Unknown code — return the raw message so ops can see it but strip internal codes
|
|
34
|
+
return msg || `Generation failed (code ${code})`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
15
37
|
class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
16
38
|
constructor() {
|
|
17
39
|
super();
|
|
@@ -55,7 +77,7 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
55
77
|
duration: params.duration || 6,
|
|
56
78
|
};
|
|
57
79
|
const response = await this.request("/v1/video_generation", "POST", requestBody);
|
|
58
|
-
|
|
80
|
+
logger_1.logger.info("Minimax video generation task response", { taskId: response.task_id });
|
|
59
81
|
const taskId = response.task_id;
|
|
60
82
|
return { task: taskId, status: types_1.EVideoSceneStatus.TRIGGERED };
|
|
61
83
|
}
|
|
@@ -64,7 +86,7 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
64
86
|
if (result.status === "Fail") {
|
|
65
87
|
return {
|
|
66
88
|
status: types_1.EVideoSceneStatus.FAILED,
|
|
67
|
-
errorMessage:
|
|
89
|
+
errorMessage: minimaxStatusToUserMessage(result.base_resp.status_code, result.base_resp.status_msg),
|
|
68
90
|
};
|
|
69
91
|
}
|
|
70
92
|
else if (result.status === "Success") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit.service.d.ts","sourceRoot":"","sources":["../../src/services/credit.service.ts"],"names":[],"mappings":"AAGA,qBAAa,aAAa;WACX,cAAc,CACzB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"credit.service.d.ts","sourceRoot":"","sources":["../../src/services/credit.service.ts"],"names":[],"mappings":"AAGA,qBAAa,aAAa;WACX,cAAc,CACzB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;WAkDH,aAAa,CACxB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;CAoBjB"}
|
|
@@ -14,15 +14,32 @@ class CreditService {
|
|
|
14
14
|
const credits = snap.data()?.credits;
|
|
15
15
|
const consumed = credits?.consumed ?? 0;
|
|
16
16
|
const total = credits?.total ?? 0;
|
|
17
|
-
|
|
18
|
-
//
|
|
17
|
+
const purchased = credits?.purchased;
|
|
18
|
+
// Subscription credits available
|
|
19
|
+
const subAvailable = total - consumed;
|
|
20
|
+
// Purchased credits available (only if pool exists and not expired)
|
|
21
|
+
const purchasedIsValid = purchased &&
|
|
22
|
+
purchased.total > 0 &&
|
|
23
|
+
new Date(purchased.expiresAt) > new Date();
|
|
24
|
+
const purchAvailable = purchasedIsValid
|
|
25
|
+
? purchased.total - purchased.consumed
|
|
26
|
+
: 0;
|
|
27
|
+
const totalAvailable = subAvailable + purchAvailable;
|
|
19
28
|
// 🔒 HARD INVARIANT
|
|
20
|
-
if (
|
|
29
|
+
if (creditsToConsume > totalAvailable) {
|
|
21
30
|
throw new Error("INSUFFICIENT_CREDITS");
|
|
22
31
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
// Consume subscription credits first, then purchased
|
|
33
|
+
const subDeduct = Math.min(creditsToConsume, subAvailable);
|
|
34
|
+
const purchDeduct = creditsToConsume - subDeduct;
|
|
35
|
+
const updates = {
|
|
36
|
+
"credits.consumed": consumed + subDeduct,
|
|
37
|
+
};
|
|
38
|
+
if (purchDeduct > 0) {
|
|
39
|
+
updates["credits.purchased.consumed"] =
|
|
40
|
+
(purchased?.consumed ?? 0) + purchDeduct;
|
|
41
|
+
}
|
|
42
|
+
tx.update(userRef, updates);
|
|
26
43
|
});
|
|
27
44
|
}
|
|
28
45
|
static async refundCredits(userId, creditsToRefund) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevenlabs.service.d.ts","sourceRoot":"","sources":["../../../../src/services/tts/providers/elevenlabs.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEzF,qBAAa,iBAAkB,SAAQ,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;IAW1B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"elevenlabs.service.d.ts","sourceRoot":"","sources":["../../../../src/services/tts/providers/elevenlabs.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEzF,qBAAa,iBAAkB,SAAQ,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;IAW1B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAuDrD,SAAS,IAAI,eAAe,EAAE;IAI9B,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGpD"}
|
|
@@ -23,28 +23,48 @@ class ElevenLabsService extends types_1.BaseTtsProviderService {
|
|
|
23
23
|
const languageCode = params.languageCode
|
|
24
24
|
? this.mapLanguageCode(params.languageCode)
|
|
25
25
|
: undefined;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
try {
|
|
27
|
+
const response = await axios_1.default.post(`${this.baseUrl}/text-to-speech/${voiceId}`, {
|
|
28
|
+
text: params.text,
|
|
29
|
+
model_id: elevenlabs_1.elevenlabsConfig.modelId,
|
|
30
|
+
language_code: languageCode,
|
|
31
|
+
voice_settings: {
|
|
32
|
+
stability: 0.5,
|
|
33
|
+
similarity_boost: 0.75,
|
|
34
|
+
},
|
|
35
|
+
}, {
|
|
36
|
+
headers: {
|
|
37
|
+
"xi-api-key": this.apiKey,
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Accept: "audio/mpeg",
|
|
40
|
+
},
|
|
41
|
+
responseType: "arraybuffer",
|
|
42
|
+
timeout: 60000,
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
audioBuffer: Buffer.from(response.data),
|
|
46
|
+
mimeType: "audio/mpeg",
|
|
47
|
+
extension: "mp3",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
// responseType:"arraybuffer" causes error bodies to arrive as Buffer/ArrayBuffer,
|
|
52
|
+
// making err.message just "Request failed with status code N". Decode it here so
|
|
53
|
+
// the actual ElevenLabs reason (e.g. invalid voice, unsupported language_code) is visible.
|
|
54
|
+
if (err.response?.data) {
|
|
55
|
+
let detail = "";
|
|
56
|
+
try {
|
|
57
|
+
const bodyStr = Buffer.from(err.response.data).toString("utf8");
|
|
58
|
+
const parsed = JSON.parse(bodyStr);
|
|
59
|
+
detail = parsed?.detail?.message ?? parsed?.detail ?? bodyStr;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
detail = Buffer.from(err.response.data).toString("utf8");
|
|
63
|
+
}
|
|
64
|
+
throw new Error(`ElevenLabs TTS ${err.response.status}: ${detail} [voiceId=${voiceId}, languageCode=${languageCode ?? "none"}, textLen=${params.text?.length ?? 0}]`);
|
|
65
|
+
}
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
48
68
|
}
|
|
49
69
|
getVoices() {
|
|
50
70
|
return voices_1.ELEVENLABS_VOICES;
|