@dataclouder/nest-vertex 0.0.25 → 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.
|
@@ -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
|
|
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
|
}
|
|
@@ -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([
|