@purpleschool/gptbot-tools 0.0.66 → 0.0.68
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/build/common/errors/errors.js +89 -0
- package/build/presentation/commands/build-blank-slide.command.js +15 -0
- package/build/presentation/commands/generate-and-insert-slide.command.js +22 -0
- package/build/presentation/commands/index.js +7 -0
- package/build/presentation/commands/presentation-generate-report.command.js +18 -0
- package/build/presentation/commands/presentation-paraphrase.command.js +19 -0
- package/build/presentation/commands/update-presentation-slides.command.js +16 -0
- package/build/presentation/commands/update-slide-image-slot.command.js +34 -0
- package/build/presentation/commands/update-slide.command.js +17 -0
- package/build/presentation/enums/index.js +4 -0
- package/build/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
- package/build/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
- package/build/presentation/enums/presentation-ai-action-type.enum.js +8 -0
- package/build/presentation/enums/slide-image-slot-action.enum.js +8 -0
- package/build/presentation/index.js +1 -0
- package/build/presentation/models/index.js +1 -0
- package/build/presentation/models/presentation-ai-action.schema.js +27 -0
- package/build/presentation/models/presentation-config.schema.js +3 -0
- package/build/presentation/models/presentation.schema.js +4 -1
- package/build/presentation/models/slide-content-edit.schema.js +135 -0
- package/build/presentation/models/slide-content.schema.js +5 -1
- package/build/presentation/models/slide.schema.js +39 -1
- package/build/presentation/routes/presentation.routes.js +7 -0
- package/build/presentation/utils/calculate-presentation-ai-action-price.util.js +16 -0
- package/build/presentation/utils/index.js +17 -0
- package/build/tools/enums/tool-type.enum.js +1 -0
- package/build/video/enums/index.js +1 -0
- package/build/video/enums/video-generation-model-limitation.enum.js +7 -0
- package/build/video/models/video-model.schema.js +1 -0
- package/build/video-editor/enums/index.js +1 -0
- package/build/video-editor/enums/video-editor-model-limitation.enum.js +7 -0
- package/build/video-editor/models/video-editor-model.schema.js +2 -1
- package/build/video-editor/utils/calculate-video-editing-price.js +2 -6
- package/build/writer/queries/find-writer-documents.query.js +1 -1
- package/common/errors/errors.ts +89 -0
- package/package.json +1 -1
- package/presentation/commands/build-blank-slide.command.ts +15 -0
- package/presentation/commands/generate-and-insert-slide.command.ts +22 -0
- package/presentation/commands/index.ts +7 -0
- package/presentation/commands/presentation-generate-report.command.ts +20 -0
- package/presentation/commands/presentation-paraphrase.command.ts +21 -0
- package/presentation/commands/update-presentation-slides.command.ts +16 -0
- package/presentation/commands/update-slide-image-slot.command.ts +39 -0
- package/presentation/commands/update-slide.command.ts +17 -0
- package/presentation/enums/index.ts +4 -0
- package/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
- package/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
- package/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
- package/presentation/enums/slide-image-slot-action.enum.ts +4 -0
- package/presentation/index.ts +1 -0
- package/presentation/models/index.ts +1 -0
- package/presentation/models/presentation-ai-action.schema.ts +30 -0
- package/presentation/models/presentation-config.schema.ts +3 -0
- package/presentation/models/presentation.schema.ts +4 -1
- package/presentation/models/slide-content-edit.schema.ts +160 -0
- package/presentation/models/slide-content.schema.ts +104 -11
- package/presentation/models/slide-image-slot.schema.ts +1 -0
- package/presentation/models/slide.schema.ts +47 -0
- package/presentation/routes/presentation.routes.ts +7 -0
- package/presentation/utils/calculate-presentation-ai-action-price.util.ts +20 -0
- package/presentation/utils/index.ts +1 -0
- package/tools/enums/tool-type.enum.ts +1 -0
- package/video/enums/index.ts +1 -0
- package/video/enums/video-generation-model-limitation.enum.ts +3 -0
- package/video/models/video-model.schema.ts +6 -1
- package/video-editor/enums/index.ts +1 -0
- package/video-editor/enums/video-editor-model-limitation.enum.ts +3 -0
- package/video-editor/models/video-editor-model.schema.ts +3 -2
- package/video-editor/utils/calculate-video-editing-price.ts +2 -11
- package/writer/queries/find-writer-documents.query.ts +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./calculate-presentation-ai-action-price.util"), exports);
|
|
@@ -8,6 +8,7 @@ var TOOL_TYPE;
|
|
|
8
8
|
TOOL_TYPE["VIDEO"] = "VIDEO";
|
|
9
9
|
TOOL_TYPE["AUDIO"] = "AUDIO";
|
|
10
10
|
TOOL_TYPE["PRESENTATION"] = "PRESENTATION";
|
|
11
|
+
TOOL_TYPE["PRESENTATION_AI_ACTION"] = "PRESENTATION_AI_ACTION";
|
|
11
12
|
TOOL_TYPE["WRITER"] = "WRITER";
|
|
12
13
|
TOOL_TYPE["PARAPHRASE"] = "PARAPHRASE";
|
|
13
14
|
TOOL_TYPE["WRITER_ACTION"] = "WRITER_ACTION";
|
|
@@ -23,3 +23,4 @@ __exportStar(require("./veo-person-allow.enum"), exports);
|
|
|
23
23
|
__exportStar(require("./veo-job-params-type.enum"), exports);
|
|
24
24
|
__exportStar(require("./video-resolution.enum"), exports);
|
|
25
25
|
__exportStar(require("./video-pricing-rule-type.enum"), exports);
|
|
26
|
+
__exportStar(require("./video-generation-model-limitation.enum"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VIDEO_GENERATION_MODEL_LIMITATION = void 0;
|
|
4
|
+
var VIDEO_GENERATION_MODEL_LIMITATION;
|
|
5
|
+
(function (VIDEO_GENERATION_MODEL_LIMITATION) {
|
|
6
|
+
VIDEO_GENERATION_MODEL_LIMITATION["ASPECT_RATIO_IGNORED_WITH_IMAGE_ATTACHED"] = "ASPECT_RATIO_IGNORED_WITH_IMAGE_ATTACHED";
|
|
7
|
+
})(VIDEO_GENERATION_MODEL_LIMITATION || (exports.VIDEO_GENERATION_MODEL_LIMITATION = VIDEO_GENERATION_MODEL_LIMITATION = {}));
|
|
@@ -46,6 +46,7 @@ exports.VideoModelSchema = zod_1.z.object({
|
|
|
46
46
|
maxInputLength: zod_1.z.number(),
|
|
47
47
|
params: exports.VideoModelParamsSchema,
|
|
48
48
|
pricingRules: exports.VideoModelPricingRulesSchema,
|
|
49
|
+
limitations: zod_1.z.array(zod_1.z.nativeEnum(enums_1.VIDEO_GENERATION_MODEL_LIMITATION)),
|
|
49
50
|
createdAt: zod_1.z.date(),
|
|
50
51
|
updatedAt: zod_1.z.date(),
|
|
51
52
|
});
|
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./video-editor-model-limitation.enum"), exports);
|
|
17
18
|
__exportStar(require("./video-editor-model-strategy.enum"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VIDEO_EDITOR_MODEL_LIMITATION = void 0;
|
|
4
|
+
var VIDEO_EDITOR_MODEL_LIMITATION;
|
|
5
|
+
(function (VIDEO_EDITOR_MODEL_LIMITATION) {
|
|
6
|
+
VIDEO_EDITOR_MODEL_LIMITATION["OUTPUT_VIDEO_LENGTH_CAPPED_TO_5_SECONDS"] = "OUTPUT_VIDEO_LENGTH_CAPPED_TO_5_SECONDS";
|
|
7
|
+
})(VIDEO_EDITOR_MODEL_LIMITATION || (exports.VIDEO_EDITOR_MODEL_LIMITATION = VIDEO_EDITOR_MODEL_LIMITATION = {}));
|
|
@@ -9,7 +9,6 @@ exports.VideoEditorModelSchema = zod_1.z.object({
|
|
|
9
9
|
title: zod_1.z.string(),
|
|
10
10
|
description: zod_1.z.string(),
|
|
11
11
|
aiModel: zod_1.z.string(),
|
|
12
|
-
pricePerSecond: zod_1.z.number(),
|
|
13
12
|
order: zod_1.z.number(),
|
|
14
13
|
status: zod_1.z.nativeEnum(common_1.TOOL_MODEL_STATUS),
|
|
15
14
|
icons: common_1.IconVariantsSchema,
|
|
@@ -19,6 +18,8 @@ exports.VideoEditorModelSchema = zod_1.z.object({
|
|
|
19
18
|
maxInputVideoDurationInSeconds: zod_1.z.number(),
|
|
20
19
|
supportedFormats: zod_1.z.array(zod_1.z.string()),
|
|
21
20
|
needsTranslation: zod_1.z.boolean(),
|
|
21
|
+
pricePerCall: zod_1.z.number(),
|
|
22
|
+
limitations: zod_1.z.array(zod_1.z.nativeEnum(enums_1.VIDEO_EDITOR_MODEL_LIMITATION)),
|
|
22
23
|
createdAt: zod_1.z.date(),
|
|
23
24
|
updatedAt: zod_1.z.date(),
|
|
24
25
|
});
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateVideoEditingPrice = calculateVideoEditingPrice;
|
|
4
|
-
function calculateVideoEditingPrice({
|
|
5
|
-
|
|
6
|
-
throw new Error('Duration must be positive');
|
|
7
|
-
if (pricePerSecond < 0)
|
|
8
|
-
throw new Error('Price per second cannot be negative');
|
|
9
|
-
return Math.ceil(duration * pricePerSecond);
|
|
4
|
+
function calculateVideoEditingPrice({ pricePerCall }) {
|
|
5
|
+
return pricePerCall;
|
|
10
6
|
}
|
|
@@ -9,7 +9,7 @@ var FindWriterDocumentsQuery;
|
|
|
9
9
|
FindWriterDocumentsQuery.RequestSchema = zod_1.z.object({
|
|
10
10
|
userId: zod_1.z.string().uuid().optional(),
|
|
11
11
|
unregisteredUserId: zod_1.z.string().uuid().optional(),
|
|
12
|
-
|
|
12
|
+
topic: zod_1.z.string().optional(),
|
|
13
13
|
limit: zod_1.z.coerce.number().min(1).optional(),
|
|
14
14
|
offset: zod_1.z.coerce.number().min(0).optional(),
|
|
15
15
|
});
|
package/common/errors/errors.ts
CHANGED
|
@@ -347,6 +347,95 @@ export const ERRORS = {
|
|
|
347
347
|
message: 'У пользователя недостаточно средств для генерации слайдов',
|
|
348
348
|
httpCode: 400,
|
|
349
349
|
},
|
|
350
|
+
CREATE_BLANK_SLIDE_ERROR: {
|
|
351
|
+
code: 'PRESENTATION.CREATE_BLANK_SLIDE_ERROR',
|
|
352
|
+
message: 'Произошла ошибка при создании пустого слайда',
|
|
353
|
+
httpCode: 500,
|
|
354
|
+
},
|
|
355
|
+
INVALID_CONTENT_TYPE_CHANGE: {
|
|
356
|
+
code: 'PRESENTATION.INVALID_CONTENT_TYPE_CHANGE',
|
|
357
|
+
message: 'Невозможно изменить тип существующего слайда',
|
|
358
|
+
httpCode: 400,
|
|
359
|
+
},
|
|
360
|
+
INVALID_SLIDE_POSITION: {
|
|
361
|
+
code: 'PRESENTATION.INVALID_SLIDE_POSITION',
|
|
362
|
+
message: 'Неверная позиция для вставки слайда',
|
|
363
|
+
httpCode: 400,
|
|
364
|
+
},
|
|
365
|
+
SLIDES_UPDATE_ERROR: {
|
|
366
|
+
code: 'PRESENTATION.SLIDES_UPDATE_ERROR',
|
|
367
|
+
message: 'Произошла ошибка при обновлении слайдов презентации',
|
|
368
|
+
httpCode: 500,
|
|
369
|
+
},
|
|
370
|
+
SLIDE_NOT_FOUND: {
|
|
371
|
+
code: 'PRESENTATION.SLIDE_NOT_FOUND',
|
|
372
|
+
message: 'Слайд не найден',
|
|
373
|
+
httpCode: 404,
|
|
374
|
+
},
|
|
375
|
+
SLIDE_IMAGE_SLOT_NOT_FOUND: {
|
|
376
|
+
code: 'PRESENTATION.SLIDE_IMAGE_SLOT_NOT_FOUND',
|
|
377
|
+
message: 'Слот изображения слайда не найден',
|
|
378
|
+
httpCode: 404,
|
|
379
|
+
},
|
|
380
|
+
SLIDE_IMAGE_UPDATE_ERROR: {
|
|
381
|
+
code: 'PRESENTATION.SLIDE_IMAGE_UPDATE_ERROR',
|
|
382
|
+
message: 'Произошла ошибка при обновлении слота изображения слайда',
|
|
383
|
+
httpCode: 500,
|
|
384
|
+
},
|
|
385
|
+
INSUFFICIENT_BALANCE_FOR_IMAGE_GENERATION: {
|
|
386
|
+
code: 'PRESENTATION.INSUFFICIENT_BALANCE_FOR_IMAGE_GENERATION',
|
|
387
|
+
message: 'У пользователя недостаточно средств для генерации изображения',
|
|
388
|
+
httpCode: 400,
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
PRESENTATION_AI_ACTION: {
|
|
392
|
+
NOT_FOUND: {
|
|
393
|
+
code: 'PRESENTATION_AI_ACTION.NOT_FOUND',
|
|
394
|
+
message: 'ИИ операция для презентации не найдено',
|
|
395
|
+
httpCode: 404,
|
|
396
|
+
},
|
|
397
|
+
PROMPT_TOO_LONG: {
|
|
398
|
+
code: 'PRESENTATION_AI_ACTION.PROMPT_TOO_LONG',
|
|
399
|
+
message: 'Превышена максимальная длина запроса',
|
|
400
|
+
httpCode: 400,
|
|
401
|
+
},
|
|
402
|
+
INSUFFICIENT_BALANCE: {
|
|
403
|
+
code: 'PRESENTATION_AI_ACTION.INSUFFICIENT_BALANCE',
|
|
404
|
+
message: 'У пользователя недостаточно средств для выполнения операции',
|
|
405
|
+
httpCode: 400,
|
|
406
|
+
},
|
|
407
|
+
AI_ERROR: {
|
|
408
|
+
code: 'PRESENTATION_AI_ACTION.AI_ERROR',
|
|
409
|
+
message: 'Произошла ошибка во время запроса к ИИ',
|
|
410
|
+
httpCode: 500,
|
|
411
|
+
},
|
|
412
|
+
SAVE_ERROR: {
|
|
413
|
+
code: 'PRESENTATION_AI_ACTION.SAVE_ERROR',
|
|
414
|
+
message: 'Произошла ошибка при сохранении ИИ операции для презентации',
|
|
415
|
+
httpCode: 500,
|
|
416
|
+
},
|
|
417
|
+
FIND_ERROR: {
|
|
418
|
+
code: 'PRESENTATION_AI_ACTION.FIND_ERROR',
|
|
419
|
+
message: 'Произошла ошибка при поиске ИИ операций для презентации',
|
|
420
|
+
httpCode: 500,
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
PRESENTATION_AI_ACTION_CALL: {
|
|
424
|
+
NOT_FOUND: {
|
|
425
|
+
code: 'PRESENTATION_AI_ACTION_CALL.NOT_FOUND',
|
|
426
|
+
message: 'Вызов ИИ операции для презентации не найден',
|
|
427
|
+
httpCode: 404,
|
|
428
|
+
},
|
|
429
|
+
SAVE_ERROR: {
|
|
430
|
+
code: 'PRESENTATION_AI_ACTION_CALL.SAVE_ERROR',
|
|
431
|
+
message: 'Произошла ошибка при сохранении вызова ИИ операции для презентации',
|
|
432
|
+
httpCode: 500,
|
|
433
|
+
},
|
|
434
|
+
FIND_ERROR: {
|
|
435
|
+
code: 'PRESENTATION_AI_ACTION_CALL.FIND_ERROR',
|
|
436
|
+
message: 'Произошла ошибка при поиске вызова ИИ операции для презентации',
|
|
437
|
+
httpCode: 500,
|
|
438
|
+
},
|
|
350
439
|
},
|
|
351
440
|
SLIDE_OUTLINE: {
|
|
352
441
|
DELETE_ERROR: {
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICommandResponseSchema } from '../../common';
|
|
2
|
+
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../enums';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { SlideSchema } from '../models';
|
|
5
|
+
|
|
6
|
+
export namespace BuildBlankSlideCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
slideContentType: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
9
|
+
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = ICommandResponseSchema(SlideSchema);
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../enums';
|
|
4
|
+
import { SlideSchema } from '../models';
|
|
5
|
+
|
|
6
|
+
export namespace GenerateAndInsertSlideCommand {
|
|
7
|
+
export const RequestSchema = z.object({
|
|
8
|
+
userId: z.string().uuid().nullable().optional(),
|
|
9
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
10
|
+
userBalance: z.number(),
|
|
11
|
+
presentationId: z.string().uuid(),
|
|
12
|
+
contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
13
|
+
prompt: z.string().min(1).max(1000).optional(),
|
|
14
|
+
title: z.string().max(80),
|
|
15
|
+
position: z.number().int().min(0),
|
|
16
|
+
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
17
|
+
});
|
|
18
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = ICommandResponseSchema(SlideSchema.array());
|
|
21
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
22
|
+
}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
export * from './build-blank-slide.command';
|
|
1
2
|
export * from './create-presentation.command';
|
|
2
3
|
export * from './delete-all-user-presentations.command';
|
|
3
4
|
export * from './delete-presentation.command';
|
|
4
5
|
export * from './delete-slide-outline.command';
|
|
5
6
|
export * from './generate-presentation-outline.command';
|
|
7
|
+
export * from './generate-and-insert-slide.command';
|
|
6
8
|
export * from './export-as-pptx.command';
|
|
7
9
|
export * from './generate-slides.command';
|
|
8
10
|
export * from './reposition-slide-outline.command';
|
|
9
11
|
export * from './update-slide-outline.command';
|
|
10
12
|
export * from './update-presentation.command';
|
|
11
13
|
export * from './update-presentation-outline.command';
|
|
14
|
+
export * from './update-presentation-slides.command';
|
|
15
|
+
export * from './update-slide-image-slot.command';
|
|
16
|
+
export * from './update-slide.command';
|
|
17
|
+
export * from './presentation-paraphrase.command';
|
|
18
|
+
export * from './presentation-generate-report.command';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
|
|
4
|
+
export namespace PresentationGenerateReportCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
presentationId: z.string().uuid(),
|
|
9
|
+
userBalance: z.number(),
|
|
10
|
+
});
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
14
|
+
z.object({
|
|
15
|
+
output: z.string(),
|
|
16
|
+
docxUrl: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
|
|
4
|
+
export namespace PresentationParaphraseCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
userId: z.string().uuid().nullable().optional(),
|
|
7
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
8
|
+
presentationId: z.string().uuid(),
|
|
9
|
+
slideId: z.string().uuid(),
|
|
10
|
+
selectionText: z.string(),
|
|
11
|
+
userBalance: z.number(),
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
16
|
+
z.object({
|
|
17
|
+
output: z.string(),
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideSchema, SlideBulkUpdateSchema } from '../models';
|
|
3
|
+
import { ICommandResponseSchema } from '../../common';
|
|
4
|
+
|
|
5
|
+
export namespace UpdatePresentationSlidesCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
presentationId: z.string().uuid(),
|
|
10
|
+
data: SlideBulkUpdateSchema,
|
|
11
|
+
});
|
|
12
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
13
|
+
|
|
14
|
+
export const ResponseSchema = ICommandResponseSchema(z.array(SlideSchema));
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ICommandResponseSchema } from '../../common';
|
|
3
|
+
import { SlideImageSlotSchema } from '../models';
|
|
4
|
+
import { SLIDE_IMAGE_SLOT_ACTION } from '../enums';
|
|
5
|
+
|
|
6
|
+
export namespace UpdateSlideImageSlotCommand {
|
|
7
|
+
const ReplacePayload = z.object({
|
|
8
|
+
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.REPLACE),
|
|
9
|
+
url: z.string().url(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const GeneratePayload = z.object({
|
|
13
|
+
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.GENERATE),
|
|
14
|
+
prompt: z.string().min(1).max(1000).optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const UpdateImageSlotPayload = z.discriminatedUnion('action', [
|
|
18
|
+
ReplacePayload,
|
|
19
|
+
GeneratePayload,
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export const RequestSchema = z.object({
|
|
23
|
+
userId: z.string().uuid().nullable().optional(),
|
|
24
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
25
|
+
presentationId: z.string().uuid(),
|
|
26
|
+
slideId: z.string().uuid(),
|
|
27
|
+
slotId: z.string().uuid().optional(),
|
|
28
|
+
payload: UpdateImageSlotPayload,
|
|
29
|
+
userBalance: z.number(),
|
|
30
|
+
});
|
|
31
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
32
|
+
|
|
33
|
+
export const ResponseSchema = ICommandResponseSchema(
|
|
34
|
+
z.object({
|
|
35
|
+
imageSlot: SlideImageSlotSchema,
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideSchema, SlideUpdateSchema } from '../models';
|
|
3
|
+
import { ICommandResponseSchema } from '../../common';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateSlideCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
userId: z.string().uuid().nullable().optional(),
|
|
8
|
+
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
9
|
+
presentationId: z.string().uuid(),
|
|
10
|
+
slideId: z.string().uuid(),
|
|
11
|
+
data: SlideUpdateSchema,
|
|
12
|
+
});
|
|
13
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
14
|
+
|
|
15
|
+
export const ResponseSchema = ICommandResponseSchema(SlideSchema);
|
|
16
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
+
}
|
|
@@ -4,3 +4,7 @@ export * from './slide-image-job-status.enum';
|
|
|
4
4
|
export * from './slide-image-slot-status.enum';
|
|
5
5
|
export * from './slide-icon-slot-status.enum';
|
|
6
6
|
export * from './slide-layout.enum';
|
|
7
|
+
export * from './slide-image-slot-action.enum';
|
|
8
|
+
export * from './presentation-ai-action-call-status.enum';
|
|
9
|
+
export * from './presentation-ai-action-type.enum';
|
|
10
|
+
export * from './presentation-ai-action-pricing-type.enum';
|
package/presentation/index.ts
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PRESENTATION_AI_ACTION_PRICING_TYPE, PRESENTATION_AI_ACTION_TYPE } from '../enums';
|
|
3
|
+
|
|
4
|
+
export const PresentationAiActionPricingRulesSchema = z.discriminatedUnion('type', [
|
|
5
|
+
z.object({
|
|
6
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
|
|
7
|
+
price: z.number(),
|
|
8
|
+
}),
|
|
9
|
+
z.object({
|
|
10
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT),
|
|
11
|
+
price: z.number(),
|
|
12
|
+
}),
|
|
13
|
+
]);
|
|
14
|
+
export type PresentationAiActionPricingRules = z.infer<
|
|
15
|
+
typeof PresentationAiActionPricingRulesSchema
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export const PresentationAiActionSchema = z.object({
|
|
19
|
+
uuid: z.string(),
|
|
20
|
+
type: z.nativeEnum(PRESENTATION_AI_ACTION_TYPE),
|
|
21
|
+
pricingRules: PresentationAiActionPricingRulesSchema,
|
|
22
|
+
maxPromptLength: z.number(),
|
|
23
|
+
aiModel: z.string(),
|
|
24
|
+
title: z.string(),
|
|
25
|
+
icon: z.string(),
|
|
26
|
+
order: z.number(),
|
|
27
|
+
createdAt: z.date(),
|
|
28
|
+
updatedAt: z.date(),
|
|
29
|
+
});
|
|
30
|
+
export type PresentationAiAction = z.infer<typeof PresentationAiActionSchema>;
|
|
@@ -2,16 +2,19 @@ import { z } from 'zod';
|
|
|
2
2
|
import { SlideContentTypeSchema } from './slide-content-type.schema';
|
|
3
3
|
import { LanguageSchema } from '../../language';
|
|
4
4
|
import { PresentationTemplateSchema } from './presentation-template.schema';
|
|
5
|
+
import { PresentationAiActionSchema } from './presentation-ai-action.schema';
|
|
5
6
|
|
|
6
7
|
export const PresentationConfigSchema = z.object({
|
|
7
8
|
slideContentTypes: z.array(SlideContentTypeSchema),
|
|
8
9
|
languages: z.array(LanguageSchema),
|
|
9
10
|
templates: z.array(PresentationTemplateSchema),
|
|
11
|
+
aiActions: z.array(PresentationAiActionSchema),
|
|
10
12
|
slideGenerationPrice: z.number(),
|
|
11
13
|
maxSlides: z.number(),
|
|
12
14
|
minSlides: z.number(),
|
|
13
15
|
maxSlideTitleLength: z.number(),
|
|
14
16
|
maxSlideOutlineLength: z.number(),
|
|
15
17
|
maxPromptLength: z.number(),
|
|
18
|
+
imageGenerationPrice: z.number(),
|
|
16
19
|
});
|
|
17
20
|
export type PresentationConfig = z.infer<typeof PresentationConfigSchema>;
|
|
@@ -16,6 +16,8 @@ export const PresentationSchema = z.object({
|
|
|
16
16
|
unregisteredUserId: z.string().uuid().nullable().optional(),
|
|
17
17
|
slideCount: z.number(),
|
|
18
18
|
isDeleted: z.boolean(),
|
|
19
|
+
lastContentUpdateAt: z.date().nullable(),
|
|
20
|
+
lastPptxExportedAt: z.date().nullable(),
|
|
19
21
|
createdAt: z.date(),
|
|
20
22
|
updatedAt: z.date(),
|
|
21
23
|
});
|
|
@@ -29,5 +31,6 @@ export type PresentationWithSlides = z.infer<typeof PresentationWithSlidesSchema
|
|
|
29
31
|
|
|
30
32
|
export const PresentationUpdateSchema = PresentationSchema.pick({
|
|
31
33
|
title: true,
|
|
32
|
-
|
|
34
|
+
templateId: true,
|
|
35
|
+
}).partial();
|
|
33
36
|
export type PresentationUpdate = z.infer<typeof PresentationUpdateSchema>;
|