@dataclouder/nest-vertex 0.0.44 → 0.0.45
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/package.json
CHANGED
|
@@ -29,7 +29,7 @@ let KeyBalancerApiService = KeyBalancerApiService_1 = class KeyBalancerApiServic
|
|
|
29
29
|
try {
|
|
30
30
|
const url = `${keyBalancerHost}/api/key-balancer/redis/key`;
|
|
31
31
|
const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.post(url, request));
|
|
32
|
-
this.logger.verbose(`
|
|
32
|
+
this.logger.verbose(`Requested to: ${url} for key :${request.provider} type: ${request.aiType} model: ${request.model} tier: ${request.tier} getting key: ${data.name}`);
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
@@ -34,7 +34,7 @@ let ImageVertexService = ImageVertexService_1 = class ImageVertexService {
|
|
|
34
34
|
async listModels() {
|
|
35
35
|
return gemini_models_1.GeminiImageModelsList;
|
|
36
36
|
}
|
|
37
|
-
async _getGenAiClient(model, tierType =
|
|
37
|
+
async _getGenAiClient(model, tierType = key_balancer_models_1.TierType.TIER_1) {
|
|
38
38
|
let apiKey;
|
|
39
39
|
let keyId;
|
|
40
40
|
let availableKey = {};
|
|
@@ -43,12 +43,13 @@ let ImageVertexService = ImageVertexService_1 = class ImageVertexService {
|
|
|
43
43
|
keyId = 'local';
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
|
|
46
|
+
this.logger.log(`Vertex Image"Getting key for model: ${model} and tier: ${tierType}`);
|
|
47
|
+
availableKey = await this.keyBalancerApiService.postQueryKey({
|
|
47
48
|
provider: 'google',
|
|
48
49
|
model: model,
|
|
49
|
-
tier:
|
|
50
|
+
tier: tierType,
|
|
50
51
|
aiType: key_balancer_models_1.ModelType.IMAGE,
|
|
51
|
-
})
|
|
52
|
+
});
|
|
52
53
|
if (availableKey === null) {
|
|
53
54
|
this.logger.error('KEY BALANCER IS DOWN: :::: No available API key from key balancer.');
|
|
54
55
|
}
|
|
@@ -152,14 +152,25 @@ let VertexVeoGenaiService = class VertexVeoGenaiService {
|
|
|
152
152
|
});
|
|
153
153
|
this.logger.log(` ❗️ Bug de GEN AI API, No FUNCIONA ASYNC para descargar video, esperando 3.5 segundos a que descarge.....`);
|
|
154
154
|
await new Promise(resolve => setTimeout(resolve, 3500));
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
try {
|
|
156
|
+
const videoBuffer = await fs.readFile(filename);
|
|
157
|
+
console.log('Subiendo video a storage', filename, process.env.STORAGE_BUCKET);
|
|
158
|
+
const uploadResult = await this.cloudStorageService.uploadFileAndMakePublic(process.env.STORAGE_BUCKET, `generated-videos/${filename}`, videoBuffer, 'video/mp4');
|
|
159
|
+
this.logger.log(`Generated video uploaded to ${uploadResult.url}`);
|
|
160
|
+
return {
|
|
161
|
+
url: uploadResult.url,
|
|
162
|
+
result: uploadResult,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
try {
|
|
167
|
+
await fs.unlink(filename);
|
|
168
|
+
this.logger.log(`Successfully deleted temporary video file: ${filename}`);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
this.logger.error(`Failed to delete temporary video file: ${filename}`, error);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
163
174
|
}
|
|
164
175
|
};
|
|
165
176
|
exports.VertexVeoGenaiService = VertexVeoGenaiService;
|