vidspotai-shared 1.0.0 → 1.0.3
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/aiModels.d.ts +2 -0
- package/lib/globals/aiModels.d.ts.map +1 -1
- package/lib/globals/aiModels.js +51 -5
- package/lib/globals/plans.js +6 -6
- package/lib/globals/types.d.ts +197 -8
- package/lib/globals/types.d.ts.map +1 -1
- package/lib/globals/types.js +188 -14
- package/lib/libs/firebase.d.ts.map +1 -1
- package/lib/libs/firebase.js +18 -12
- package/lib/models/script.model.d.ts +4 -0
- package/lib/models/script.model.d.ts.map +1 -1
- package/lib/models/script.model.js +7 -4
- package/lib/models/user.model.d.ts +1 -6
- package/lib/models/user.model.d.ts.map +1 -1
- package/lib/models/video.model.d.ts +13 -12
- package/lib/models/video.model.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
- package/lib/services/aiGen/aiGenFactory.service.js +2 -0
- package/lib/services/aiGen/providers/alibaba/alibaba.d.ts +1 -1
- package/lib/services/aiGen/providers/alibaba/alibaba.d.ts.map +1 -1
- package/lib/services/aiGen/providers/alibaba/alibaba.js +12 -29
- package/lib/services/aiGen/providers/azure/azure.service.d.ts +1 -1
- package/lib/services/aiGen/providers/azure/azure.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/azure/azure.service.js +25 -47
- package/lib/services/aiGen/providers/baseAiGenProvider.service.d.ts +1 -1
- package/lib/services/aiGen/providers/baseAiGenProvider.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.d.ts +1 -1
- package/lib/services/aiGen/providers/google/google.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/google/google.service.js +23 -32
- package/lib/services/aiGen/providers/kling/kling.service.d.ts +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.js +11 -26
- package/lib/services/aiGen/providers/minimax/minimax.service.d.ts +1 -1
- package/lib/services/aiGen/providers/minimax/minimax.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/minimax/minimax.service.js +21 -18
- package/lib/services/aiGen/providers/minimax/types.d.ts +1 -0
- package/lib/services/aiGen/providers/minimax/types.d.ts.map +1 -1
- package/lib/services/aiGen/providers/openai/openai.service.d.ts +1 -1
- package/lib/services/aiGen/providers/openai/openai.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/openai/openai.service.js +7 -7
- package/lib/services/aiGen/providers/runway/runway.service.d.ts +1 -1
- package/lib/services/aiGen/providers/runway/runway.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/runway/runway.service.js +8 -8
- package/lib/services/aiGen/providers/types.d.ts +4 -4
- package/lib/services/aiGen/providers/types.d.ts.map +1 -1
- package/lib/services/bullmq.service.d.ts +30 -0
- package/lib/services/bullmq.service.d.ts.map +1 -0
- package/lib/services/bullmq.service.js +99 -0
- package/lib/services/firestore.service.d.ts +3 -0
- package/lib/services/firestore.service.d.ts.map +1 -1
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/index.js +1 -0
- package/lib/services/redis.service.js +1 -1
- package/lib/utils/helpers.d.ts +3 -1
- package/lib/utils/helpers.d.ts.map +1 -1
- package/lib/utils/helpers.js +31 -1
- package/package.json +10 -1
- package/lib/services/aiGen/atypes.d.ts +0 -5
- package/lib/services/aiGen/atypes.d.ts.map +0 -1
- package/lib/services/aiGen/atypes.js +0 -8
- package/lib/services/aiGen/providers/azure/azure.d.ts +0 -1
- package/lib/services/aiGen/providers/azure/azure.d.ts.map +0 -1
- package/lib/services/aiGen/providers/azure/azure.js +0 -1
- package/lib/services/aiGen/providers/kling/btypes.d.ts +0 -73
- package/lib/services/aiGen/providers/kling/btypes.d.ts.map +0 -1
- package/lib/services/aiGen/providers/kling/btypes.js +0 -2
- package/lib/services/aiGen/providers/minimax/ctypes.d.ts +0 -26
- package/lib/services/aiGen/providers/minimax/ctypes.d.ts.map +0 -1
- package/lib/services/aiGen/providers/minimax/ctypes.js +0 -3
- package/lib/services/aiGen/providers/runway/dtypes.d.ts +0 -14
- package/lib/services/aiGen/providers/runway/dtypes.d.ts.map +0 -1
- package/lib/services/aiGen/providers/runway/dtypes.js +0 -27
|
@@ -6,7 +6,7 @@ export declare class MinimaxService extends BaseAiGenProviderService {
|
|
|
6
6
|
constructor();
|
|
7
7
|
private request;
|
|
8
8
|
generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
|
|
9
|
-
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult
|
|
9
|
+
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
|
|
10
10
|
getCreditUsed({ modelKey, resolution, duration, }: CreditUsageParams): number;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=minimax.service.d.ts.map
|
|
@@ -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;AASlB,qBAAa,cAAe,SAAQ,wBAAwB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,
|
|
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;AASlB,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,GACb,EAAE,iBAAiB,GAAG,MAAM;CAO9B"}
|
|
@@ -14,7 +14,7 @@ const helpers_2 = require("../../../../utils/helpers");
|
|
|
14
14
|
class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
|
-
this.baseUrl =
|
|
17
|
+
this.baseUrl = "https://api.minimax.io";
|
|
18
18
|
if (!process.env.MINIMAX_ACCESS_KEY) {
|
|
19
19
|
throw new Error("Missing MINIMAX_ACCESS_KEY in environment variables");
|
|
20
20
|
}
|
|
@@ -49,38 +49,46 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
49
49
|
const requestBody = {
|
|
50
50
|
model: modelId,
|
|
51
51
|
prompt: params.prompt,
|
|
52
|
+
first_frame_image: params.inputImageUrl,
|
|
52
53
|
resolution: params.resolution || "512P",
|
|
53
54
|
duration: params.duration || 6,
|
|
54
55
|
};
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const response = await this.request("/v1/video_generation", "POST", requestBody);
|
|
57
|
+
console.log("Minimax video generation task response:", response);
|
|
58
|
+
const taskId = response.task_id;
|
|
59
|
+
return { task: taskId, status: types_1.EVideoSceneStatus.TRIGGERED };
|
|
58
60
|
}
|
|
59
61
|
async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
|
|
60
62
|
const result = await this.request(`/v1/query/video_generation`, "GET", undefined, { task_id: `${task}` });
|
|
61
|
-
if (result.status === "
|
|
63
|
+
if (result.status === "Fail") {
|
|
64
|
+
return {
|
|
65
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
66
|
+
errorMessage: `${result.base_resp.status_code} ${result.base_resp.status_msg}`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else if (result.status === "Success") {
|
|
62
70
|
if (!result.file_id) {
|
|
63
71
|
return {
|
|
64
|
-
status: types_1.
|
|
72
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
65
73
|
errorMessage: "No file_id in response",
|
|
66
74
|
};
|
|
67
75
|
}
|
|
68
76
|
// Get file metadata and download URL
|
|
69
77
|
const fileInfo = await this.request(`/v1/files/retrieve`, "GET", undefined, { file_id: result.file_id });
|
|
70
|
-
if (!fileInfo.download_url) {
|
|
78
|
+
if (!fileInfo.file.download_url) {
|
|
71
79
|
return {
|
|
72
|
-
status: types_1.
|
|
80
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
73
81
|
errorMessage: `File retrieval failed: ${fileInfo.base_resp?.status_code} ${fileInfo.base_resp?.status_msg}`,
|
|
74
82
|
};
|
|
75
83
|
}
|
|
76
84
|
// Download the video as binary
|
|
77
|
-
const videoResp = await axios_1.default.get(fileInfo.download_url, {
|
|
85
|
+
const videoResp = await axios_1.default.get(fileInfo.file.download_url, {
|
|
78
86
|
responseType: "arraybuffer",
|
|
79
87
|
timeout: 180000, // 3 minutes
|
|
80
88
|
});
|
|
81
89
|
if (videoResp.status !== 200) {
|
|
82
90
|
return {
|
|
83
|
-
status: types_1.
|
|
91
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
84
92
|
errorMessage: `Failed to download video: ${videoResp.status}`,
|
|
85
93
|
};
|
|
86
94
|
}
|
|
@@ -94,16 +102,11 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
|
|
|
94
102
|
});
|
|
95
103
|
return {
|
|
96
104
|
videoUrl: signedUrl,
|
|
97
|
-
status: types_1.
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
if (result.status === "Fail") {
|
|
101
|
-
return {
|
|
102
|
-
status: types_1.EVideoJobStatus.FAILED,
|
|
103
|
-
errorMessage: `${result.base_resp.status_code} ${result.base_resp.status_msg}`,
|
|
105
|
+
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
|
-
|
|
108
|
+
// rest status are pending forms
|
|
109
|
+
return { status: types_1.EVideoSceneStatus.PENDING };
|
|
107
110
|
}
|
|
108
111
|
getCreditUsed({ modelKey, resolution = "512P", duration = 6, }) {
|
|
109
112
|
const modelConfig = aiModels_1.aiModelConfigs[modelKey];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GACxB,mBAAmB,GACnB,iBAAiB,GACjB,QAAQ,CAAC;AAEb,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACzD,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GACxB,mBAAmB,GACnB,iBAAiB,GACjB,QAAQ,CAAC;AAEb,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,gBAAgB,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QAC3C,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,WAAW,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACzD,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH"}
|
|
@@ -5,7 +5,7 @@ export declare class OpenaiService extends BaseAiGenProviderService {
|
|
|
5
5
|
private client;
|
|
6
6
|
constructor();
|
|
7
7
|
generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
|
|
8
|
-
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult
|
|
8
|
+
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
|
|
9
9
|
generateText(params: TextGenerationParams): Promise<TextGenerationResult>;
|
|
10
10
|
getCreditUsed({ modelKey, duration }: CreditUsageParams): number;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/openai/openai.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openai.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/openai/openai.service.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,MAAM,CAAS;;IAQjB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoB3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsC3C,YAAY,CAChB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IA4BhC,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAMrE"}
|
|
@@ -8,10 +8,10 @@ exports.OpenaiService = void 0;
|
|
|
8
8
|
const openai_1 = __importDefault(require("openai"));
|
|
9
9
|
const aiModels_1 = require("../../../../globals/aiModels");
|
|
10
10
|
const types_1 = require("../../../../globals/types");
|
|
11
|
+
const firebase_1 = require("../../../../libs/firebase");
|
|
12
|
+
const utils_1 = require("../../../../utils");
|
|
11
13
|
const helpers_1 = require("../../helpers");
|
|
12
14
|
const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
|
|
13
|
-
const utils_1 = require("../../../../utils");
|
|
14
|
-
const firebase_1 = require("../../../../libs/firebase");
|
|
15
15
|
class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
@@ -30,7 +30,7 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
30
30
|
if (job.status === "failed") {
|
|
31
31
|
throw new Error(`OpenAI video generation failed: ${JSON.stringify(job.error)}`);
|
|
32
32
|
}
|
|
33
|
-
return { task: job.id, status: types_1.
|
|
33
|
+
return { task: job.id, status: types_1.EVideoSceneStatus.TRIGGERED };
|
|
34
34
|
}
|
|
35
35
|
async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
|
|
36
36
|
// Get job info from OpenAI
|
|
@@ -50,19 +50,19 @@ class OpenaiService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
50
50
|
expires: "03-09-2491",
|
|
51
51
|
});
|
|
52
52
|
return {
|
|
53
|
-
status: types_1.
|
|
53
|
+
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
54
54
|
videoUrl: signedUrl,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
if (job.status === "failed") {
|
|
57
|
+
else if (job.status === "failed") {
|
|
58
58
|
return {
|
|
59
|
-
status: types_1.
|
|
59
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
60
60
|
errorMessage: job.error
|
|
61
61
|
? `${job.error.code}: ${job.error.message}`
|
|
62
62
|
: "Unknown error",
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
return { status: types_1.
|
|
65
|
+
return { status: types_1.EVideoSceneStatus.PENDING };
|
|
66
66
|
}
|
|
67
67
|
async generateText(params) {
|
|
68
68
|
const { input, modelKey, options } = params;
|
|
@@ -6,7 +6,7 @@ export declare class RunwayService extends BaseAiGenProviderService {
|
|
|
6
6
|
constructor();
|
|
7
7
|
private request;
|
|
8
8
|
generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
|
|
9
|
-
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult
|
|
9
|
+
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
|
|
10
10
|
getCreditUsed({ modelKey, duration }: CreditUsageParams): number;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=runway.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runway.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/runway.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runway.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/runway/runway.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;AAGlB,qBAAa,aAAc,SAAQ,wBAAwB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;YAUlB,OAAO;IA+Bf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAuC3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4DjD,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAY,EAAE,EAAE,iBAAiB,GAAG,MAAM;CAIrE"}
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.RunwayService = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const aiModels_1 = require("../../../../globals/aiModels");
|
|
9
|
-
const
|
|
9
|
+
const types_1 = require("../../../../globals/types");
|
|
10
10
|
const firebase_1 = require("../../../../libs/firebase");
|
|
11
|
+
const helpers_1 = require("../../../../utils/helpers");
|
|
11
12
|
const helpers_2 = require("../../helpers");
|
|
12
13
|
const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
|
|
13
|
-
const types_1 = require("../../../../globals/types");
|
|
14
14
|
class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
@@ -69,7 +69,7 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
69
69
|
else {
|
|
70
70
|
throw new Error(`Invalid params: Model ${params.modelKey} does not support this generation type`);
|
|
71
71
|
}
|
|
72
|
-
return { task: run.id, status: types_1.
|
|
72
|
+
return { task: run.id, status: types_1.EVideoSceneStatus.TRIGGERED };
|
|
73
73
|
}
|
|
74
74
|
async checkVideoStatus({ task, outputFilename, outputFilePath = "videos", }) {
|
|
75
75
|
const result = await this.request(`/tasks/${task}`, "GET");
|
|
@@ -77,7 +77,7 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
77
77
|
const videoUri = result.output[0];
|
|
78
78
|
if (!videoUri) {
|
|
79
79
|
return {
|
|
80
|
-
status: types_1.
|
|
80
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
81
81
|
errorMessage: "No video returned from Runway API",
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -88,7 +88,7 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
88
88
|
});
|
|
89
89
|
if (videoResp.status !== 200) {
|
|
90
90
|
return {
|
|
91
|
-
status: types_1.
|
|
91
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
92
92
|
errorMessage: `Failed to download video: ${videoResp.status}`,
|
|
93
93
|
};
|
|
94
94
|
}
|
|
@@ -102,17 +102,17 @@ class RunwayService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
102
102
|
});
|
|
103
103
|
return {
|
|
104
104
|
videoUrl: signedUrl,
|
|
105
|
-
status: types_1.
|
|
105
|
+
status: types_1.EVideoSceneStatus.COMPLETED,
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
if (result.status === "FAILED" || result.status === "CANCELLED") {
|
|
109
109
|
return {
|
|
110
|
-
status: types_1.
|
|
110
|
+
status: types_1.EVideoSceneStatus.FAILED,
|
|
111
111
|
errorMessage: `Failure: ${result.failure || "unknown"} Code: ${result.failureCode || "unknown"}`,
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
// Still processing
|
|
115
|
-
return { status: types_1.
|
|
115
|
+
return { status: types_1.EVideoSceneStatus.PENDING };
|
|
116
116
|
}
|
|
117
117
|
getCreditUsed({ modelKey, duration = 5 }) {
|
|
118
118
|
const modelConfig = aiModels_1.aiModelConfigs[modelKey];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChatCompletionMessageParam } from "openai/resources/index";
|
|
2
2
|
import { ETextGenModels, EVideoGenModels } from "../../../globals/aiModels";
|
|
3
|
-
import {
|
|
3
|
+
import { EVideoSceneStatus, TVideoJobTask } from "../../../globals/types";
|
|
4
4
|
import { EVideoMode } from "../types";
|
|
5
5
|
export interface VideoGenerationParams {
|
|
6
6
|
prompt?: string;
|
|
@@ -14,11 +14,11 @@ export interface VideoGenerationParams {
|
|
|
14
14
|
mode?: EVideoMode;
|
|
15
15
|
}
|
|
16
16
|
export interface VideoGenerationResult {
|
|
17
|
-
status:
|
|
18
|
-
task
|
|
17
|
+
status: EVideoSceneStatus.TRIGGERED;
|
|
18
|
+
task: TVideoJobTask;
|
|
19
19
|
}
|
|
20
20
|
export interface VideoStatusResult {
|
|
21
|
-
status:
|
|
21
|
+
status: EVideoSceneStatus;
|
|
22
22
|
videoUrl?: string;
|
|
23
23
|
errorMessage?: string;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/aiGen/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/aiGen/providers/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EACL,iBAAiB,EACjB,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC;IACpC,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CAEvB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAMzB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,0BAA0B,EAAE,GAAG,MAAM,CAAC;IAC7C,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,eAAe,GAAG,cAAc,CAAC;IAC3C,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;CACzC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Job } from "bullmq";
|
|
2
|
+
import { RedisOptions } from "ioredis";
|
|
3
|
+
export type JobData = Record<string, any>;
|
|
4
|
+
interface BullMQServiceOptions {
|
|
5
|
+
redisOptions: RedisOptions;
|
|
6
|
+
concurrency?: number;
|
|
7
|
+
}
|
|
8
|
+
declare class BullMQService {
|
|
9
|
+
private static instance;
|
|
10
|
+
private queues;
|
|
11
|
+
private workers;
|
|
12
|
+
private redisOptions;
|
|
13
|
+
private concurrency;
|
|
14
|
+
private initialized;
|
|
15
|
+
private shuttingDown;
|
|
16
|
+
private constructor();
|
|
17
|
+
static getInstance(options: BullMQServiceOptions): BullMQService;
|
|
18
|
+
/** Initialize BullMQ service (like your initRedis) */
|
|
19
|
+
/** Initialize BullMQ service (like initRedis) */
|
|
20
|
+
init(): Promise<void>;
|
|
21
|
+
/** Add a job */
|
|
22
|
+
addJob(queueName: string, data: JobData, opts?: {
|
|
23
|
+
jobId?: string;
|
|
24
|
+
delay?: number;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
startWorkers(queueNames: string[], processor: (job: Job) => Promise<void>): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const bullmq: BullMQService;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=bullmq.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bullmq.service.d.ts","sourceRoot":"","sources":["../../src/services/bullmq.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE1C,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,cAAM,aAAa;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IACvC,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO;WAQO,WAAW,CAAC,OAAO,EAAE,oBAAoB;IAOvD,sDAAsD;IACtD,iDAAiD;IACpC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBlC,gBAAgB;IACH,MAAM,CACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,EACb,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAUpC,YAAY,CACjB,UAAU,EAAE,MAAM,EAAE,EACpB,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC;CAmDzC;AAQD,eAAO,MAAM,MAAM,eAGjB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bullmq = void 0;
|
|
4
|
+
// libs/bullmqService.ts
|
|
5
|
+
const bullmq_1 = require("bullmq");
|
|
6
|
+
class BullMQService {
|
|
7
|
+
constructor({ redisOptions, concurrency = 10, }) {
|
|
8
|
+
this.queues = new Map();
|
|
9
|
+
this.workers = [];
|
|
10
|
+
this.initialized = false;
|
|
11
|
+
this.shuttingDown = false;
|
|
12
|
+
this.redisOptions = redisOptions;
|
|
13
|
+
this.concurrency = concurrency;
|
|
14
|
+
}
|
|
15
|
+
static getInstance(options) {
|
|
16
|
+
if (!BullMQService.instance) {
|
|
17
|
+
BullMQService.instance = new BullMQService(options);
|
|
18
|
+
}
|
|
19
|
+
return BullMQService.instance;
|
|
20
|
+
}
|
|
21
|
+
/** Initialize BullMQ service (like your initRedis) */
|
|
22
|
+
/** Initialize BullMQ service (like initRedis) */
|
|
23
|
+
async init() {
|
|
24
|
+
if (this.initialized)
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
// Create a temporary test queue
|
|
28
|
+
const testQueue = new bullmq_1.Queue("__init__", {
|
|
29
|
+
connection: this.redisOptions,
|
|
30
|
+
});
|
|
31
|
+
// Ping Redis via ioredis client
|
|
32
|
+
const testQueueClient = await testQueue.client;
|
|
33
|
+
testQueueClient.ping();
|
|
34
|
+
await testQueue.close();
|
|
35
|
+
this.initialized = true;
|
|
36
|
+
console.log("✅ BullMQService initialized and connected to Redis");
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
console.error("❌ BullMQService failed to connect to Redis", err);
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Add a job */
|
|
44
|
+
async addJob(queueName, data, opts) {
|
|
45
|
+
if (!this.initialized)
|
|
46
|
+
await this.init();
|
|
47
|
+
const queue = this.queues.get(queueName) ??
|
|
48
|
+
new bullmq_1.Queue(queueName, { connection: this.redisOptions });
|
|
49
|
+
this.queues.set(queueName, queue);
|
|
50
|
+
await queue.add(opts?.jobId || "default", data, { delay: opts?.delay });
|
|
51
|
+
}
|
|
52
|
+
startWorkers(queueNames, processor) {
|
|
53
|
+
const start = async () => {
|
|
54
|
+
if (!this.initialized)
|
|
55
|
+
await this.init();
|
|
56
|
+
for (const queueName of queueNames) {
|
|
57
|
+
const queue = this.queues.get(queueName) ??
|
|
58
|
+
new bullmq_1.Queue(queueName, { connection: this.redisOptions });
|
|
59
|
+
this.queues.set(queueName, queue);
|
|
60
|
+
const worker = new bullmq_1.Worker(queueName, async (job) => processor(job), {
|
|
61
|
+
connection: this.redisOptions,
|
|
62
|
+
concurrency: this.concurrency,
|
|
63
|
+
});
|
|
64
|
+
worker.on("completed", (job) => console.log(`✅ [${queueName}] Job ${job.id} completed`));
|
|
65
|
+
worker.on("failed", (job, err) => console.error(`❌ [${queueName}] Job ${job?.id} failed:`, err));
|
|
66
|
+
this.workers.push(worker);
|
|
67
|
+
}
|
|
68
|
+
console.log(`🚀 Started workers for queues: ${queueNames.join(", ")}`);
|
|
69
|
+
// Setup graceful shutdown
|
|
70
|
+
const graceful = async () => {
|
|
71
|
+
if (this.shuttingDown)
|
|
72
|
+
return;
|
|
73
|
+
this.shuttingDown = true;
|
|
74
|
+
console.log("🛑 Shutting down BullMQ workers gracefully...");
|
|
75
|
+
for (const worker of this.workers) {
|
|
76
|
+
await worker.close();
|
|
77
|
+
console.log(`✅ Worker for queue ${worker.name} closed`);
|
|
78
|
+
}
|
|
79
|
+
console.log("✅ All workers closed. Exiting process.");
|
|
80
|
+
process.exit(0);
|
|
81
|
+
};
|
|
82
|
+
process.on("SIGINT", graceful);
|
|
83
|
+
process.on("SIGTERM", graceful);
|
|
84
|
+
};
|
|
85
|
+
start().catch((err) => {
|
|
86
|
+
console.error("❌ Failed to start workers:", err);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const redisOptions = {
|
|
92
|
+
host: process.env.REDIS_HOST,
|
|
93
|
+
port: Number(process.env.REDIS_PORT),
|
|
94
|
+
password: process.env.REDIS_PASSWORD,
|
|
95
|
+
};
|
|
96
|
+
exports.bullmq = BullMQService.getInstance({
|
|
97
|
+
redisOptions,
|
|
98
|
+
concurrency: 10,
|
|
99
|
+
});
|
|
@@ -19,8 +19,11 @@ export declare class FirestoreService {
|
|
|
19
19
|
videoModelKey: import("..").EVideoGenModels;
|
|
20
20
|
createdAt: Date;
|
|
21
21
|
updatedAt: Date;
|
|
22
|
+
originalPrompt?: string | undefined;
|
|
23
|
+
translatedSummary?: string | undefined;
|
|
22
24
|
} & {
|
|
23
25
|
summary: string;
|
|
26
|
+
title: string;
|
|
24
27
|
scenes: {
|
|
25
28
|
sceneIndex: number;
|
|
26
29
|
duration: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestore.service.d.ts","sourceRoot":"","sources":["../../src/services/firestore.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,gBAAgB,CAAC;AACpE,OAAO,EACL,YAAY,EAGZ,aAAa,EACb,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAe/C;;;;GAIG;AACH,qBAAa,gBAAgB;IAE3B,MAAM,CAAC,YAAY,oFAEqC;IAExD,MAAM,CAAC,QAAQ,gFAEqC;IAEpD,MAAM,CAAC,UAAU
|
|
1
|
+
{"version":3,"file":"firestore.service.d.ts","sourceRoot":"","sources":["../../src/services/firestore.service.ts"],"names":[],"mappings":"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"}
|
package/lib/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/lib/services/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./redis.service"), exports);
|
|
18
18
|
__exportStar(require("./firestore.service"), exports);
|
|
19
19
|
__exportStar(require("./aiGen"), exports);
|
|
20
|
+
__exportStar(require("./bullmq.service"), exports);
|
|
@@ -13,7 +13,7 @@ class RedisService {
|
|
|
13
13
|
this.client.on("error", (err) => console.error("❌ Redis Client Error:", err));
|
|
14
14
|
this.client.on("connect", () => {
|
|
15
15
|
this.connected = true;
|
|
16
|
-
console.log("✅ Connected to Redis Cloud");
|
|
16
|
+
console.log("✅ Connected to Redis Cloud!");
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
// Singleton instance
|
package/lib/utils/helpers.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ERENEWAL_FREQUENCY, ESUBSCRIPTION_PLANS } from "../globals/types";
|
|
1
|
+
import { ELANGUAGE_CODE, ERENEWAL_FREQUENCY, ESUBSCRIPTION_PLANS, IDetectLang } from "../globals/types";
|
|
2
2
|
export declare const getPlanTypeById: (priceId: string) => ESUBSCRIPTION_PLANS | null;
|
|
3
3
|
export declare const getFreqById: (priceId: string) => ERENEWAL_FREQUENCY | null;
|
|
4
4
|
export declare const getPriceIdByType: (type: ESUBSCRIPTION_PLANS, freq?: ERENEWAL_FREQUENCY) => string;
|
|
5
5
|
export declare const getCreditsFromCost: (cost: number) => number;
|
|
6
|
+
export declare const getTranslationWrapper: (text: string, from: ELANGUAGE_CODE, to?: ELANGUAGE_CODE, version?: "v1" | "v2") => Promise<string>;
|
|
7
|
+
export declare const detectLang: (text: string) => Promise<IDetectLang>;
|
|
6
8
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,KACd,mBAAmB,GAAG,IASxB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,kBAAkB,GAAG,IASlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,MAAM,mBAAmB,EACzB,OAAM,kBAA+C,WAkBtD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAajD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EACZ,MAAM,cAAc,EACpB,KAAI,cAAkC,EACtC,UAAS,IAAI,GAAG,IAAW,KAC1B,OAAO,CAAC,MAAM,CAmBhB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,WAAW,CAclE,CAAC"}
|
package/lib/utils/helpers.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCreditsFromCost = exports.getPriceIdByType = exports.getFreqById = exports.getPlanTypeById = void 0;
|
|
6
|
+
exports.detectLang = exports.getTranslationWrapper = exports.getCreditsFromCost = exports.getPriceIdByType = exports.getFreqById = exports.getPlanTypeById = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
4
8
|
const plans_1 = require("../globals/plans");
|
|
5
9
|
const types_1 = require("../globals/types");
|
|
6
10
|
const getPlanTypeById = (priceId) => {
|
|
@@ -53,3 +57,29 @@ const getCreditsFromCost = (cost) => {
|
|
|
53
57
|
return Math.max(credits, minCredits);
|
|
54
58
|
};
|
|
55
59
|
exports.getCreditsFromCost = getCreditsFromCost;
|
|
60
|
+
const getTranslationWrapper = async (text, from, to = types_1.ELANGUAGE_CODE.en, version = "v2") => {
|
|
61
|
+
try {
|
|
62
|
+
const res = await axios_1.default.post("https://us-central1-translation-service-3931b.cloudfunctions.net/translate", { text, from, to, version }, {
|
|
63
|
+
headers: {
|
|
64
|
+
"internal-key": process.env.TRANSLATION_SERVICE_KEY || "",
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return res.data.translated;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
console.error("getTranslationWrapper error:- ", JSON.stringify(err.message));
|
|
71
|
+
}
|
|
72
|
+
return text;
|
|
73
|
+
};
|
|
74
|
+
exports.getTranslationWrapper = getTranslationWrapper;
|
|
75
|
+
const detectLang = async (text) => {
|
|
76
|
+
const res = await axios_1.default.post("https://us-central1-translation-service-3931b.cloudfunctions.net/detectLang", {
|
|
77
|
+
text,
|
|
78
|
+
}, {
|
|
79
|
+
headers: {
|
|
80
|
+
"internal-key": process.env.TRANSLATION_SERVICE_KEY || "",
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
return res.data;
|
|
84
|
+
};
|
|
85
|
+
exports.detectLang = detectLang;
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vidspotai-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./lib/index.js",
|
|
9
|
+
"require": "./lib/index.js",
|
|
10
|
+
"types": "./lib/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
6
13
|
"files": [
|
|
7
14
|
"lib"
|
|
8
15
|
],
|
|
@@ -11,6 +18,8 @@
|
|
|
11
18
|
"@google/genai": "^1.22.0",
|
|
12
19
|
"@runwayml/sdk": "^2.11.0",
|
|
13
20
|
"axios": "^1.12.2",
|
|
21
|
+
"ioredis": "^5.8.0",
|
|
22
|
+
"bullmq": "^5.61.0",
|
|
14
23
|
"firebase-admin": "^13.5.0",
|
|
15
24
|
"jsonwebtoken": "^9.0.2",
|
|
16
25
|
"openai": "^6.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"atypes.d.ts","sourceRoot":"","sources":["../../../src/services/aiGen/atypes.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,QAAQ,QAAQ;IAChB,YAAY,QAAQ;CACrB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EVideoMode = void 0;
|
|
4
|
-
var EVideoMode;
|
|
5
|
-
(function (EVideoMode) {
|
|
6
|
-
EVideoMode["STANDARD"] = "std";
|
|
7
|
-
EVideoMode["PROFESSIONAL"] = "pro";
|
|
8
|
-
})(EVideoMode || (exports.EVideoMode = EVideoMode = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=azure.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"azure.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/azure/azure.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|