vidspotai-shared 1.0.55 → 1.0.57
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/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +35 -0
- package/lib/utils/errors.d.ts +24 -2
- package/lib/utils/errors.d.ts.map +1 -1
- package/lib/utils/errors.js +23 -3
- package/package.json +1 -1
- package/lib/globals/aiModels/providers/alibaba.d.ts +0 -4
- package/lib/globals/aiModels/providers/alibaba.d.ts.map +0 -1
- package/lib/globals/aiModels/providers/alibaba.js +0 -183
- package/lib/globals/aiModels/providers/elevenlabs.d.ts +0 -13
- package/lib/globals/aiModels/providers/elevenlabs.d.ts.map +0 -1
- package/lib/globals/aiModels/providers/elevenlabs.js +0 -25
- package/lib/globals/aiModels/providers/pixverseTemplates.d.ts +0 -36
- package/lib/globals/aiModels/providers/pixverseTemplates.d.ts.map +0 -1
- package/lib/globals/aiModels/providers/pixverseTemplates.js +0 -42
- package/lib/globals/aiModels/tierHelpers.d.ts +0 -27
- package/lib/globals/aiModels/tierHelpers.d.ts.map +0 -1
- package/lib/globals/aiModels/tierHelpers.js +0 -73
- package/lib/globals/ttsModels/providers/minimax.d.ts +0 -8
- package/lib/globals/ttsModels/providers/minimax.d.ts.map +0 -1
- package/lib/globals/ttsModels/providers/minimax.js +0 -18
- package/lib/globals/ttsModels/providers/openai.d.ts +0 -8
- package/lib/globals/ttsModels/providers/openai.d.ts.map +0 -1
- package/lib/globals/ttsModels/providers/openai.js +0 -18
- package/lib/models/agent.model.d.ts +0 -117
- package/lib/models/agent.model.d.ts.map +0 -1
- package/lib/models/agent.model.js +0 -13
- package/lib/models/cachedAsset.model.d.ts +0 -18
- package/lib/models/cachedAsset.model.d.ts.map +0 -1
- package/lib/models/cachedAsset.model.js +0 -2
- package/lib/models/cachedRawAsset.model.d.ts +0 -20
- package/lib/models/cachedRawAsset.model.d.ts.map +0 -1
- package/lib/models/cachedRawAsset.model.js +0 -2
- package/lib/schemas/agentPersona.schema.d.ts +0 -10
- package/lib/schemas/agentPersona.schema.d.ts.map +0 -1
- package/lib/schemas/agentPersona.schema.js +0 -11
- package/lib/schemas/brandKit.schema.d.ts +0 -101
- package/lib/schemas/brandKit.schema.d.ts.map +0 -1
- package/lib/schemas/brandKit.schema.js +0 -46
- package/lib/schemas/brief.schema.d.ts +0 -216
- package/lib/schemas/brief.schema.d.ts.map +0 -1
- package/lib/schemas/brief.schema.js +0 -118
- package/lib/schemas/index.d.ts +0 -6
- package/lib/schemas/index.d.ts.map +0 -1
- package/lib/schemas/index.js +0 -21
- package/lib/schemas/project.schema.d.ts +0 -1005
- package/lib/schemas/project.schema.d.ts.map +0 -1
- package/lib/schemas/project.schema.js +0 -238
- package/lib/schemas/videoPlan.schema.d.ts +0 -145
- package/lib/schemas/videoPlan.schema.d.ts.map +0 -1
- package/lib/schemas/videoPlan.schema.js +0 -109
- package/lib/services/agent/beatSnap.d.ts +0 -10
- package/lib/services/agent/beatSnap.d.ts.map +0 -1
- package/lib/services/agent/beatSnap.js +0 -128
- package/lib/services/agent/costPreflight.d.ts +0 -22
- package/lib/services/agent/costPreflight.d.ts.map +0 -1
- package/lib/services/agent/costPreflight.js +0 -75
- package/lib/services/agent/critic.d.ts +0 -103
- package/lib/services/agent/critic.d.ts.map +0 -1
- package/lib/services/agent/critic.js +0 -132
- package/lib/services/agent/eval/index.d.ts +0 -5
- package/lib/services/agent/eval/index.d.ts.map +0 -1
- package/lib/services/agent/eval/index.js +0 -20
- package/lib/services/agent/eval/judge.d.ts +0 -14
- package/lib/services/agent/eval/judge.d.ts.map +0 -1
- package/lib/services/agent/eval/judge.js +0 -95
- package/lib/services/agent/eval/recorder.d.ts +0 -17
- package/lib/services/agent/eval/recorder.d.ts.map +0 -1
- package/lib/services/agent/eval/recorder.js +0 -65
- package/lib/services/agent/eval/seedBriefs.d.ts +0 -16
- package/lib/services/agent/eval/seedBriefs.d.ts.map +0 -1
- package/lib/services/agent/eval/seedBriefs.js +0 -1188
- package/lib/services/agent/eval/types.d.ts +0 -196
- package/lib/services/agent/eval/types.d.ts.map +0 -1
- package/lib/services/agent/eval/types.js +0 -65
- package/lib/services/agent/executor.d.ts +0 -50
- package/lib/services/agent/executor.d.ts.map +0 -1
- package/lib/services/agent/executor.js +0 -188
- package/lib/services/agent/index.d.ts +0 -15
- package/lib/services/agent/index.d.ts.map +0 -1
- package/lib/services/agent/index.js +0 -30
- package/lib/services/agent/llmCaller.d.ts +0 -77
- package/lib/services/agent/llmCaller.d.ts.map +0 -1
- package/lib/services/agent/llmCaller.js +0 -16
- package/lib/services/agent/llmCallerGateway.d.ts +0 -39
- package/lib/services/agent/llmCallerGateway.d.ts.map +0 -1
- package/lib/services/agent/llmCallerGateway.js +0 -246
- package/lib/services/agent/llmCallerRegistry.d.ts +0 -4
- package/lib/services/agent/llmCallerRegistry.d.ts.map +0 -1
- package/lib/services/agent/llmCallerRegistry.js +0 -19
- package/lib/services/agent/modelRouter.d.ts +0 -41
- package/lib/services/agent/modelRouter.d.ts.map +0 -1
- package/lib/services/agent/modelRouter.js +0 -57
- package/lib/services/agent/musicSelect.d.ts +0 -23
- package/lib/services/agent/musicSelect.d.ts.map +0 -1
- package/lib/services/agent/musicSelect.js +0 -65
- package/lib/services/agent/personas.d.ts +0 -60
- package/lib/services/agent/personas.d.ts.map +0 -1
- package/lib/services/agent/personas.js +0 -156
- package/lib/services/agent/planner.d.ts +0 -56
- package/lib/services/agent/planner.d.ts.map +0 -1
- package/lib/services/agent/planner.js +0 -237
- package/lib/services/agent/toolRegistry.d.ts +0 -64
- package/lib/services/agent/toolRegistry.d.ts.map +0 -1
- package/lib/services/agent/toolRegistry.js +0 -78
- package/lib/services/agent/tools/analyzeReference.tool.d.ts +0 -36
- package/lib/services/agent/tools/analyzeReference.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/analyzeReference.tool.js +0 -44
- package/lib/services/agent/tools/animateImage.tool.d.ts +0 -23
- package/lib/services/agent/tools/animateImage.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/animateImage.tool.js +0 -58
- package/lib/services/agent/tools/animateImageWithMotionBrush.tool.d.ts +0 -30
- package/lib/services/agent/tools/animateImageWithMotionBrush.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/animateImageWithMotionBrush.tool.js +0 -90
- package/lib/services/agent/tools/composeScene.tool.d.ts +0 -948
- package/lib/services/agent/tools/composeScene.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/composeScene.tool.js +0 -90
- package/lib/services/agent/tools/estimateCost.tool.d.ts +0 -342
- package/lib/services/agent/tools/estimateCost.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/estimateCost.tool.js +0 -62
- package/lib/services/agent/tools/generateAvatarVideo.tool.d.ts +0 -32
- package/lib/services/agent/tools/generateAvatarVideo.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/generateAvatarVideo.tool.js +0 -112
- package/lib/services/agent/tools/generateImage.tool.d.ts +0 -28
- package/lib/services/agent/tools/generateImage.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/generateImage.tool.js +0 -97
- package/lib/services/agent/tools/generateVideo.tool.d.ts +0 -30
- package/lib/services/agent/tools/generateVideo.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/generateVideo.tool.js +0 -84
- package/lib/services/agent/tools/generateVoiceover.tool.d.ts +0 -18
- package/lib/services/agent/tools/generateVoiceover.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/generateVoiceover.tool.js +0 -72
- package/lib/services/agent/tools/index.d.ts +0 -19
- package/lib/services/agent/tools/index.d.ts.map +0 -1
- package/lib/services/agent/tools/index.js +0 -34
- package/lib/services/agent/tools/planVideo.tool.d.ts +0 -191
- package/lib/services/agent/tools/planVideo.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/planVideo.tool.js +0 -46
- package/lib/services/agent/tools/render.tool.d.ts +0 -357
- package/lib/services/agent/tools/render.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/render.tool.js +0 -48
- package/lib/services/agent/tools/searchMusic.tool.d.ts +0 -49
- package/lib/services/agent/tools/searchMusic.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/searchMusic.tool.js +0 -74
- package/lib/services/agent/tools/searchStock.tool.d.ts +0 -37
- package/lib/services/agent/tools/searchStock.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/searchStock.tool.js +0 -101
- package/lib/services/agent/tools/searchUserLibrary.tool.d.ts +0 -59
- package/lib/services/agent/tools/searchUserLibrary.tool.d.ts.map +0 -1
- package/lib/services/agent/tools/searchUserLibrary.tool.js +0 -58
- package/lib/services/aiGen/canonicalAdapters/cameraControl.types.d.ts +0 -31
- package/lib/services/aiGen/canonicalAdapters/cameraControl.types.d.ts.map +0 -1
- package/lib/services/aiGen/canonicalAdapters/cameraControl.types.js +0 -2
- package/lib/services/aiGen/canonicalAdapters/index.d.ts +0 -3
- package/lib/services/aiGen/canonicalAdapters/index.d.ts.map +0 -1
- package/lib/services/aiGen/canonicalAdapters/index.js +0 -18
- package/lib/services/aiGen/canonicalAdapters/multiShot.types.d.ts +0 -23
- package/lib/services/aiGen/canonicalAdapters/multiShot.types.d.ts.map +0 -1
- package/lib/services/aiGen/canonicalAdapters/multiShot.types.js +0 -12
- package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.d.ts +0 -18
- package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.d.ts.map +0 -1
- package/lib/services/aiGen/providers/elevenlabs/elevenlabs.service.js +0 -100
- package/lib/services/aiGen/providers/fal/falImage.service.d.ts +0 -9
- package/lib/services/aiGen/providers/fal/falImage.service.d.ts.map +0 -1
- package/lib/services/aiGen/providers/fal/falImage.service.js +0 -102
- package/lib/services/aiGen/providers/fal/index.d.ts +0 -2
- package/lib/services/aiGen/providers/fal/index.d.ts.map +0 -1
- package/lib/services/aiGen/providers/fal/index.js +0 -17
- package/lib/services/aiGen/providers/kling/cameraAdapter.d.ts +0 -4
- package/lib/services/aiGen/providers/kling/cameraAdapter.d.ts.map +0 -1
- package/lib/services/aiGen/providers/kling/cameraAdapter.js +0 -53
- package/lib/services/aiGen/providers/pexels/index.d.ts +0 -2
- package/lib/services/aiGen/providers/pexels/index.d.ts.map +0 -1
- package/lib/services/aiGen/providers/pexels/index.js +0 -17
- package/lib/services/aiGen/providers/pexels/pexels.service.d.ts +0 -11
- package/lib/services/aiGen/providers/pexels/pexels.service.d.ts.map +0 -1
- package/lib/services/aiGen/providers/pexels/pexels.service.js +0 -118
- package/lib/services/aiGen/providers/runway/cameraAdapter.d.ts +0 -3
- package/lib/services/aiGen/providers/runway/cameraAdapter.d.ts.map +0 -1
- package/lib/services/aiGen/providers/runway/cameraAdapter.js +0 -46
- package/lib/services/asr/assemblyai.service.d.ts +0 -72
- package/lib/services/asr/assemblyai.service.d.ts.map +0 -1
- package/lib/services/asr/assemblyai.service.js +0 -89
- package/lib/services/asr/index.d.ts +0 -2
- package/lib/services/asr/index.d.ts.map +0 -1
- package/lib/services/asr/index.js +0 -17
- package/lib/services/assetCache.service.d.ts +0 -54
- package/lib/services/assetCache.service.d.ts.map +0 -1
- package/lib/services/assetCache.service.js +0 -96
- package/lib/services/audioAnalysis/index.d.ts +0 -2
- package/lib/services/audioAnalysis/index.d.ts.map +0 -1
- package/lib/services/audioAnalysis/index.js +0 -17
- package/lib/services/audioAnalysis/onsetDetection.service.d.ts +0 -50
- package/lib/services/audioAnalysis/onsetDetection.service.d.ts.map +0 -1
- package/lib/services/audioAnalysis/onsetDetection.service.js +0 -136
- package/lib/services/editor/designToProject.d.ts +0 -60
- package/lib/services/editor/designToProject.d.ts.map +0 -1
- package/lib/services/editor/designToProject.js +0 -194
- package/lib/services/musicGen/index.d.ts +0 -6
- package/lib/services/musicGen/index.d.ts.map +0 -1
- package/lib/services/musicGen/index.js +0 -26
- package/lib/services/musicGen/musicSearchFactory.service.d.ts +0 -14
- package/lib/services/musicGen/musicSearchFactory.service.d.ts.map +0 -1
- package/lib/services/musicGen/musicSearchFactory.service.js +0 -59
- package/lib/services/musicGen/providers/curated.service.d.ts +0 -22
- package/lib/services/musicGen/providers/curated.service.d.ts.map +0 -1
- package/lib/services/musicGen/providers/curated.service.js +0 -171
- package/lib/services/musicGen/providers/jamendo.service.d.ts +0 -8
- package/lib/services/musicGen/providers/jamendo.service.d.ts.map +0 -1
- package/lib/services/musicGen/providers/jamendo.service.js +0 -93
- package/lib/services/musicGen/providers/mubert.service.d.ts +0 -9
- package/lib/services/musicGen/providers/mubert.service.d.ts.map +0 -1
- package/lib/services/musicGen/providers/mubert.service.js +0 -113
- package/lib/services/musicGen/types.d.ts +0 -42
- package/lib/services/musicGen/types.d.ts.map +0 -1
- package/lib/services/musicGen/types.js +0 -10
- package/lib/services/tts/providers/minimax.service.d.ts +0 -14
- package/lib/services/tts/providers/minimax.service.d.ts.map +0 -1
- package/lib/services/tts/providers/minimax.service.js +0 -78
- package/lib/services/tts/providers/openai.service.d.ts +0 -14
- package/lib/services/tts/providers/openai.service.d.ts.map +0 -1
- package/lib/services/tts/providers/openai.service.js +0 -71
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAcA,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":"google.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/google/google.service.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA2FlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,EAAE,CAAc;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAK;;IAO/C;;;;OAIG;YACW,kBAAkB;IA+B1B,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAqE3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuFjD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,UAAmB,EAAE,SAAiB,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAiB7G"}
|
|
@@ -71,6 +71,35 @@ function isTransientFetchError(err) {
|
|
|
71
71
|
const code = err.code ?? err.cause?.code;
|
|
72
72
|
return !!code && TRANSIENT_NETWORK_CODES.has(code);
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Maps `@google/genai` `ApiError` failures (whose message is a JSON string)
|
|
76
|
+
* to a `UserFacingError` with a stable code the frontend can translate.
|
|
77
|
+
* Returns null when the error is not a known user-facing case (re-throw as-is).
|
|
78
|
+
*/
|
|
79
|
+
function classifyGoogleApiError(err) {
|
|
80
|
+
const raw = err?.message ?? "";
|
|
81
|
+
try {
|
|
82
|
+
const parsed = JSON.parse(raw);
|
|
83
|
+
const inner = parsed.error ?? parsed;
|
|
84
|
+
const httpCode = inner.code;
|
|
85
|
+
const status = inner.status;
|
|
86
|
+
const msg = inner.message ?? raw;
|
|
87
|
+
if (status === "RESOURCE_EXHAUSTED" || httpCode === 429) {
|
|
88
|
+
return new errors_1.UserFacingError(msg, errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_RATE_LIMITED);
|
|
89
|
+
}
|
|
90
|
+
// gRPC code 14 = UNAVAILABLE; Veo surfaces "high demand" failures with this.
|
|
91
|
+
if (httpCode === 14 || /high demand/i.test(msg)) {
|
|
92
|
+
return new errors_1.UserFacingError(msg, errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_HIGH_DEMAND);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Not JSON — fall through to non-JSON checks.
|
|
97
|
+
}
|
|
98
|
+
if (/timeout/i.test(raw) || err?.code === "ECONNABORTED") {
|
|
99
|
+
return new errors_1.UserFacingError(raw, errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_TIMEOUT);
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
74
103
|
class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
75
104
|
constructor() {
|
|
76
105
|
super();
|
|
@@ -91,6 +120,12 @@ class GoogleService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
91
120
|
lastErr = err;
|
|
92
121
|
const transient = isTransientFetchError(err);
|
|
93
122
|
if (!transient || attempt === GoogleService.MAX_RETRY_ATTEMPTS) {
|
|
123
|
+
// Convert known provider errors (quota, high-demand, timeout) into a
|
|
124
|
+
// typed UserFacingError so the scene processor stores a translatable
|
|
125
|
+
// code instead of the raw provider JSON.
|
|
126
|
+
const userFacing = classifyGoogleApiError(err);
|
|
127
|
+
if (userFacing)
|
|
128
|
+
throw userFacing;
|
|
94
129
|
throw err;
|
|
95
130
|
}
|
|
96
131
|
const backoffMs = 1000 * 2 ** (attempt - 1); // 1s, 2s, 4s
|
package/lib/utils/errors.d.ts
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thrown when an error
|
|
2
|
+
* Thrown when an error should be shown to the user rather than retried/escalated.
|
|
3
3
|
* These are logged as `warn` (Loki only) instead of `error` (Slack) to reduce noise.
|
|
4
|
+
*
|
|
5
|
+
* When `code` is set, downstream layers serialize the error as JSON `{code, message}`
|
|
6
|
+
* so the frontend can map it to a translated string. Without a code, the raw message
|
|
7
|
+
* is shown as-is.
|
|
4
8
|
*/
|
|
5
9
|
export declare class UserFacingError extends Error {
|
|
6
10
|
readonly isUserFacingError = true;
|
|
7
|
-
|
|
11
|
+
readonly code?: string;
|
|
12
|
+
constructor(message: string, code?: string);
|
|
13
|
+
/** Serialize for storage in `scene.errorMessage` / API responses. */
|
|
14
|
+
toJSON(): {
|
|
15
|
+
code?: string;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
8
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Stable error codes that the frontend translates via the `Toasts` namespace.
|
|
21
|
+
* Keep in sync with locales/en.json keys.
|
|
22
|
+
*/
|
|
23
|
+
export declare const USER_FACING_ERROR_CODES: {
|
|
24
|
+
readonly VIDEO_PROVIDER_RATE_LIMITED: "VIDEO_PROVIDER_RATE_LIMITED";
|
|
25
|
+
readonly VIDEO_PROVIDER_HIGH_DEMAND: "VIDEO_PROVIDER_HIGH_DEMAND";
|
|
26
|
+
readonly VIDEO_PROVIDER_TIMEOUT: "VIDEO_PROVIDER_TIMEOUT";
|
|
27
|
+
readonly TTS_PROVIDER_TIMEOUT: "TTS_PROVIDER_TIMEOUT";
|
|
28
|
+
readonly TTS_PROVIDER_UNAVAILABLE: "TTS_PROVIDER_UNAVAILABLE";
|
|
29
|
+
};
|
|
30
|
+
export type UserFacingErrorCode = keyof typeof USER_FACING_ERROR_CODES;
|
|
9
31
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA
|
|
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;;;;;;CAM1B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
|
package/lib/utils/errors.js
CHANGED
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserFacingError = void 0;
|
|
3
|
+
exports.USER_FACING_ERROR_CODES = exports.UserFacingError = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* Thrown when an error
|
|
5
|
+
* Thrown when an error should be shown to the user rather than retried/escalated.
|
|
6
6
|
* These are logged as `warn` (Loki only) instead of `error` (Slack) to reduce noise.
|
|
7
|
+
*
|
|
8
|
+
* When `code` is set, downstream layers serialize the error as JSON `{code, message}`
|
|
9
|
+
* so the frontend can map it to a translated string. Without a code, the raw message
|
|
10
|
+
* is shown as-is.
|
|
7
11
|
*/
|
|
8
12
|
class UserFacingError extends Error {
|
|
9
|
-
constructor(message) {
|
|
13
|
+
constructor(message, code) {
|
|
10
14
|
super(message);
|
|
11
15
|
this.isUserFacingError = true;
|
|
12
16
|
this.name = "UserFacingError";
|
|
17
|
+
this.code = code;
|
|
18
|
+
}
|
|
19
|
+
/** Serialize for storage in `scene.errorMessage` / API responses. */
|
|
20
|
+
toJSON() {
|
|
21
|
+
return this.code ? { code: this.code, message: this.message } : { message: this.message };
|
|
13
22
|
}
|
|
14
23
|
}
|
|
15
24
|
exports.UserFacingError = UserFacingError;
|
|
25
|
+
/**
|
|
26
|
+
* Stable error codes that the frontend translates via the `Toasts` namespace.
|
|
27
|
+
* Keep in sync with locales/en.json keys.
|
|
28
|
+
*/
|
|
29
|
+
exports.USER_FACING_ERROR_CODES = {
|
|
30
|
+
VIDEO_PROVIDER_RATE_LIMITED: "VIDEO_PROVIDER_RATE_LIMITED",
|
|
31
|
+
VIDEO_PROVIDER_HIGH_DEMAND: "VIDEO_PROVIDER_HIGH_DEMAND",
|
|
32
|
+
VIDEO_PROVIDER_TIMEOUT: "VIDEO_PROVIDER_TIMEOUT",
|
|
33
|
+
TTS_PROVIDER_TIMEOUT: "TTS_PROVIDER_TIMEOUT",
|
|
34
|
+
TTS_PROVIDER_UNAVAILABLE: "TTS_PROVIDER_UNAVAILABLE",
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alibaba.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/alibaba.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAaxC,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAiLrE,CAAC"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.alibabaConfigs = void 0;
|
|
4
|
-
const wanCommonFields = {
|
|
5
|
-
prompt: { required: true },
|
|
6
|
-
aspectRatio: { allowedValues: ["16:9", "9:16", "1:1", "4:3", "3:4"] },
|
|
7
|
-
resolution: { allowedValues: ["480p", "720p", "1080p"] },
|
|
8
|
-
duration: { allowedValues: [5, 10] },
|
|
9
|
-
negative_prompt: {},
|
|
10
|
-
seed: {},
|
|
11
|
-
watermark: {},
|
|
12
|
-
promptOptimizer: {},
|
|
13
|
-
};
|
|
14
|
-
exports.alibabaConfigs = {
|
|
15
|
-
// --- Wan 2.7 i2v --- (image2video; supports first-last-frame interpolation)
|
|
16
|
-
"alibaba-wan-2.7-i2v": {
|
|
17
|
-
modelId: "wan2.7-i2v-plus",
|
|
18
|
-
type: ["image-to-video"],
|
|
19
|
-
tier: "T3",
|
|
20
|
-
fields: {
|
|
21
|
-
...wanCommonFields,
|
|
22
|
-
inputImageUrl: { required: true },
|
|
23
|
-
lastFrameImageUrl: {}, // FLF interpolation
|
|
24
|
-
},
|
|
25
|
-
cost: {
|
|
26
|
-
table: {
|
|
27
|
-
"832x480": { 5: 0.10, 10: 0.20 },
|
|
28
|
-
"1280x720": { 5: 0.20, 10: 0.40 },
|
|
29
|
-
"1920x1080": { 5: 0.40, 10: 0.80 },
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
// --- Wan 2.6 t2v ---
|
|
34
|
-
"alibaba-wan-2.6-t2v": {
|
|
35
|
-
modelId: "wan2.6-t2v-plus",
|
|
36
|
-
type: ["text-to-video"],
|
|
37
|
-
tier: "T3",
|
|
38
|
-
fields: { ...wanCommonFields },
|
|
39
|
-
cost: {
|
|
40
|
-
table: {
|
|
41
|
-
"832x480": { 5: 0.08, 10: 0.16 },
|
|
42
|
-
"1280x720": { 5: 0.18, 10: 0.36 },
|
|
43
|
-
"1920x1080": { 5: 0.36, 10: 0.72 },
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
// --- Wan 2.5 t2v ---
|
|
48
|
-
"alibaba-wan-2.5-t2v": {
|
|
49
|
-
modelId: "wan2.5-t2v-plus",
|
|
50
|
-
type: ["text-to-video"],
|
|
51
|
-
tier: "T2",
|
|
52
|
-
fields: { ...wanCommonFields },
|
|
53
|
-
cost: {
|
|
54
|
-
table: {
|
|
55
|
-
"832x480": { 5: 0.06, 10: 0.12 },
|
|
56
|
-
"1280x720": { 5: 0.14, 10: 0.28 },
|
|
57
|
-
"1920x1080": { 5: 0.28, 10: 0.56 },
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
// --- Wan 2.2 t2v ---
|
|
62
|
-
"alibaba-wan-2.2-t2v": {
|
|
63
|
-
modelId: "wan2.2-t2v-plus",
|
|
64
|
-
type: ["text-to-video"],
|
|
65
|
-
tier: "T2",
|
|
66
|
-
fields: { ...wanCommonFields },
|
|
67
|
-
cost: {
|
|
68
|
-
table: {
|
|
69
|
-
"832x480": { 5: 0.05, 10: 0.10 },
|
|
70
|
-
"1280x720": { 5: 0.10, 10: 0.20 },
|
|
71
|
-
"1920x1080": { 5: 0.20, 10: 0.40 },
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
// --- Wan 2.2 s2v --- (sound2video; audio drives motion, optional image for visual reference)
|
|
76
|
-
"alibaba-wan-2.2-s2v": {
|
|
77
|
-
modelId: "wan2.2-s2v",
|
|
78
|
-
type: ["audio-to-video"],
|
|
79
|
-
tier: "T2",
|
|
80
|
-
fields: {
|
|
81
|
-
prompt: {},
|
|
82
|
-
inputAudioUrl: { required: true },
|
|
83
|
-
inputImageUrl: {}, // optional visual reference
|
|
84
|
-
duration: { allowedValues: [5, 10] },
|
|
85
|
-
seed: {},
|
|
86
|
-
watermark: {},
|
|
87
|
-
},
|
|
88
|
-
cost: {
|
|
89
|
-
table: {
|
|
90
|
-
// Pricing varies less by size for s2v; use a flat-ish table keyed on duration.
|
|
91
|
-
"auto": { 5: 0.18, 10: 0.36 },
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
// ───────────────────────────────────────────────────────────────────────
|
|
96
|
-
// Image-gen — Qwen-Image + Kolors (both via DashScope text2image / image2image)
|
|
97
|
-
// ───────────────────────────────────────────────────────────────────────
|
|
98
|
-
"alibaba-qwen-image-2.0-pro": {
|
|
99
|
-
modelId: "qwen-image-2.0-pro",
|
|
100
|
-
type: ["text-to-image"],
|
|
101
|
-
tier: "T2",
|
|
102
|
-
fields: {
|
|
103
|
-
prompt: { required: true },
|
|
104
|
-
aspectRatio: { allowedValues: ["1:1", "9:16", "16:9", "3:4", "4:3", "2:3", "3:2"] },
|
|
105
|
-
numImages: { default: 1 },
|
|
106
|
-
seed: {},
|
|
107
|
-
watermark: {},
|
|
108
|
-
promptOptimizer: {},
|
|
109
|
-
negativePrompt: {},
|
|
110
|
-
},
|
|
111
|
-
cost: { fixed: 0.04 },
|
|
112
|
-
},
|
|
113
|
-
"alibaba-qwen-image-2.0": {
|
|
114
|
-
modelId: "qwen-image-2.0",
|
|
115
|
-
type: ["text-to-image"],
|
|
116
|
-
tier: "T1",
|
|
117
|
-
fields: {
|
|
118
|
-
prompt: { required: true },
|
|
119
|
-
aspectRatio: { allowedValues: ["1:1", "9:16", "16:9", "3:4", "4:3", "2:3", "3:2"] },
|
|
120
|
-
numImages: { default: 1 },
|
|
121
|
-
seed: {},
|
|
122
|
-
watermark: {},
|
|
123
|
-
promptOptimizer: {},
|
|
124
|
-
negativePrompt: {},
|
|
125
|
-
},
|
|
126
|
-
cost: { fixed: 0.02 },
|
|
127
|
-
},
|
|
128
|
-
// Qwen-Image edit — instruction edit (1–3 reference images)
|
|
129
|
-
"alibaba-qwen-image-edit-max": {
|
|
130
|
-
modelId: "qwen-image-edit-max",
|
|
131
|
-
type: ["image-to-image"],
|
|
132
|
-
tier: "T2",
|
|
133
|
-
fields: {
|
|
134
|
-
prompt: { required: true },
|
|
135
|
-
inputImageUrls: { required: true },
|
|
136
|
-
seed: {},
|
|
137
|
-
watermark: {},
|
|
138
|
-
promptOptimizer: {},
|
|
139
|
-
},
|
|
140
|
-
cost: { fixed: 0.05 },
|
|
141
|
-
},
|
|
142
|
-
"alibaba-qwen-image-edit-plus": {
|
|
143
|
-
modelId: "qwen-image-edit-plus",
|
|
144
|
-
type: ["image-to-image"],
|
|
145
|
-
tier: "T2",
|
|
146
|
-
fields: {
|
|
147
|
-
prompt: { required: true },
|
|
148
|
-
inputImageUrls: { required: true },
|
|
149
|
-
seed: {},
|
|
150
|
-
watermark: {},
|
|
151
|
-
promptOptimizer: {},
|
|
152
|
-
},
|
|
153
|
-
cost: { fixed: 0.04 },
|
|
154
|
-
},
|
|
155
|
-
"alibaba-qwen-image-edit": {
|
|
156
|
-
modelId: "qwen-image-edit",
|
|
157
|
-
type: ["image-to-image"],
|
|
158
|
-
tier: "T1",
|
|
159
|
-
fields: {
|
|
160
|
-
prompt: { required: true },
|
|
161
|
-
inputImageUrls: { required: true },
|
|
162
|
-
seed: {},
|
|
163
|
-
watermark: {},
|
|
164
|
-
promptOptimizer: {},
|
|
165
|
-
},
|
|
166
|
-
cost: { fixed: 0.03 },
|
|
167
|
-
},
|
|
168
|
-
// Kolors (Kling) — hosted on DashScope; routed to AlibabaService in factory.
|
|
169
|
-
"kling-kolors": {
|
|
170
|
-
modelId: "kolors-v2",
|
|
171
|
-
type: ["text-to-image"],
|
|
172
|
-
tier: "T1",
|
|
173
|
-
fields: {
|
|
174
|
-
prompt: { required: true },
|
|
175
|
-
aspectRatio: { allowedValues: ["1:1", "9:16", "16:9", "3:4", "4:3"] },
|
|
176
|
-
numImages: { default: 1 },
|
|
177
|
-
seed: {},
|
|
178
|
-
watermark: {},
|
|
179
|
-
negativePrompt: {},
|
|
180
|
-
},
|
|
181
|
-
cost: { fixed: 0.03 },
|
|
182
|
-
},
|
|
183
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IModelSchema } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* ElevenLabs sound-effects model configs. Sync — POST /v1/sound-generation
|
|
4
|
-
* returns mp3 binary inline.
|
|
5
|
-
*
|
|
6
|
-
* Pricing: ElevenLabs charges ~40 character-credits per second of generated
|
|
7
|
-
* audio on Creator/Pro tiers (~$0.0036/sec ≈ $0.08 for the 22s max clip).
|
|
8
|
-
* Cost block exposes both `perSecond` (preferred when caller knows duration)
|
|
9
|
-
* and `fixed` (worst-case ceiling, used when duration is absent).
|
|
10
|
-
* Verified 2026-05-11 against ElevenLabs Creator-tier credit conversion.
|
|
11
|
-
*/
|
|
12
|
-
export declare const elevenlabsConfigs: Record<string, IModelSchema>;
|
|
13
|
-
//# sourceMappingURL=elevenlabs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elevenlabs.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/elevenlabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAW1D,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.elevenlabsConfigs = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* ElevenLabs sound-effects model configs. Sync — POST /v1/sound-generation
|
|
6
|
-
* returns mp3 binary inline.
|
|
7
|
-
*
|
|
8
|
-
* Pricing: ElevenLabs charges ~40 character-credits per second of generated
|
|
9
|
-
* audio on Creator/Pro tiers (~$0.0036/sec ≈ $0.08 for the 22s max clip).
|
|
10
|
-
* Cost block exposes both `perSecond` (preferred when caller knows duration)
|
|
11
|
-
* and `fixed` (worst-case ceiling, used when duration is absent).
|
|
12
|
-
* Verified 2026-05-11 against ElevenLabs Creator-tier credit conversion.
|
|
13
|
-
*/
|
|
14
|
-
exports.elevenlabsConfigs = {
|
|
15
|
-
"elevenlabs-sound-effects": {
|
|
16
|
-
modelId: "eleven_text_to_sound_v2",
|
|
17
|
-
type: ["sound-effects"],
|
|
18
|
-
tier: "T1",
|
|
19
|
-
fields: {
|
|
20
|
-
prompt: { required: true },
|
|
21
|
-
// ElevenLabs SFX duration range: 0.5–22 seconds
|
|
22
|
-
},
|
|
23
|
-
cost: { perSecond: 0.0036, fixed: 0.08 },
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pixverse Effects / Template registry.
|
|
3
|
-
*
|
|
4
|
-
* Pixverse exposes a curated library of "Effects" templates (Hug, Kiss, Squish,
|
|
5
|
-
* AI Baby Podcast, etc.) accessible via POST /openapi/v2/video/template/generate
|
|
6
|
-
* with a numeric `template_id` plus a `customer_img_url`. Most templates are
|
|
7
|
-
* image-to-video — the user supplies a face/photo and the template animates it.
|
|
8
|
-
*
|
|
9
|
-
* Real IDs must be pulled from the Pixverse dashboard / template library API
|
|
10
|
-
* (each template's ID is the numeric `template_id` shown in the docs UI).
|
|
11
|
-
* The few entries below are placeholders documenting the shape — populate
|
|
12
|
-
* with real IDs before exposing in the frontend.
|
|
13
|
-
*/
|
|
14
|
-
export interface IPixverseEffectTemplate {
|
|
15
|
-
/** Numeric Pixverse template_id (sent to /template/generate). */
|
|
16
|
-
templateId: number;
|
|
17
|
-
/** Slug used in the API surface (kebab-case, stable). */
|
|
18
|
-
slug: string;
|
|
19
|
-
/** Display label shown to users. */
|
|
20
|
-
name: string;
|
|
21
|
-
/** Coarse grouping for the picker UI. */
|
|
22
|
-
category: "couple" | "transform" | "stylize" | "podcast" | "selfie" | "anime" | "other";
|
|
23
|
-
/** Whether the template requires a user-supplied image (almost always true). */
|
|
24
|
-
requiresImage: boolean;
|
|
25
|
-
/** Optional default Pixverse model to pair with this template. */
|
|
26
|
-
preferredModelId?: "v5" | "v5.5" | "v5.6";
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Curated list — POPULATE WITH REAL PIXVERSE TEMPLATE IDs from the dashboard.
|
|
30
|
-
* Slugs are stable; templateIds are placeholder zeros until filled in.
|
|
31
|
-
*/
|
|
32
|
-
export declare const PIXVERSE_EFFECT_TEMPLATES: IPixverseEffectTemplate[];
|
|
33
|
-
export declare const PIXVERSE_TEMPLATES_BY_SLUG: Record<string, IPixverseEffectTemplate>;
|
|
34
|
-
export declare function getPixverseTemplateBySlug(slug: string): IPixverseEffectTemplate | undefined;
|
|
35
|
-
export declare function listPixverseTemplates(category?: IPixverseEffectTemplate["category"]): IPixverseEffectTemplate[];
|
|
36
|
-
//# sourceMappingURL=pixverseTemplates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pixverseTemplates.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/pixverseTemplates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,uBAAuB;IACtC,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,QAAQ,EACJ,QAAQ,GACR,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,OAAO,CAAC;IACZ,gFAAgF;IAChF,aAAa,EAAE,OAAO,CAAC;IACvB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CAC3C;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,uBAAuB,EAY9D,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CACR,CAAC;AAExE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAE3F;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAAG,uBAAuB,EAAE,CAG/G"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Pixverse Effects / Template registry.
|
|
4
|
-
*
|
|
5
|
-
* Pixverse exposes a curated library of "Effects" templates (Hug, Kiss, Squish,
|
|
6
|
-
* AI Baby Podcast, etc.) accessible via POST /openapi/v2/video/template/generate
|
|
7
|
-
* with a numeric `template_id` plus a `customer_img_url`. Most templates are
|
|
8
|
-
* image-to-video — the user supplies a face/photo and the template animates it.
|
|
9
|
-
*
|
|
10
|
-
* Real IDs must be pulled from the Pixverse dashboard / template library API
|
|
11
|
-
* (each template's ID is the numeric `template_id` shown in the docs UI).
|
|
12
|
-
* The few entries below are placeholders documenting the shape — populate
|
|
13
|
-
* with real IDs before exposing in the frontend.
|
|
14
|
-
*/
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.PIXVERSE_TEMPLATES_BY_SLUG = exports.PIXVERSE_EFFECT_TEMPLATES = void 0;
|
|
17
|
-
exports.getPixverseTemplateBySlug = getPixverseTemplateBySlug;
|
|
18
|
-
exports.listPixverseTemplates = listPixverseTemplates;
|
|
19
|
-
/**
|
|
20
|
-
* Curated list — POPULATE WITH REAL PIXVERSE TEMPLATE IDs from the dashboard.
|
|
21
|
-
* Slugs are stable; templateIds are placeholder zeros until filled in.
|
|
22
|
-
*/
|
|
23
|
-
exports.PIXVERSE_EFFECT_TEMPLATES = [
|
|
24
|
-
// --- Couple / interaction effects ---
|
|
25
|
-
{ templateId: 0, slug: "hug", name: "Hug", category: "couple", requiresImage: true, preferredModelId: "v5.6" },
|
|
26
|
-
{ templateId: 0, slug: "kiss", name: "Kiss", category: "couple", requiresImage: true, preferredModelId: "v5.6" },
|
|
27
|
-
{ templateId: 0, slug: "squish", name: "Squish", category: "transform", requiresImage: true, preferredModelId: "v5.6" },
|
|
28
|
-
// --- Podcast / narration effects ---
|
|
29
|
-
{ templateId: 0, slug: "ai-baby-podcast", name: "AI Baby Podcast", category: "podcast", requiresImage: true, preferredModelId: "v5.6" },
|
|
30
|
-
// --- Stylize / transform ---
|
|
31
|
-
{ templateId: 0, slug: "anime-me", name: "Anime Me", category: "anime", requiresImage: true, preferredModelId: "v5.5" },
|
|
32
|
-
{ templateId: 0, slug: "muscle", name: "Muscle Up", category: "transform", requiresImage: true, preferredModelId: "v5.6" },
|
|
33
|
-
];
|
|
34
|
-
exports.PIXVERSE_TEMPLATES_BY_SLUG = Object.fromEntries(exports.PIXVERSE_EFFECT_TEMPLATES.map((t) => [t.slug, t]));
|
|
35
|
-
function getPixverseTemplateBySlug(slug) {
|
|
36
|
-
return exports.PIXVERSE_TEMPLATES_BY_SLUG[slug];
|
|
37
|
-
}
|
|
38
|
-
function listPixverseTemplates(category) {
|
|
39
|
-
if (!category)
|
|
40
|
-
return exports.PIXVERSE_EFFECT_TEMPLATES;
|
|
41
|
-
return exports.PIXVERSE_EFFECT_TEMPLATES.filter((t) => t.category === category);
|
|
42
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Tier } from "../../schemas/project.schema";
|
|
2
|
-
import type { GenerationType, IModelSchema } from "./types";
|
|
3
|
-
/**
|
|
4
|
-
* Helpers for the agent planner to query models by tier and capability.
|
|
5
|
-
* Designed to be cheap and side-effect free — safe to call inside hot planner loops.
|
|
6
|
-
*/
|
|
7
|
-
export interface ModelMatch {
|
|
8
|
-
modelKey: string;
|
|
9
|
-
config: IModelSchema;
|
|
10
|
-
}
|
|
11
|
-
/** Return every model whose tier matches. Optionally filter by GenerationType. */
|
|
12
|
-
export declare function getModelsByTier(tier: Tier, type?: GenerationType): ModelMatch[];
|
|
13
|
-
/** Return the cheapest model satisfying (tier, type). Uses cost.fixed → cost.perSecond → 0. */
|
|
14
|
-
export declare function getCheapestModel(tier: Tier, type: GenerationType): ModelMatch | undefined;
|
|
15
|
-
/** Return all models supporting a generation type, regardless of tier. */
|
|
16
|
-
export declare function getModelsByType(type: GenerationType): ModelMatch[];
|
|
17
|
-
/**
|
|
18
|
-
* Build a compact, planner-readable summary of the model catalog grouped by
|
|
19
|
-
* tier. Injected into the planner system prompt so the LLM can pick a concrete
|
|
20
|
-
* `preferredModel` per scene with cost/quality awareness — e.g. cheap Kling
|
|
21
|
-
* for b-roll, premium Veo for hero shots.
|
|
22
|
-
*
|
|
23
|
-
* Token budget matters here: ~10–20 lines, no JSON, sorted cheapest-first per
|
|
24
|
-
* tier so the planner's default tendency aligns with cost minimization.
|
|
25
|
-
*/
|
|
26
|
-
export declare function summarizeModelsForPlanner(type?: GenerationType): string;
|
|
27
|
-
//# sourceMappingURL=tierHelpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tierHelpers.d.ts","sourceRoot":"","sources":["../../../src/globals/aiModels/tierHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5D;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,UAAU,EAAE,CAQ/E;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,cAAc,GACnB,UAAU,GAAG,SAAS,CAIxB;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,EAAE,CAMlE;AAQD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,GAAE,cAAgC,GACrC,MAAM,CAaR"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getModelsByTier = getModelsByTier;
|
|
4
|
-
exports.getCheapestModel = getCheapestModel;
|
|
5
|
-
exports.getModelsByType = getModelsByType;
|
|
6
|
-
exports.summarizeModelsForPlanner = summarizeModelsForPlanner;
|
|
7
|
-
const index_1 = require("./index");
|
|
8
|
-
/** Return every model whose tier matches. Optionally filter by GenerationType. */
|
|
9
|
-
function getModelsByTier(tier, type) {
|
|
10
|
-
const matches = [];
|
|
11
|
-
for (const [modelKey, config] of Object.entries(index_1.aiModelConfigs)) {
|
|
12
|
-
if (config.tier !== tier)
|
|
13
|
-
continue;
|
|
14
|
-
if (type && !config.type.includes(type))
|
|
15
|
-
continue;
|
|
16
|
-
matches.push({ modelKey, config });
|
|
17
|
-
}
|
|
18
|
-
return matches;
|
|
19
|
-
}
|
|
20
|
-
/** Return the cheapest model satisfying (tier, type). Uses cost.fixed → cost.perSecond → 0. */
|
|
21
|
-
function getCheapestModel(tier, type) {
|
|
22
|
-
const candidates = getModelsByTier(tier, type);
|
|
23
|
-
if (candidates.length === 0)
|
|
24
|
-
return undefined;
|
|
25
|
-
return candidates.sort((a, b) => costScore(a.config) - costScore(b.config))[0];
|
|
26
|
-
}
|
|
27
|
-
/** Return all models supporting a generation type, regardless of tier. */
|
|
28
|
-
function getModelsByType(type) {
|
|
29
|
-
const matches = [];
|
|
30
|
-
for (const [modelKey, config] of Object.entries(index_1.aiModelConfigs)) {
|
|
31
|
-
if (config.type.includes(type))
|
|
32
|
-
matches.push({ modelKey, config });
|
|
33
|
-
}
|
|
34
|
-
return matches;
|
|
35
|
-
}
|
|
36
|
-
function costScore(c) {
|
|
37
|
-
if (c.cost?.fixed != null)
|
|
38
|
-
return c.cost.fixed;
|
|
39
|
-
if (c.cost?.perSecond != null)
|
|
40
|
-
return c.cost.perSecond;
|
|
41
|
-
return Number.POSITIVE_INFINITY;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Build a compact, planner-readable summary of the model catalog grouped by
|
|
45
|
-
* tier. Injected into the planner system prompt so the LLM can pick a concrete
|
|
46
|
-
* `preferredModel` per scene with cost/quality awareness — e.g. cheap Kling
|
|
47
|
-
* for b-roll, premium Veo for hero shots.
|
|
48
|
-
*
|
|
49
|
-
* Token budget matters here: ~10–20 lines, no JSON, sorted cheapest-first per
|
|
50
|
-
* tier so the planner's default tendency aligns with cost minimization.
|
|
51
|
-
*/
|
|
52
|
-
function summarizeModelsForPlanner(type = "text-to-video") {
|
|
53
|
-
const lines = [];
|
|
54
|
-
for (const tier of ["T0", "T1", "T2", "T3"]) {
|
|
55
|
-
const matches = getModelsByTier(tier, type);
|
|
56
|
-
if (matches.length === 0)
|
|
57
|
-
continue;
|
|
58
|
-
matches.sort((a, b) => costScore(a.config) - costScore(b.config));
|
|
59
|
-
lines.push(` ${tier}:`);
|
|
60
|
-
for (const m of matches) {
|
|
61
|
-
const cost = formatCost(m.config);
|
|
62
|
-
lines.push(` - ${m.modelKey}${cost ? ` (${cost})` : ""}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return lines.length ? lines.join("\n") : "";
|
|
66
|
-
}
|
|
67
|
-
function formatCost(c) {
|
|
68
|
-
if (c.cost?.fixed != null)
|
|
69
|
-
return `$${c.cost.fixed.toFixed(2)} fixed`;
|
|
70
|
-
if (c.cost?.perSecond != null)
|
|
71
|
-
return `$${c.cost.perSecond.toFixed(2)}/s`;
|
|
72
|
-
return "";
|
|
73
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ITtsProviderConfig } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* MiniMax Speech-02-HD — high-fidelity multilingual TTS.
|
|
4
|
-
* API: POST https://api.minimax.io/v1/t2a_v2 returns hex-encoded audio inline.
|
|
5
|
-
* Pricing: roughly $0.10 per 1K chars (T2A HD tier).
|
|
6
|
-
*/
|
|
7
|
-
export declare const minimaxTtsConfig: ITtsProviderConfig;
|
|
8
|
-
//# sourceMappingURL=minimax.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"minimax.d.ts","sourceRoot":"","sources":["../../../../src/globals/ttsModels/providers/minimax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBAS9B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.minimaxTtsConfig = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* MiniMax Speech-02-HD — high-fidelity multilingual TTS.
|
|
6
|
-
* API: POST https://api.minimax.io/v1/t2a_v2 returns hex-encoded audio inline.
|
|
7
|
-
* Pricing: roughly $0.10 per 1K chars (T2A HD tier).
|
|
8
|
-
*/
|
|
9
|
-
exports.minimaxTtsConfig = {
|
|
10
|
-
name: "MiniMax Speech-02 HD",
|
|
11
|
-
costPer1KChars: 0.1,
|
|
12
|
-
defaultVoiceId: "male-qn-qingse",
|
|
13
|
-
modelId: "speech-02-hd",
|
|
14
|
-
wordsPerSecond: 2.5,
|
|
15
|
-
maxCharsPerRequest: 5000,
|
|
16
|
-
durationSafetyBufferSeconds: 100,
|
|
17
|
-
concurrentRequests: 5,
|
|
18
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ITtsProviderConfig } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* OpenAI gpt-4o-mini-tts — cheap, fast TTS with optional `instructions` styling.
|
|
4
|
-
* API: POST https://api.openai.com/v1/audio/speech returns mp3 binary directly.
|
|
5
|
-
* Pricing: ~$0.015/1K chars (gpt-4o-mini-tts).
|
|
6
|
-
*/
|
|
7
|
-
export declare const openaiTtsConfig: ITtsProviderConfig;
|
|
8
|
-
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../../src/globals/ttsModels/providers/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,kBAS7B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.openaiTtsConfig = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* OpenAI gpt-4o-mini-tts — cheap, fast TTS with optional `instructions` styling.
|
|
6
|
-
* API: POST https://api.openai.com/v1/audio/speech returns mp3 binary directly.
|
|
7
|
-
* Pricing: ~$0.015/1K chars (gpt-4o-mini-tts).
|
|
8
|
-
*/
|
|
9
|
-
exports.openaiTtsConfig = {
|
|
10
|
-
name: "OpenAI gpt-4o-mini-tts",
|
|
11
|
-
costPer1KChars: 0.015,
|
|
12
|
-
defaultVoiceId: "alloy",
|
|
13
|
-
modelId: "gpt-4o-mini-tts",
|
|
14
|
-
wordsPerSecond: 2.5,
|
|
15
|
-
maxCharsPerRequest: 4096,
|
|
16
|
-
durationSafetyBufferSeconds: 60,
|
|
17
|
-
concurrentRequests: 5,
|
|
18
|
-
};
|