@dataclouder/nest-vertex 0.0.24 → 0.0.26

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.
@@ -18,15 +18,15 @@ export declare class ComfyUiController {
18
18
  generateImage(generateImageDto: ImageGenRequestAdapter): Promise<ImageGenAdapterResponse>;
19
19
  generateVideoFromLocalImage(positivePrompt: string, negativePrompt: string): Promise<{
20
20
  message: string;
21
- asset: import("../../models/generated-asset.entity").GeneratedAsset;
21
+ asset: import("../..").GeneratedAsset;
22
22
  }>;
23
23
  generateVideoFromAsset(id: string): Promise<{
24
24
  message: string;
25
- asset: import("../../models/generated-asset.entity").GeneratedAsset;
25
+ asset: import("../..").GeneratedAsset;
26
26
  }>;
27
27
  generateVideoFromUrl(videoUrlRequestDto: VideoUrlRequestDto): Promise<{
28
28
  message: string;
29
- asset: import("../../models/generated-asset.entity").GeneratedAsset;
29
+ asset: import("../..").GeneratedAsset;
30
30
  }>;
31
31
  sse(): Observable<MessageEvent>;
32
32
  }
@@ -104,20 +104,7 @@ let ComfyUiController = ComfyUiController_1 = class ComfyUiController {
104
104
  const newAsset = await this.generatedAssetService.save({
105
105
  assets: { firstFrame: { url } },
106
106
  });
107
- const asset = await this.generatedAssetService.findOne(newAsset.id);
108
- if (!asset || !asset.assets?.firstFrame?.url) {
109
- throw new common_1.NotFoundException(`Asset with id ${newAsset.id} not found or does not have a valid image url.`);
110
- }
111
- const imageUrl = asset.assets.firstFrame.url;
112
- const response = await this.httpService.axiosRef.get(imageUrl, { responseType: 'arraybuffer' });
113
- const imageBuffer = Buffer.from(response.data, 'binary');
114
- const videoRequest = {
115
- workflowPath: path.resolve('./comfy_workflows/video-15_seconds.json'),
116
- inputImage: imageBuffer,
117
- positivePrompt: positivePrompt || 'Faces are smiling',
118
- negativePrompt: negativePrompt || 'low quality, blurry, static',
119
- };
120
- const videoResponse = await this.comfyVideoService.runVideoGenerationFromWorkflow(videoRequest, newAsset.id);
107
+ const videoResponse = await this.comfyVideoService.runVideoGenerationForAssetId(newAsset.id, positivePrompt, negativePrompt);
121
108
  this.logger.log(`ComfyUI video generation started. Response: ${JSON.stringify(videoResponse)}`);
122
109
  return videoResponse;
123
110
  }
@@ -15,4 +15,8 @@ export declare class ComfyVideoService {
15
15
  message: string;
16
16
  asset: GeneratedAsset;
17
17
  }>;
18
+ runVideoGenerationForAssetId(assetId: string, positivePrompt: string, negativePrompt: string): Promise<{
19
+ message: string;
20
+ asset: GeneratedAsset;
21
+ }>;
18
22
  }
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.ComfyVideoService = void 0;
14
14
  const common_1 = require("@nestjs/common");
15
15
  const fs = require("fs/promises");
16
+ const path = require("path");
16
17
  const comfy_connection_service_1 = require("./comfy-connection.service");
17
18
  const axios_1 = require("@nestjs/axios");
18
19
  const generated_asset_service_1 = require("../../services/generated-asset.service");
@@ -80,6 +81,23 @@ let ComfyVideoService = ComfyVideoService_1 = class ComfyVideoService {
80
81
  throw new common_1.InternalServerErrorException(`Failed to run video generation workflow: ${error.message}`);
81
82
  }
82
83
  }
84
+ async runVideoGenerationForAssetId(assetId, positivePrompt, negativePrompt) {
85
+ this.logger.log(`Starting video generation for asset id: ${assetId}`);
86
+ const asset = await this.generatedAssetService.findOne(assetId);
87
+ if (!asset || !asset.assets?.firstFrame?.url) {
88
+ throw new common_1.NotFoundException(`Asset with id ${assetId} not found or does not have a valid image url.`);
89
+ }
90
+ const imageUrl = asset.assets.firstFrame.url;
91
+ const response = await this.httpService.axiosRef.get(imageUrl, { responseType: 'arraybuffer' });
92
+ const imageBuffer = Buffer.from(response.data, 'binary');
93
+ const videoRequest = {
94
+ workflowPath: path.resolve('./comfy_workflows/video-15_seconds.json'),
95
+ inputImage: imageBuffer,
96
+ positivePrompt: positivePrompt || 'Faces are smiling',
97
+ negativePrompt: negativePrompt || 'low quality, blurry, static',
98
+ };
99
+ return this.runVideoGenerationFromWorkflow(videoRequest, assetId);
100
+ }
83
101
  };
84
102
  exports.ComfyVideoService = ComfyVideoService;
85
103
  exports.ComfyVideoService = ComfyVideoService = ComfyVideoService_1 = __decorate([
package/index.d.ts CHANGED
@@ -16,3 +16,5 @@ export * from './services/generated-asset.service';
16
16
  export * from './models/gemini-models';
17
17
  export * from './models/adapter.models';
18
18
  export * from './models/google-voices';
19
+ export * from './models/generated-asset.entity';
20
+ export * from './models/generated-asset.model';
package/index.js CHANGED
@@ -32,4 +32,6 @@ __exportStar(require("./services/generated-asset.service"), exports);
32
32
  __exportStar(require("./models/gemini-models"), exports);
33
33
  __exportStar(require("./models/adapter.models"), exports);
34
34
  __exportStar(require("./models/google-voices"), exports);
35
+ __exportStar(require("./models/generated-asset.entity"), exports);
36
+ __exportStar(require("./models/generated-asset.model"), exports);
35
37
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/nest-vertex",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "NestJS Vertex AI library for Dataclouder",
5
5
  "author": "dataclouder",
6
6
  "license": "MIT",