@dataclouder/nest-vertex 0.0.3 → 0.0.4
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/controllers/gemini-chat.controller.d.ts +12 -0
- package/controllers/nest-tts.controller.d.ts +11 -0
- package/controllers/nest-vertex.controller.d.ts +14 -0
- package/dto/generate-image.dto.d.ts +7 -0
- package/dto/generate-video.dto.d.ts +18 -0
- package/index.d.ts +6 -0
- package/index.js +978 -0
- package/nest-vertex.module.d.ts +2 -0
- package/package.json +5 -5
- package/services/gemini-chat.service.d.ts +23 -0
- package/services/nest-tts.service.d.ts +20 -0
- package/services/nest-vertex.service.d.ts +14 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GeminiChatService } from '../services/gemini-chat.service';
|
|
2
|
+
interface ChatMessageInput {
|
|
3
|
+
role: 'user' | 'assistant' | 'system';
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class GeminiChatController {
|
|
7
|
+
private readonly geminiChatService;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
constructor(geminiChatService: GeminiChatService);
|
|
10
|
+
generateText(messages: ChatMessageInput[]): Promise<import("../services/gemini-chat.service").ChatMessageDict>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { google } from '@google-cloud/text-to-speech/build/protos/protos';
|
|
2
|
+
import { FastifyReply } from 'fastify';
|
|
3
|
+
import { NestTtsService, SynthesizeSpeechInput } from '../services/nest-tts.service';
|
|
4
|
+
export declare class NestTtsController {
|
|
5
|
+
private readonly nestTtsService;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
constructor(nestTtsService: NestTtsService);
|
|
8
|
+
ping(): string;
|
|
9
|
+
synthesizeSpeech(body: SynthesizeSpeechInput, res: FastifyReply): Promise<Buffer>;
|
|
10
|
+
listVoices(languageCode?: string): Promise<google.cloud.texttospeech.v1.IVoice[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NestVertexService } from '../services/nest-vertex.service';
|
|
2
|
+
import { GenerateVideoDto } from '../dto/generate-video.dto';
|
|
3
|
+
import { GenerateImageDto } from '../dto/generate-image.dto';
|
|
4
|
+
import { GenerateVideosOperation, GenerateImagesResponse } from '@google/genai';
|
|
5
|
+
export declare class NestVertexController {
|
|
6
|
+
private readonly nestVertexService;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor(nestVertexService: NestVertexService);
|
|
9
|
+
generateVideo(generateVideoDto: GenerateVideoDto): Promise<{
|
|
10
|
+
operationName: string;
|
|
11
|
+
}>;
|
|
12
|
+
getVideoStatus(operationName: string): Promise<GenerateVideosOperation>;
|
|
13
|
+
generateImage(generateImageDto: GenerateImageDto): Promise<GenerateImagesResponse>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare class ImageInputDto {
|
|
2
|
+
bytesBase64Encoded?: string;
|
|
3
|
+
gcsUri?: string;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class GenerateVideoDto {
|
|
7
|
+
prompt?: string;
|
|
8
|
+
image?: ImageInputDto;
|
|
9
|
+
durationSeconds: number;
|
|
10
|
+
aspectRatio?: string;
|
|
11
|
+
negativePrompt?: string;
|
|
12
|
+
personGeneration?: string;
|
|
13
|
+
sampleCount?: number;
|
|
14
|
+
seed?: number;
|
|
15
|
+
storageUri?: string;
|
|
16
|
+
enhancePrompt?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './nest-vertex.module';
|
|
2
|
+
export * from './controllers/nest-tts.controller';
|
|
3
|
+
export * from './services/nest-vertex.service';
|
|
4
|
+
export * from './services/nest-tts.service';
|
|
5
|
+
export * from './services/gemini-chat.service';
|
|
6
|
+
export * from './dto/generate-image.dto';
|
package/index.js
ADDED
|
@@ -0,0 +1,978 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ var __webpack_modules__ = ([
|
|
4
|
+
/* 0 */
|
|
5
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
23
|
+
__exportStar(__webpack_require__(1), exports);
|
|
24
|
+
__exportStar(__webpack_require__(13), exports);
|
|
25
|
+
__exportStar(__webpack_require__(3), exports);
|
|
26
|
+
__exportStar(__webpack_require__(11), exports);
|
|
27
|
+
__exportStar(__webpack_require__(14), exports);
|
|
28
|
+
__exportStar(__webpack_require__(10), exports);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/***/ }),
|
|
32
|
+
/* 1 */
|
|
33
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
37
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
38
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
39
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
40
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
43
|
+
exports.NestVertexModule = void 0;
|
|
44
|
+
const common_1 = __webpack_require__(2);
|
|
45
|
+
const nest_vertex_service_1 = __webpack_require__(3);
|
|
46
|
+
const nest_vertex_controller_1 = __webpack_require__(5);
|
|
47
|
+
const nest_tts_service_1 = __webpack_require__(11);
|
|
48
|
+
const nest_tts_controller_1 = __webpack_require__(13);
|
|
49
|
+
const gemini_chat_service_1 = __webpack_require__(14);
|
|
50
|
+
const gemini_chat_controller_1 = __webpack_require__(15);
|
|
51
|
+
let NestVertexModule = class NestVertexModule {
|
|
52
|
+
};
|
|
53
|
+
exports.NestVertexModule = NestVertexModule;
|
|
54
|
+
exports.NestVertexModule = NestVertexModule = __decorate([
|
|
55
|
+
(0, common_1.Module)({
|
|
56
|
+
providers: [nest_vertex_service_1.NestVertexService, nest_tts_service_1.NestTtsService, gemini_chat_service_1.GeminiChatService],
|
|
57
|
+
exports: [nest_vertex_service_1.NestVertexService, nest_tts_service_1.NestTtsService, gemini_chat_service_1.GeminiChatService],
|
|
58
|
+
controllers: [nest_vertex_controller_1.NestVertexController, nest_tts_controller_1.NestTtsController, gemini_chat_controller_1.GeminiChatController],
|
|
59
|
+
})
|
|
60
|
+
], NestVertexModule);
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/***/ }),
|
|
64
|
+
/* 2 */
|
|
65
|
+
/***/ ((module) => {
|
|
66
|
+
|
|
67
|
+
module.exports = require("@nestjs/common");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
/* 3 */
|
|
71
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
75
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
76
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
77
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
78
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
79
|
+
};
|
|
80
|
+
var NestVertexService_1;
|
|
81
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
82
|
+
exports.NestVertexService = void 0;
|
|
83
|
+
const common_1 = __webpack_require__(2);
|
|
84
|
+
const genai_1 = __webpack_require__(4);
|
|
85
|
+
let NestVertexService = NestVertexService_1 = class NestVertexService {
|
|
86
|
+
genAi;
|
|
87
|
+
logger = new common_1.Logger(NestVertexService_1.name);
|
|
88
|
+
videoModelName = 'veo-2.0-generate-001';
|
|
89
|
+
imageModelName = 'imagen-3.0-generate-002';
|
|
90
|
+
onModuleInit() {
|
|
91
|
+
const apiKey = process.env.GEMINI_API_KEY;
|
|
92
|
+
if (!apiKey) {
|
|
93
|
+
this.logger.error('GEMINI_API_KEY environment variable not set. NestVertexService will not function.');
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
console.log('GEMINI_API_KEY environment variable set: ', apiKey);
|
|
97
|
+
this.genAi = new genai_1.GoogleGenAI({ apiKey });
|
|
98
|
+
this.logger.log('GoogleGenAI client initialized successfully.');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async startVideoGeneration(generateVideoDto) {
|
|
102
|
+
if (!this.genAi) {
|
|
103
|
+
throw new Error('GoogleGenAI client not initialized. Check GEMINI_API_KEY.');
|
|
104
|
+
}
|
|
105
|
+
this.logger.log(`Starting video generation with DTO: ${JSON.stringify(generateVideoDto)}`);
|
|
106
|
+
const videoRequest = {
|
|
107
|
+
model: this.videoModelName,
|
|
108
|
+
prompt: generateVideoDto.prompt,
|
|
109
|
+
...(generateVideoDto.image && {
|
|
110
|
+
image: {
|
|
111
|
+
bytesBase64Encoded: generateVideoDto.image.bytesBase64Encoded,
|
|
112
|
+
gcsUri: generateVideoDto.image.gcsUri,
|
|
113
|
+
mimeType: generateVideoDto.image.mimeType,
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
durationSeconds: generateVideoDto.durationSeconds,
|
|
117
|
+
aspectRatio: generateVideoDto.aspectRatio,
|
|
118
|
+
negativePrompt: generateVideoDto.negativePrompt,
|
|
119
|
+
personGeneration: generateVideoDto.personGeneration,
|
|
120
|
+
sampleCount: generateVideoDto.sampleCount,
|
|
121
|
+
seed: generateVideoDto.seed,
|
|
122
|
+
storageUri: generateVideoDto.storageUri,
|
|
123
|
+
enhancePrompt: generateVideoDto.enhancePrompt,
|
|
124
|
+
};
|
|
125
|
+
Object.keys(videoRequest).forEach((key) => videoRequest[key] === undefined && delete videoRequest[key]);
|
|
126
|
+
if (videoRequest.image) {
|
|
127
|
+
if (videoRequest.image.bytesBase64Encoded === undefined)
|
|
128
|
+
delete videoRequest.image.bytesBase64Encoded;
|
|
129
|
+
if (videoRequest.image.gcsUri === undefined)
|
|
130
|
+
delete videoRequest.image.gcsUri;
|
|
131
|
+
if (Object.keys(videoRequest.image).length === 1 && videoRequest.image.mimeType) {
|
|
132
|
+
if (!videoRequest.image.bytesBase64Encoded && !videoRequest.image.gcsUri) {
|
|
133
|
+
delete videoRequest.image;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else if (Object.keys(videoRequest.image).length === 0) {
|
|
137
|
+
delete videoRequest.image;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const operation = await this.genAi.models.generateVideos(videoRequest);
|
|
142
|
+
this.logger.log(`Video generation operation started: ${operation.name}`);
|
|
143
|
+
return operation;
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
this.logger.error('Error starting video generation:', error.message || error);
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async checkVideoOperationStatus(operationName) {
|
|
151
|
+
if (!this.genAi) {
|
|
152
|
+
throw new Error('GoogleGenAI client not initialized. Check GEMINI_API_KEY.');
|
|
153
|
+
}
|
|
154
|
+
this.logger.warn(`Attempting to check status for operation: ${operationName}. ` +
|
|
155
|
+
`Note: This may fail due to SDK requiring the full operation object for getVideosOperation.`);
|
|
156
|
+
try {
|
|
157
|
+
const oper = { name: operationName };
|
|
158
|
+
const operation = await this.genAi.operations.getVideosOperation({
|
|
159
|
+
operation: oper,
|
|
160
|
+
});
|
|
161
|
+
this.logger.log(`Operation ${operationName} status: ${operation.done ? 'Done' : 'Processing'}`);
|
|
162
|
+
return operation;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
this.logger.error(`Error checking status for operation ${operationName}:`, error);
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async startImageGeneration(generateImageDto) {
|
|
170
|
+
if (!this.genAi) {
|
|
171
|
+
throw new Error('GoogleGenAI client not initialized. Check GEMINI_API_KEY/Vertex AI setup.');
|
|
172
|
+
}
|
|
173
|
+
this.logger.log(`Starting image generation with DTO: ${JSON.stringify(generateImageDto)}`);
|
|
174
|
+
const imageRequest = {
|
|
175
|
+
model: this.imageModelName,
|
|
176
|
+
prompt: generateImageDto.prompt,
|
|
177
|
+
config: {
|
|
178
|
+
numberOfImages: generateImageDto.numberOfImages,
|
|
179
|
+
aspectRatio: generateImageDto.aspectRatio,
|
|
180
|
+
negativePrompt: generateImageDto.negativePrompt,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
Object.keys(imageRequest.config).forEach((key) => imageRequest.config[key] === undefined && delete imageRequest.config[key]);
|
|
184
|
+
try {
|
|
185
|
+
const response = await this.genAi.models.generateImages(imageRequest);
|
|
186
|
+
this.logger.log(`Image generation successful for prompt: "${generateImageDto.prompt}"`);
|
|
187
|
+
return response;
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
this.logger.error('Error starting image generation:', error.message || error);
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
exports.NestVertexService = NestVertexService;
|
|
196
|
+
exports.NestVertexService = NestVertexService = NestVertexService_1 = __decorate([
|
|
197
|
+
(0, common_1.Injectable)()
|
|
198
|
+
], NestVertexService);
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
/***/ }),
|
|
202
|
+
/* 4 */
|
|
203
|
+
/***/ ((module) => {
|
|
204
|
+
|
|
205
|
+
module.exports = require("@google/genai");
|
|
206
|
+
|
|
207
|
+
/***/ }),
|
|
208
|
+
/* 5 */
|
|
209
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
213
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
214
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
215
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
216
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
217
|
+
};
|
|
218
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
219
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
220
|
+
};
|
|
221
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
222
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
223
|
+
};
|
|
224
|
+
var NestVertexController_1;
|
|
225
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
226
|
+
exports.NestVertexController = void 0;
|
|
227
|
+
const openapi = __webpack_require__(6);
|
|
228
|
+
const common_1 = __webpack_require__(2);
|
|
229
|
+
const nest_vertex_service_1 = __webpack_require__(3);
|
|
230
|
+
const generate_video_dto_1 = __webpack_require__(7);
|
|
231
|
+
const generate_image_dto_1 = __webpack_require__(10);
|
|
232
|
+
const swagger_1 = __webpack_require__(6);
|
|
233
|
+
let NestVertexController = NestVertexController_1 = class NestVertexController {
|
|
234
|
+
nestVertexService;
|
|
235
|
+
logger = new common_1.Logger(NestVertexController_1.name);
|
|
236
|
+
constructor(nestVertexService) {
|
|
237
|
+
this.nestVertexService = nestVertexService;
|
|
238
|
+
}
|
|
239
|
+
async generateVideo(generateVideoDto) {
|
|
240
|
+
this.logger.log(`Received request to generate video: ${JSON.stringify(generateVideoDto)}`);
|
|
241
|
+
try {
|
|
242
|
+
const operation = await this.nestVertexService.startVideoGeneration(generateVideoDto);
|
|
243
|
+
return { operationName: operation.name };
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
this.logger.error('Error in generateVideo endpoint:', error);
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async getVideoStatus(operationName) {
|
|
251
|
+
this.logger.log(`Received request to check status for operation: ${operationName}`);
|
|
252
|
+
try {
|
|
253
|
+
return await this.nestVertexService.checkVideoOperationStatus(operationName);
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
this.logger.error(`Error checking status for operation ${operationName}:`, error);
|
|
257
|
+
throw error;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async generateImage(generateImageDto) {
|
|
261
|
+
this.logger.log(`Received request to generate image: ${JSON.stringify(generateImageDto)}`);
|
|
262
|
+
try {
|
|
263
|
+
const response = await this.nestVertexService.startImageGeneration(generateImageDto);
|
|
264
|
+
return response;
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
this.logger.error('Error in generateImage endpoint:', error);
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
exports.NestVertexController = NestVertexController;
|
|
273
|
+
__decorate([
|
|
274
|
+
(0, common_1.Post)('generate-video'),
|
|
275
|
+
openapi.ApiResponse({ status: 201 }),
|
|
276
|
+
__param(0, (0, common_1.Body)(new common_1.ValidationPipe({ transform: true, whitelist: true }))),
|
|
277
|
+
__metadata("design:type", Function),
|
|
278
|
+
__metadata("design:paramtypes", [generate_video_dto_1.GenerateVideoDto]),
|
|
279
|
+
__metadata("design:returntype", Promise)
|
|
280
|
+
], NestVertexController.prototype, "generateVideo", null);
|
|
281
|
+
__decorate([
|
|
282
|
+
(0, common_1.Get)('video-status/:operationName'),
|
|
283
|
+
openapi.ApiResponse({ status: 200, type: Object }),
|
|
284
|
+
__param(0, (0, common_1.Param)('operationName')),
|
|
285
|
+
__metadata("design:type", Function),
|
|
286
|
+
__metadata("design:paramtypes", [String]),
|
|
287
|
+
__metadata("design:returntype", Promise)
|
|
288
|
+
], NestVertexController.prototype, "getVideoStatus", null);
|
|
289
|
+
__decorate([
|
|
290
|
+
(0, common_1.Post)('generate-image'),
|
|
291
|
+
openapi.ApiResponse({ status: 201 }),
|
|
292
|
+
__param(0, (0, common_1.Body)(new common_1.ValidationPipe({ transform: true, whitelist: true }))),
|
|
293
|
+
__metadata("design:type", Function),
|
|
294
|
+
__metadata("design:paramtypes", [generate_image_dto_1.GenerateImageDto]),
|
|
295
|
+
__metadata("design:returntype", Promise)
|
|
296
|
+
], NestVertexController.prototype, "generateImage", null);
|
|
297
|
+
exports.NestVertexController = NestVertexController = NestVertexController_1 = __decorate([
|
|
298
|
+
(0, swagger_1.ApiTags)('Vertex Image/video'),
|
|
299
|
+
(0, common_1.Controller)('api/vertex'),
|
|
300
|
+
__metadata("design:paramtypes", [nest_vertex_service_1.NestVertexService])
|
|
301
|
+
], NestVertexController);
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
/***/ }),
|
|
305
|
+
/* 6 */
|
|
306
|
+
/***/ ((module) => {
|
|
307
|
+
|
|
308
|
+
module.exports = require("@nestjs/swagger");
|
|
309
|
+
|
|
310
|
+
/***/ }),
|
|
311
|
+
/* 7 */
|
|
312
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
316
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
317
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
318
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
319
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
320
|
+
};
|
|
321
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
322
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
323
|
+
};
|
|
324
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
325
|
+
exports.GenerateVideoDto = void 0;
|
|
326
|
+
const openapi = __webpack_require__(6);
|
|
327
|
+
const class_validator_1 = __webpack_require__(8);
|
|
328
|
+
const class_transformer_1 = __webpack_require__(9);
|
|
329
|
+
class ImageInputDto {
|
|
330
|
+
bytesBase64Encoded;
|
|
331
|
+
gcsUri;
|
|
332
|
+
mimeType;
|
|
333
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
334
|
+
return { bytesBase64Encoded: { required: false, type: () => String, format: "base64" }, gcsUri: { required: false, type: () => String, pattern: "/^gs:\\/\\/.+/" }, mimeType: { required: true, type: () => String } };
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
__decorate([
|
|
338
|
+
(0, class_validator_1.IsOptional)(),
|
|
339
|
+
(0, class_validator_1.IsBase64)(),
|
|
340
|
+
(0, class_validator_1.ValidateIf)((o) => !o.gcsUri),
|
|
341
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Either bytesBase64Encoded or gcsUri must be provided in image object' }),
|
|
342
|
+
__metadata("design:type", String)
|
|
343
|
+
], ImageInputDto.prototype, "bytesBase64Encoded", void 0);
|
|
344
|
+
__decorate([
|
|
345
|
+
(0, class_validator_1.IsOptional)(),
|
|
346
|
+
(0, class_validator_1.IsString)(),
|
|
347
|
+
(0, class_validator_1.Matches)(/^gs:\/\/.+/, { message: 'gcsUri must be a valid Cloud Storage URI (gs://...)' }),
|
|
348
|
+
(0, class_validator_1.ValidateIf)((o) => !o.bytesBase64Encoded),
|
|
349
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'Either bytesBase64Encoded or gcsUri must be provided in image object' }),
|
|
350
|
+
__metadata("design:type", String)
|
|
351
|
+
], ImageInputDto.prototype, "gcsUri", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
(0, class_validator_1.IsString)(),
|
|
354
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
355
|
+
__metadata("design:type", String)
|
|
356
|
+
], ImageInputDto.prototype, "mimeType", void 0);
|
|
357
|
+
class GenerateVideoDto {
|
|
358
|
+
prompt;
|
|
359
|
+
image;
|
|
360
|
+
durationSeconds = 8;
|
|
361
|
+
aspectRatio = '16:9';
|
|
362
|
+
negativePrompt;
|
|
363
|
+
personGeneration = 'allow_adult';
|
|
364
|
+
sampleCount = 1;
|
|
365
|
+
seed;
|
|
366
|
+
storageUri;
|
|
367
|
+
enhancePrompt = true;
|
|
368
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
369
|
+
return { prompt: { required: false, type: () => String }, image: { required: false, type: () => ImageInputDto }, durationSeconds: { required: true, type: () => Number, default: 8, minimum: 5, maximum: 8 }, aspectRatio: { required: false, type: () => String, default: "16:9" }, negativePrompt: { required: false, type: () => String }, personGeneration: { required: false, type: () => String, default: "allow_adult" }, sampleCount: { required: false, type: () => Number, default: 1, minimum: 1, maximum: 4 }, seed: { required: false, type: () => Number, minimum: 0, maximum: 4294967295 }, storageUri: { required: false, type: () => String, pattern: "/^gs:\\/\\/.+\\/.+/" }, enhancePrompt: { required: false, type: () => Boolean, default: true } };
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
exports.GenerateVideoDto = GenerateVideoDto;
|
|
373
|
+
__decorate([
|
|
374
|
+
(0, class_validator_1.IsOptional)(),
|
|
375
|
+
(0, class_validator_1.IsString)(),
|
|
376
|
+
(0, class_validator_1.ValidateIf)((o) => !o.image),
|
|
377
|
+
(0, class_validator_1.IsNotEmpty)({ message: 'prompt is required if image is not provided' }),
|
|
378
|
+
__metadata("design:type", String)
|
|
379
|
+
], GenerateVideoDto.prototype, "prompt", void 0);
|
|
380
|
+
__decorate([
|
|
381
|
+
(0, class_validator_1.IsOptional)(),
|
|
382
|
+
(0, class_validator_1.ValidateNested)(),
|
|
383
|
+
(0, class_transformer_1.Type)(() => ImageInputDto),
|
|
384
|
+
__metadata("design:type", ImageInputDto)
|
|
385
|
+
], GenerateVideoDto.prototype, "image", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
(0, class_validator_1.IsInt)(),
|
|
388
|
+
(0, class_validator_1.Min)(5),
|
|
389
|
+
(0, class_validator_1.Max)(8),
|
|
390
|
+
__metadata("design:type", Number)
|
|
391
|
+
], GenerateVideoDto.prototype, "durationSeconds", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
(0, class_validator_1.IsOptional)(),
|
|
394
|
+
(0, class_validator_1.IsEnum)(['16:9', '9:16'], { message: 'aspectRatio must be either "16:9" or "9:16"' }),
|
|
395
|
+
__metadata("design:type", String)
|
|
396
|
+
], GenerateVideoDto.prototype, "aspectRatio", void 0);
|
|
397
|
+
__decorate([
|
|
398
|
+
(0, class_validator_1.IsOptional)(),
|
|
399
|
+
(0, class_validator_1.IsString)(),
|
|
400
|
+
__metadata("design:type", String)
|
|
401
|
+
], GenerateVideoDto.prototype, "negativePrompt", void 0);
|
|
402
|
+
__decorate([
|
|
403
|
+
(0, class_validator_1.IsOptional)(),
|
|
404
|
+
(0, class_validator_1.IsEnum)(['allow_adult', 'disallow'], { message: 'personGeneration must be either "allow_adult" or "disallow"' }),
|
|
405
|
+
__metadata("design:type", String)
|
|
406
|
+
], GenerateVideoDto.prototype, "personGeneration", void 0);
|
|
407
|
+
__decorate([
|
|
408
|
+
(0, class_validator_1.IsOptional)(),
|
|
409
|
+
(0, class_validator_1.IsInt)(),
|
|
410
|
+
(0, class_validator_1.Min)(1),
|
|
411
|
+
(0, class_validator_1.Max)(4),
|
|
412
|
+
__metadata("design:type", Number)
|
|
413
|
+
], GenerateVideoDto.prototype, "sampleCount", void 0);
|
|
414
|
+
__decorate([
|
|
415
|
+
(0, class_validator_1.IsOptional)(),
|
|
416
|
+
(0, class_validator_1.IsInt)(),
|
|
417
|
+
(0, class_validator_1.Min)(0),
|
|
418
|
+
(0, class_validator_1.Max)(4294967295),
|
|
419
|
+
__metadata("design:type", Number)
|
|
420
|
+
], GenerateVideoDto.prototype, "seed", void 0);
|
|
421
|
+
__decorate([
|
|
422
|
+
(0, class_validator_1.IsOptional)(),
|
|
423
|
+
(0, class_validator_1.IsString)(),
|
|
424
|
+
(0, class_validator_1.Matches)(/^gs:\/\/.+\/.+/, { message: 'storageUri must be a valid Cloud Storage URI (gs://BUCKET_NAME/SUBDIRECTORY)' }),
|
|
425
|
+
__metadata("design:type", String)
|
|
426
|
+
], GenerateVideoDto.prototype, "storageUri", void 0);
|
|
427
|
+
__decorate([
|
|
428
|
+
(0, class_validator_1.IsOptional)(),
|
|
429
|
+
(0, class_validator_1.IsBoolean)(),
|
|
430
|
+
__metadata("design:type", Boolean)
|
|
431
|
+
], GenerateVideoDto.prototype, "enhancePrompt", void 0);
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
/***/ }),
|
|
435
|
+
/* 8 */
|
|
436
|
+
/***/ ((module) => {
|
|
437
|
+
|
|
438
|
+
module.exports = require("class-validator");
|
|
439
|
+
|
|
440
|
+
/***/ }),
|
|
441
|
+
/* 9 */
|
|
442
|
+
/***/ ((module) => {
|
|
443
|
+
|
|
444
|
+
module.exports = require("class-transformer");
|
|
445
|
+
|
|
446
|
+
/***/ }),
|
|
447
|
+
/* 10 */
|
|
448
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
452
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
453
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
454
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
455
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
456
|
+
};
|
|
457
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
458
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
459
|
+
};
|
|
460
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
461
|
+
exports.GenerateImageDto = void 0;
|
|
462
|
+
const openapi = __webpack_require__(6);
|
|
463
|
+
const class_validator_1 = __webpack_require__(8);
|
|
464
|
+
class GenerateImageDto {
|
|
465
|
+
prompt;
|
|
466
|
+
numberOfImages = 1;
|
|
467
|
+
aspectRatio = '1:1';
|
|
468
|
+
negativePrompt;
|
|
469
|
+
seed;
|
|
470
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
471
|
+
return { prompt: { required: true, type: () => String }, numberOfImages: { required: false, type: () => Number, default: 1, minimum: 1, maximum: 8 }, aspectRatio: { required: false, type: () => String, default: "1:1" }, negativePrompt: { required: false, type: () => String }, seed: { required: false, type: () => Number, minimum: 0, maximum: 4294967295 } };
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
exports.GenerateImageDto = GenerateImageDto;
|
|
475
|
+
__decorate([
|
|
476
|
+
(0, class_validator_1.IsString)(),
|
|
477
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
478
|
+
__metadata("design:type", String)
|
|
479
|
+
], GenerateImageDto.prototype, "prompt", void 0);
|
|
480
|
+
__decorate([
|
|
481
|
+
(0, class_validator_1.IsOptional)(),
|
|
482
|
+
(0, class_validator_1.IsInt)(),
|
|
483
|
+
(0, class_validator_1.Min)(1),
|
|
484
|
+
(0, class_validator_1.Max)(8),
|
|
485
|
+
__metadata("design:type", Number)
|
|
486
|
+
], GenerateImageDto.prototype, "numberOfImages", void 0);
|
|
487
|
+
__decorate([
|
|
488
|
+
(0, class_validator_1.IsOptional)(),
|
|
489
|
+
(0, class_validator_1.IsEnum)(['1:1', '16:9', '9:16', '3:4', '4:3'], { message: 'aspectRatio must be one of "1:1", "16:9", "9:16", "3:4", "4:3"' }),
|
|
490
|
+
__metadata("design:type", String)
|
|
491
|
+
], GenerateImageDto.prototype, "aspectRatio", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
(0, class_validator_1.IsOptional)(),
|
|
494
|
+
(0, class_validator_1.IsString)(),
|
|
495
|
+
__metadata("design:type", String)
|
|
496
|
+
], GenerateImageDto.prototype, "negativePrompt", void 0);
|
|
497
|
+
__decorate([
|
|
498
|
+
(0, class_validator_1.IsOptional)(),
|
|
499
|
+
(0, class_validator_1.IsInt)(),
|
|
500
|
+
(0, class_validator_1.Min)(0),
|
|
501
|
+
(0, class_validator_1.Max)(4294967295),
|
|
502
|
+
__metadata("design:type", Number)
|
|
503
|
+
], GenerateImageDto.prototype, "seed", void 0);
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
/***/ }),
|
|
507
|
+
/* 11 */
|
|
508
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
512
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
513
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
514
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
515
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
516
|
+
};
|
|
517
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
518
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
519
|
+
};
|
|
520
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
521
|
+
exports.NestTtsService = void 0;
|
|
522
|
+
const common_1 = __webpack_require__(2);
|
|
523
|
+
const text_to_speech_1 = __webpack_require__(12);
|
|
524
|
+
let NestTtsService = class NestTtsService {
|
|
525
|
+
logger = new common_1.Logger('VertexTtsService');
|
|
526
|
+
client;
|
|
527
|
+
constructor() {
|
|
528
|
+
this.client = new text_to_speech_1.TextToSpeechClient();
|
|
529
|
+
this.logger.log('Google TextToSpeechClient initialized.');
|
|
530
|
+
}
|
|
531
|
+
getHello() {
|
|
532
|
+
return 'Hello from VertexTtsService!';
|
|
533
|
+
}
|
|
534
|
+
async synthesizeSpeech(input) {
|
|
535
|
+
const { text, languageCode, ssmlGender = 'NEUTRAL', voiceName, voice, audioEncoding = 'MP3', speedRate, } = input;
|
|
536
|
+
const voiceId = voiceName || voice;
|
|
537
|
+
console.log('Selected voice:', voiceId);
|
|
538
|
+
const langCode = !languageCode ? voiceId.slice(0, 5) : languageCode;
|
|
539
|
+
const request = {
|
|
540
|
+
input: { text: text },
|
|
541
|
+
voice: voiceId ? { name: voiceId, languageCode: langCode } : { languageCode: langCode, ssmlGender: ssmlGender },
|
|
542
|
+
audioConfig: {
|
|
543
|
+
audioEncoding: audioEncoding,
|
|
544
|
+
speakingRate: speedRate,
|
|
545
|
+
},
|
|
546
|
+
};
|
|
547
|
+
this.logger.log(`Synthesizing speech for text: "${text.substring(0, 50)}..."`);
|
|
548
|
+
try {
|
|
549
|
+
console.log('request', request);
|
|
550
|
+
const [response] = await this.client.synthesizeSpeech(request);
|
|
551
|
+
if (response.audioContent instanceof Uint8Array) {
|
|
552
|
+
this.logger.log('Speech synthesis successful.');
|
|
553
|
+
return Buffer.from(response.audioContent);
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
this.logger.warn('No audio content received from TTS API.');
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
catch (error) {
|
|
561
|
+
this.logger.error('Error synthesizing speech:', error);
|
|
562
|
+
throw new Error(`Failed to synthesize speech: ${error.message}`);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
async listVoices(languageCode) {
|
|
566
|
+
const request = {};
|
|
567
|
+
if (languageCode) {
|
|
568
|
+
request.languageCode = languageCode;
|
|
569
|
+
this.logger.log(`Fetching list of available voices for language: ${languageCode}...`);
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
this.logger.log('Fetching list of all available voices...');
|
|
573
|
+
}
|
|
574
|
+
try {
|
|
575
|
+
const [response] = await this.client.listVoices(request);
|
|
576
|
+
if (response.voices) {
|
|
577
|
+
const count = response.voices.length;
|
|
578
|
+
this.logger.log(`Successfully fetched ${count} voice${count === 1 ? '' : 's'}${languageCode ? ` for language ${languageCode}` : ''}.`);
|
|
579
|
+
return response.voices;
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
this.logger.warn('No voices received from TTS API.');
|
|
583
|
+
return [];
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
this.logger.error('Error listing voices:', error);
|
|
588
|
+
throw new Error(`Failed to list voices: ${error.message}`);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
exports.NestTtsService = NestTtsService;
|
|
593
|
+
exports.NestTtsService = NestTtsService = __decorate([
|
|
594
|
+
(0, common_1.Injectable)(),
|
|
595
|
+
__metadata("design:paramtypes", [])
|
|
596
|
+
], NestTtsService);
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
/***/ }),
|
|
600
|
+
/* 12 */
|
|
601
|
+
/***/ ((module) => {
|
|
602
|
+
|
|
603
|
+
module.exports = require("@google-cloud/text-to-speech");
|
|
604
|
+
|
|
605
|
+
/***/ }),
|
|
606
|
+
/* 13 */
|
|
607
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
611
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
612
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
613
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
614
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
615
|
+
};
|
|
616
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
617
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
618
|
+
};
|
|
619
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
620
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
621
|
+
};
|
|
622
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
623
|
+
exports.NestTtsController = void 0;
|
|
624
|
+
const openapi = __webpack_require__(6);
|
|
625
|
+
const common_1 = __webpack_require__(2);
|
|
626
|
+
const swagger_1 = __webpack_require__(6);
|
|
627
|
+
const nest_tts_service_1 = __webpack_require__(11);
|
|
628
|
+
let NestTtsController = class NestTtsController {
|
|
629
|
+
nestTtsService;
|
|
630
|
+
logger = new common_1.Logger('VertexTtsController');
|
|
631
|
+
constructor(nestTtsService) {
|
|
632
|
+
this.nestTtsService = nestTtsService;
|
|
633
|
+
}
|
|
634
|
+
ping() {
|
|
635
|
+
this.logger.log('Received ping request');
|
|
636
|
+
return this.nestTtsService.getHello();
|
|
637
|
+
}
|
|
638
|
+
async synthesizeSpeech(body, res) {
|
|
639
|
+
console.log('Received synthesize request', body);
|
|
640
|
+
this.logger.log(`Received synthesize request for text: "${body.text.substring(0, 50)}..."`);
|
|
641
|
+
try {
|
|
642
|
+
const audioBuffer = await this.nestTtsService.synthesizeSpeech(body);
|
|
643
|
+
if (!audioBuffer) {
|
|
644
|
+
this.logger.error('Synthesis resulted in null buffer');
|
|
645
|
+
throw new common_1.NotFoundException('Could not generate audio for the given input.');
|
|
646
|
+
}
|
|
647
|
+
res.header('Content-Length', audioBuffer.length.toString());
|
|
648
|
+
this.logger.log(`Successfully synthesized audio (${audioBuffer.length} bytes)`);
|
|
649
|
+
return audioBuffer;
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
this.logger.error(`Synthesis failed: ${error.message}`, error.stack);
|
|
653
|
+
throw new common_1.InternalServerErrorException(`Speech synthesis failed: ${error.message}`);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
async listVoices(languageCode) {
|
|
657
|
+
this.logger.log(`Received request to list voices${languageCode ? ` for language ${languageCode}` : ''}`);
|
|
658
|
+
try {
|
|
659
|
+
const voices = await this.nestTtsService.listVoices(languageCode);
|
|
660
|
+
this.logger.log(`Returning ${voices.length} voice${voices.length === 1 ? '' : 's'}.`);
|
|
661
|
+
return voices;
|
|
662
|
+
}
|
|
663
|
+
catch (error) {
|
|
664
|
+
this.logger.error(`Failed to list voices: ${error.message}`, error.stack);
|
|
665
|
+
throw new common_1.InternalServerErrorException(`Failed to list voices: ${error.message}`);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
exports.NestTtsController = NestTtsController;
|
|
670
|
+
__decorate([
|
|
671
|
+
(0, common_1.Get)('ping'),
|
|
672
|
+
(0, swagger_1.ApiOperation)({ summary: 'Ping the TTS service' }),
|
|
673
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Service is available' }),
|
|
674
|
+
openapi.ApiResponse({ status: 200, type: String }),
|
|
675
|
+
__metadata("design:type", Function),
|
|
676
|
+
__metadata("design:paramtypes", []),
|
|
677
|
+
__metadata("design:returntype", String)
|
|
678
|
+
], NestTtsController.prototype, "ping", null);
|
|
679
|
+
__decorate([
|
|
680
|
+
(0, common_1.Post)('synthesize'),
|
|
681
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
682
|
+
(0, swagger_1.ApiOperation)({ summary: 'Synthesize speech from text' }),
|
|
683
|
+
(0, swagger_1.ApiBody)({
|
|
684
|
+
description: 'Text and configuration for speech synthesis',
|
|
685
|
+
schema: {
|
|
686
|
+
type: 'object',
|
|
687
|
+
properties: {
|
|
688
|
+
text: { type: 'string', example: 'Hello world' },
|
|
689
|
+
languageCode: { type: 'string', example: 'en-US', description: 'Optional language code (default: en-US)' },
|
|
690
|
+
ssmlGender: { type: 'string', example: 'NEUTRAL', description: 'Optional SSML gender (default: NEUTRAL)' },
|
|
691
|
+
voiceName: { type: 'string', example: 'en-US-Neural2-F', description: 'Optional specific voice name' },
|
|
692
|
+
audioEncoding: { type: 'string', example: 'MP3', description: 'Optional audio encoding (default: MP3)' },
|
|
693
|
+
},
|
|
694
|
+
required: ['text'],
|
|
695
|
+
},
|
|
696
|
+
}),
|
|
697
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Returns the synthesized audio file (e.g., MP3)' }),
|
|
698
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: 'Internal server error during synthesis' }),
|
|
699
|
+
(0, common_1.Header)('Content-Type', 'audio/mpeg'),
|
|
700
|
+
openapi.ApiResponse({ status: common_1.HttpStatus.OK, type: Object }),
|
|
701
|
+
__param(0, (0, common_1.Body)()),
|
|
702
|
+
__param(1, (0, common_1.Res)({ passthrough: true })),
|
|
703
|
+
__metadata("design:type", Function),
|
|
704
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
705
|
+
__metadata("design:returntype", Promise)
|
|
706
|
+
], NestTtsController.prototype, "synthesizeSpeech", null);
|
|
707
|
+
__decorate([
|
|
708
|
+
(0, common_1.Get)('voices'),
|
|
709
|
+
(0, swagger_1.ApiOperation)({ summary: 'List available TTS voices, optionally filtered by language' }),
|
|
710
|
+
(0, swagger_1.ApiQuery)({ name: 'languageCode', required: false, type: String, description: 'Optional language code (e.g., en-US) to filter voices' }),
|
|
711
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'Returns a list of available voices', type: [Object] }),
|
|
712
|
+
(0, swagger_1.ApiResponse)({ status: 500, description: 'Internal server error while fetching voices' }),
|
|
713
|
+
openapi.ApiResponse({ status: 200, type: [Object] }),
|
|
714
|
+
__param(0, (0, common_1.Query)('languageCode')),
|
|
715
|
+
__metadata("design:type", Function),
|
|
716
|
+
__metadata("design:paramtypes", [String]),
|
|
717
|
+
__metadata("design:returntype", Promise)
|
|
718
|
+
], NestTtsController.prototype, "listVoices", null);
|
|
719
|
+
exports.NestTtsController = NestTtsController = __decorate([
|
|
720
|
+
(0, swagger_1.ApiTags)('Vertex TTS'),
|
|
721
|
+
(0, common_1.Controller)('api/vertex/tts'),
|
|
722
|
+
__metadata("design:paramtypes", [nest_tts_service_1.NestTtsService])
|
|
723
|
+
], NestTtsController);
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
/***/ }),
|
|
727
|
+
/* 14 */
|
|
728
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
732
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
733
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
734
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
735
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
736
|
+
};
|
|
737
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
738
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
739
|
+
};
|
|
740
|
+
var GeminiChatService_1;
|
|
741
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
742
|
+
exports.GeminiChatService = exports.ChatMessageDict = exports.ChatRole = void 0;
|
|
743
|
+
const common_1 = __webpack_require__(2);
|
|
744
|
+
const genai_1 = __webpack_require__(4);
|
|
745
|
+
var ChatRole;
|
|
746
|
+
(function (ChatRole) {
|
|
747
|
+
ChatRole["System"] = "system";
|
|
748
|
+
ChatRole["User"] = "user";
|
|
749
|
+
ChatRole["Assistant"] = "assistant";
|
|
750
|
+
ChatRole["AssistantHelper"] = "assistantHelper";
|
|
751
|
+
})(ChatRole || (exports.ChatRole = ChatRole = {}));
|
|
752
|
+
class ChatMessageDict {
|
|
753
|
+
content;
|
|
754
|
+
role;
|
|
755
|
+
metadata;
|
|
756
|
+
}
|
|
757
|
+
exports.ChatMessageDict = ChatMessageDict;
|
|
758
|
+
let GeminiChatService = GeminiChatService_1 = class GeminiChatService {
|
|
759
|
+
logger = new common_1.Logger(GeminiChatService_1.name);
|
|
760
|
+
clientGenAi;
|
|
761
|
+
modelName = 'gemini-1.5-flash';
|
|
762
|
+
constructor() {
|
|
763
|
+
const apiKey = process.env.GEMINI_API_KEY;
|
|
764
|
+
if (!apiKey) {
|
|
765
|
+
throw new Error('GEMINI_API_KEY environment variable not set.');
|
|
766
|
+
}
|
|
767
|
+
this.clientGenAi = new genai_1.GoogleGenAI({ apiKey });
|
|
768
|
+
this.logger.log(`GeminiChatService initialized with model: ${this.modelName}`);
|
|
769
|
+
}
|
|
770
|
+
mapToGeminiRole(role) {
|
|
771
|
+
switch (role) {
|
|
772
|
+
case 'assistant':
|
|
773
|
+
return 'model';
|
|
774
|
+
case 'system':
|
|
775
|
+
this.logger.warn('System role encountered, will be extracted, not directly added to Gemini history.');
|
|
776
|
+
return 'user';
|
|
777
|
+
case 'user':
|
|
778
|
+
default:
|
|
779
|
+
return 'user';
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
formatMessagesToContent(messages) {
|
|
783
|
+
return messages
|
|
784
|
+
.filter((msg) => msg.role !== 'system' && typeof msg.content === 'string')
|
|
785
|
+
.map((msg) => ({
|
|
786
|
+
role: this.mapToGeminiRole(msg.role),
|
|
787
|
+
parts: [{ text: msg.content }],
|
|
788
|
+
}));
|
|
789
|
+
}
|
|
790
|
+
async chat(messages) {
|
|
791
|
+
if (!messages || messages.length === 0) {
|
|
792
|
+
return { content: '', role: ChatRole.Assistant, metadata: { finishReason: 'NO_INPUT' } };
|
|
793
|
+
}
|
|
794
|
+
const systemMessage = messages.find((msg) => msg.role === 'system')?.content;
|
|
795
|
+
if (systemMessage) {
|
|
796
|
+
}
|
|
797
|
+
let lastMessage = messages[messages.length - 1];
|
|
798
|
+
if (lastMessage.role !== 'user' || typeof lastMessage.content !== 'string') {
|
|
799
|
+
messages.push({ role: 'user', content: 'please say something to start/continue conversation' });
|
|
800
|
+
lastMessage = messages[messages.length - 1];
|
|
801
|
+
}
|
|
802
|
+
const formattedContents = this.formatMessagesToContent(messages);
|
|
803
|
+
try {
|
|
804
|
+
this.logger.debug(`Sending request to Gemini model ${this.modelName} with ${formattedContents.length} content parts and system instruction: ${!!systemMessage}`);
|
|
805
|
+
const response = await this.clientGenAi.models.generateContent({
|
|
806
|
+
model: this.modelName,
|
|
807
|
+
contents: formattedContents,
|
|
808
|
+
config: { systemInstruction: systemMessage },
|
|
809
|
+
});
|
|
810
|
+
this.logger.debug(`Received Gemini response text.`);
|
|
811
|
+
const responseText = response?.text ?? '';
|
|
812
|
+
return {
|
|
813
|
+
content: responseText,
|
|
814
|
+
role: ChatRole.Assistant,
|
|
815
|
+
metadata: {},
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
catch (error) {
|
|
819
|
+
this.logger.error(`Gemini chat.sendMessage failed: ${error.message}`, error.stack);
|
|
820
|
+
throw new Error(`Failed to get Gemini chat completion: ${error.message}`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
async chatStream(messages) {
|
|
824
|
+
if (!messages || messages.length === 0) {
|
|
825
|
+
this.logger.warn('Gemini chatStream called with empty messages.');
|
|
826
|
+
return (async function* () { })();
|
|
827
|
+
}
|
|
828
|
+
const systemMessage = messages.find((msg) => msg.role === 'system')?.content;
|
|
829
|
+
if (systemMessage) {
|
|
830
|
+
this.logger.log(`System prompt extracted for stream: "${systemMessage}"`);
|
|
831
|
+
}
|
|
832
|
+
const lastMessage = messages[messages.length - 1];
|
|
833
|
+
if (lastMessage.role !== 'user' || typeof lastMessage.content !== 'string') {
|
|
834
|
+
this.logger.error('The last message for streaming must be from the user and contain string content.');
|
|
835
|
+
throw new Error('The last message for streaming must be from the user and contain string content.');
|
|
836
|
+
}
|
|
837
|
+
const formattedContents = this.formatMessagesToContent(messages);
|
|
838
|
+
const processStream = async function* () {
|
|
839
|
+
try {
|
|
840
|
+
this.logger.debug(`Sending stream request to Gemini model ${this.modelName} with ${formattedContents.length} content parts and system instruction: ${!!systemMessage}`);
|
|
841
|
+
const stream = await this.ai.models.generateContentStream({
|
|
842
|
+
model: this.modelName,
|
|
843
|
+
contents: formattedContents,
|
|
844
|
+
config: { systemInstruction: systemMessage },
|
|
845
|
+
});
|
|
846
|
+
for await (const chunk of stream) {
|
|
847
|
+
const chunkText = chunk?.text ?? '';
|
|
848
|
+
if (chunkText) {
|
|
849
|
+
this.logger.debug(`Received Gemini stream chunk text.`);
|
|
850
|
+
yield {
|
|
851
|
+
content: chunkText,
|
|
852
|
+
role: ChatRole.Assistant,
|
|
853
|
+
metadata: {
|
|
854
|
+
isChunk: true,
|
|
855
|
+
},
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
this.logger.debug(`Gemini stream finished.`);
|
|
860
|
+
}
|
|
861
|
+
catch (error) {
|
|
862
|
+
this.logger.error(`Gemini generateContentStream failed: ${error.message}`, error.stack);
|
|
863
|
+
throw new Error(`Failed to get Gemini chat stream completion: ${error.message}`);
|
|
864
|
+
}
|
|
865
|
+
}.bind(this);
|
|
866
|
+
return processStream();
|
|
867
|
+
}
|
|
868
|
+
async listModels() {
|
|
869
|
+
return [
|
|
870
|
+
{ id: 'gemini-2.5-flash-preview-04-17' },
|
|
871
|
+
{ id: 'gemini-2.5-pro-preview-03-25' },
|
|
872
|
+
{ id: 'gemini-2.0-flash' },
|
|
873
|
+
{ id: 'gemini-2.0-flash-lite' },
|
|
874
|
+
{ id: 'gemini-2.0-flash-live-001' },
|
|
875
|
+
];
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
exports.GeminiChatService = GeminiChatService;
|
|
879
|
+
exports.GeminiChatService = GeminiChatService = GeminiChatService_1 = __decorate([
|
|
880
|
+
(0, common_1.Injectable)(),
|
|
881
|
+
__metadata("design:paramtypes", [])
|
|
882
|
+
], GeminiChatService);
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
/***/ }),
|
|
886
|
+
/* 15 */
|
|
887
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
891
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
892
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
893
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
894
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
895
|
+
};
|
|
896
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
897
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
898
|
+
};
|
|
899
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
900
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
901
|
+
};
|
|
902
|
+
var GeminiChatController_1;
|
|
903
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
904
|
+
exports.GeminiChatController = void 0;
|
|
905
|
+
const openapi = __webpack_require__(6);
|
|
906
|
+
const common_1 = __webpack_require__(2);
|
|
907
|
+
const gemini_chat_service_1 = __webpack_require__(14);
|
|
908
|
+
const swagger_1 = __webpack_require__(6);
|
|
909
|
+
let GeminiChatController = GeminiChatController_1 = class GeminiChatController {
|
|
910
|
+
geminiChatService;
|
|
911
|
+
logger = new common_1.Logger(GeminiChatController_1.name);
|
|
912
|
+
constructor(geminiChatService) {
|
|
913
|
+
this.geminiChatService = geminiChatService;
|
|
914
|
+
}
|
|
915
|
+
async generateText(messages) {
|
|
916
|
+
this.logger.log('Received request for text generation');
|
|
917
|
+
try {
|
|
918
|
+
const result = await this.geminiChatService.chat(messages);
|
|
919
|
+
return result;
|
|
920
|
+
}
|
|
921
|
+
catch (error) {
|
|
922
|
+
this.logger.error(`Error generating text: ${error.message}`, error.stack);
|
|
923
|
+
throw error;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
exports.GeminiChatController = GeminiChatController;
|
|
928
|
+
__decorate([
|
|
929
|
+
(0, common_1.Post)('generate-text'),
|
|
930
|
+
openapi.ApiResponse({ status: 201, type: (__webpack_require__(14).ChatMessageDict) }),
|
|
931
|
+
__param(0, (0, common_1.Body)()),
|
|
932
|
+
__metadata("design:type", Function),
|
|
933
|
+
__metadata("design:paramtypes", [Array]),
|
|
934
|
+
__metadata("design:returntype", Promise)
|
|
935
|
+
], GeminiChatController.prototype, "generateText", null);
|
|
936
|
+
exports.GeminiChatController = GeminiChatController = GeminiChatController_1 = __decorate([
|
|
937
|
+
(0, swagger_1.ApiTags)('Vertex Gemini'),
|
|
938
|
+
(0, common_1.Controller)('api/vertex/gemini'),
|
|
939
|
+
__metadata("design:paramtypes", [gemini_chat_service_1.GeminiChatService])
|
|
940
|
+
], GeminiChatController);
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
/***/ })
|
|
944
|
+
/******/ ]);
|
|
945
|
+
/************************************************************************/
|
|
946
|
+
/******/ // The module cache
|
|
947
|
+
/******/ var __webpack_module_cache__ = {};
|
|
948
|
+
/******/
|
|
949
|
+
/******/ // The require function
|
|
950
|
+
/******/ function __webpack_require__(moduleId) {
|
|
951
|
+
/******/ // Check if module is in cache
|
|
952
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
953
|
+
/******/ if (cachedModule !== undefined) {
|
|
954
|
+
/******/ return cachedModule.exports;
|
|
955
|
+
/******/ }
|
|
956
|
+
/******/ // Create a new module (and put it into the cache)
|
|
957
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
958
|
+
/******/ // no module.id needed
|
|
959
|
+
/******/ // no module.loaded needed
|
|
960
|
+
/******/ exports: {}
|
|
961
|
+
/******/ };
|
|
962
|
+
/******/
|
|
963
|
+
/******/ // Execute the module function
|
|
964
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
965
|
+
/******/
|
|
966
|
+
/******/ // Return the exports of the module
|
|
967
|
+
/******/ return module.exports;
|
|
968
|
+
/******/ }
|
|
969
|
+
/******/
|
|
970
|
+
/************************************************************************/
|
|
971
|
+
/******/
|
|
972
|
+
/******/ // startup
|
|
973
|
+
/******/ // Load entry module and return exports
|
|
974
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
975
|
+
/******/ var __webpack_exports__ = __webpack_require__(0);
|
|
976
|
+
/******/
|
|
977
|
+
/******/ })()
|
|
978
|
+
;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataclouder/nest-vertex",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "NestJS Vertex AI library for Dataclouder",
|
|
5
5
|
"author": "dataclouder",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"main": "
|
|
8
|
-
"types": "
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"**/*.js",
|
|
11
|
+
"**/*.d.ts"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc -p tsconfig.lib.json",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChatCompletionMessageParam } from 'groq-sdk/resources/chat/completions';
|
|
2
|
+
export declare enum ChatRole {
|
|
3
|
+
System = "system",
|
|
4
|
+
User = "user",
|
|
5
|
+
Assistant = "assistant",
|
|
6
|
+
AssistantHelper = "assistantHelper"
|
|
7
|
+
}
|
|
8
|
+
export declare class ChatMessageDict {
|
|
9
|
+
content: string;
|
|
10
|
+
role: ChatRole;
|
|
11
|
+
metadata?: any;
|
|
12
|
+
}
|
|
13
|
+
export declare class GeminiChatService {
|
|
14
|
+
private readonly logger;
|
|
15
|
+
private readonly clientGenAi;
|
|
16
|
+
private readonly modelName;
|
|
17
|
+
constructor();
|
|
18
|
+
private mapToGeminiRole;
|
|
19
|
+
private formatMessagesToContent;
|
|
20
|
+
chat(messages: ChatCompletionMessageParam[]): Promise<ChatMessageDict>;
|
|
21
|
+
chatStream(messages: ChatCompletionMessageParam[]): Promise<AsyncIterable<ChatMessageDict>>;
|
|
22
|
+
listModels(): Promise<Record<string, string>[]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { google } from '@google-cloud/text-to-speech/build/protos/protos';
|
|
2
|
+
export interface SynthesizeSpeechInput {
|
|
3
|
+
text: string;
|
|
4
|
+
languageCode?: string;
|
|
5
|
+
ssmlGender?: google.cloud.texttospeech.v1.SsmlVoiceGender;
|
|
6
|
+
voiceName?: string;
|
|
7
|
+
voice?: string;
|
|
8
|
+
audioEncoding?: google.cloud.texttospeech.v1.AudioEncoding;
|
|
9
|
+
generateTranscription?: boolean;
|
|
10
|
+
speed?: string;
|
|
11
|
+
speedRate?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class NestTtsService {
|
|
14
|
+
private readonly logger;
|
|
15
|
+
private client;
|
|
16
|
+
constructor();
|
|
17
|
+
getHello(): string;
|
|
18
|
+
synthesizeSpeech(input: SynthesizeSpeechInput): Promise<Buffer | null>;
|
|
19
|
+
listVoices(languageCode?: string): Promise<google.cloud.texttospeech.v1.IVoice[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { GenerateVideosOperation, GenerateImagesResponse } from '@google/genai';
|
|
3
|
+
import { GenerateVideoDto } from '../dto/generate-video.dto';
|
|
4
|
+
import { GenerateImageDto } from '../dto/generate-image.dto';
|
|
5
|
+
export declare class NestVertexService implements OnModuleInit {
|
|
6
|
+
private genAi;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
private readonly videoModelName;
|
|
9
|
+
private readonly imageModelName;
|
|
10
|
+
onModuleInit(): void;
|
|
11
|
+
startVideoGeneration(generateVideoDto: GenerateVideoDto): Promise<GenerateVideosOperation>;
|
|
12
|
+
checkVideoOperationStatus(operationName: string): Promise<GenerateVideosOperation>;
|
|
13
|
+
startImageGeneration(generateImageDto: GenerateImageDto): Promise<GenerateImagesResponse>;
|
|
14
|
+
}
|