@purpleschool/gptbot 0.7.79 → 0.7.81
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/api/controllers/http/presentation.ts +10 -0
- package/build/api/controllers/http/presentation.js +7 -0
- package/build/commands/tools/presentation/build-blank-slide.command.js +21 -0
- package/build/commands/tools/presentation/generate-and-insert-slide.command.js +22 -0
- package/build/commands/tools/presentation/index.js +7 -0
- package/build/commands/tools/presentation/presentation-generate-report.command.js +17 -0
- package/build/commands/tools/presentation/presentation-paraphrase.command.js +20 -0
- package/build/commands/tools/presentation/update-presentation-slides.command.js +25 -0
- package/build/commands/tools/presentation/update-presentation.command.js +4 -3
- package/build/commands/tools/presentation/update-slide-image-slot.command.js +34 -0
- package/build/commands/tools/presentation/update-slide.command.js +19 -0
- package/build/commands/user/get-aggregated-user-data.command.js +1 -0
- package/build/commands/user/index.js +1 -0
- package/build/constants/errors/errors.js +11 -1
- package/build/constants/presentation/enums/index.js +4 -0
- package/build/constants/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
- package/build/constants/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
- package/build/constants/presentation/enums/presentation-ai-action-type.enum.js +8 -0
- package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -0
- package/build/helpers/index.js +1 -0
- package/build/helpers/presentation/calculate-presentation-ai-action-price.util.js +16 -0
- package/build/helpers/presentation/index.js +17 -0
- package/build/models/tools/index.js +1 -0
- package/build/models/tools/presentation/index.js +1 -0
- package/build/models/tools/presentation/presentation-ai-action.schema.js +27 -0
- package/build/models/tools/presentation/presentation-config.schema.js +3 -0
- package/build/models/tools/presentation/presentation.schema.js +2 -0
- package/build/models/tools/presentation/slide-content-edit.schema.js +129 -0
- package/build/models/tools/presentation/slide-content.schema.js +22 -20
- package/build/models/tools/presentation/slide.schema.js +39 -1
- package/commands/tools/presentation/build-blank-slide.command.ts +23 -0
- package/commands/tools/presentation/generate-and-insert-slide.command.ts +27 -0
- package/commands/tools/presentation/index.ts +7 -0
- package/commands/tools/presentation/presentation-generate-report.command.ts +21 -0
- package/commands/tools/presentation/presentation-paraphrase.command.ts +26 -0
- package/commands/tools/presentation/update-presentation-slides.command.ts +32 -0
- package/commands/tools/presentation/update-presentation.command.ts +5 -4
- package/commands/tools/presentation/update-slide-image-slot.command.ts +40 -0
- package/commands/tools/presentation/update-slide.command.ts +25 -0
- package/commands/user/get-aggregated-user-data.command.ts +1 -0
- package/commands/user/index.ts +1 -0
- package/constants/errors/errors.ts +11 -1
- package/constants/presentation/enums/index.ts +4 -0
- package/constants/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
- package/constants/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
- package/constants/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
- package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -0
- package/helpers/index.ts +1 -0
- package/helpers/presentation/calculate-presentation-ai-action-price.util.ts +20 -0
- package/helpers/presentation/index.ts +1 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/presentation/index.ts +1 -0
- package/models/tools/presentation/presentation-ai-action.schema.ts +33 -0
- package/models/tools/presentation/presentation-config.schema.ts +3 -0
- package/models/tools/presentation/presentation.schema.ts +2 -0
- package/models/tools/presentation/slide-content-edit.schema.ts +154 -0
- package/models/tools/presentation/slide-content.schema.ts +119 -32
- package/models/tools/presentation/slide.schema.ts +47 -0
- package/package.json +1 -1
|
@@ -19,9 +19,7 @@ exports.IconSlotSchema = zod_1.z.object({
|
|
|
19
19
|
.string()
|
|
20
20
|
.uuid()
|
|
21
21
|
.describe('Generate a valid uuid for icon slot, that will be used for future lookups'),
|
|
22
|
-
prompt: zod_1.z
|
|
23
|
-
.string()
|
|
24
|
-
.describe('Icons are stored locally. Provide a search query for a fitting icon. MUST BE IN ENGLISH'),
|
|
22
|
+
prompt: zod_1.z.string().describe('Provide a search query for an fitting icon. MUST BE IN ENGLISH'),
|
|
25
23
|
});
|
|
26
24
|
exports.CoverSlideDataSchema = zod_1.z.object({
|
|
27
25
|
contentType: zod_1.z.literal(constants_1.SLIDE_CONTENT_TYPE.COVER),
|
|
@@ -46,15 +44,17 @@ exports.CoverSlideDataSchema = zod_1.z.object({
|
|
|
46
44
|
});
|
|
47
45
|
exports.ThankYouSlideDataSchema = zod_1.z.object({
|
|
48
46
|
contentType: zod_1.z.literal(constants_1.SLIDE_CONTENT_TYPE.THANK_YOU),
|
|
49
|
-
title: zod_1.z
|
|
47
|
+
title: zod_1.z
|
|
48
|
+
.string()
|
|
49
|
+
.describe('"Thank you for your attention" in presentation\'s language')
|
|
50
|
+
.min(10)
|
|
51
|
+
.max(150),
|
|
50
52
|
author: zod_1.z.object({
|
|
51
|
-
label: zod_1.z.string().describe('
|
|
52
|
-
value: zod_1.z
|
|
53
|
-
.string()
|
|
54
|
-
.describe('Literal "Author of the presentation" in presentation\'s language'),
|
|
53
|
+
label: zod_1.z.string().describe('"Author" in presentation\'s language'),
|
|
54
|
+
value: zod_1.z.string().describe('"Author of the presentation" in presentation\'s language'),
|
|
55
55
|
}),
|
|
56
56
|
date: zod_1.z.object({
|
|
57
|
-
label: zod_1.z.string().describe('
|
|
57
|
+
label: zod_1.z.string().describe('"Date" in presentation\'s language'),
|
|
58
58
|
value: zod_1.z
|
|
59
59
|
.string()
|
|
60
60
|
.describe('Date of the presentation in the "dd month yyyy" format in presentation\'s locale'),
|
|
@@ -82,9 +82,9 @@ exports.TextSlideDataSchema = zod_1.z.object({
|
|
|
82
82
|
title: zod_1.z.string().describe('Slide title in about 6 words').min(10).max(150),
|
|
83
83
|
description: zod_1.z
|
|
84
84
|
.string()
|
|
85
|
-
.describe(
|
|
85
|
+
.describe("Fairly long textual description of the point presented in the title. A couple of paragraphs. Consider maximum amount of text to be 600 characters. Don't cut the text short.")
|
|
86
86
|
.min(300)
|
|
87
|
-
.max(
|
|
87
|
+
.max(600),
|
|
88
88
|
version: zod_1.z.literal(1),
|
|
89
89
|
});
|
|
90
90
|
exports.ContentsSlideDataSchema = zod_1.z.object({
|
|
@@ -137,9 +137,9 @@ exports.TableSlideDataSchema = zod_1.z.object({
|
|
|
137
137
|
.max(10)
|
|
138
138
|
.describe('Array of column header labels'),
|
|
139
139
|
rows: zod_1.z
|
|
140
|
-
.array(zod_1.z.array(zod_1.z.string().min(1).max(
|
|
141
|
-
.min(
|
|
142
|
-
.max(
|
|
140
|
+
.array(zod_1.z.array(zod_1.z.string().min(1).max(75)))
|
|
141
|
+
.min(3)
|
|
142
|
+
.max(4)
|
|
143
143
|
.describe('Table rows; each row must have exactly the same number of cells as columnHeaders'),
|
|
144
144
|
hasRowHeaders: zod_1.z.boolean().describe('If table needs special row headers, set this to true'),
|
|
145
145
|
hasSummaryRow: zod_1.z.boolean().describe('If table needs a summary row, set this to true'),
|
|
@@ -150,13 +150,15 @@ exports.TableSlideDataSchema = zod_1.z.object({
|
|
|
150
150
|
exports.BarChartSlideDataSchema = zod_1.z.object({
|
|
151
151
|
type: zod_1.z.literal(SLIDE_CHART_TYPE.BAR),
|
|
152
152
|
categories: zod_1.z
|
|
153
|
-
.array(zod_1.z.string()
|
|
153
|
+
.array(zod_1.z.string())
|
|
154
154
|
.min(1)
|
|
155
155
|
.max(12)
|
|
156
156
|
.describe('Category labels (e.g., months, products, regions)'),
|
|
157
157
|
series: zod_1.z
|
|
158
158
|
.array(zod_1.z.object({
|
|
159
|
-
name: zod_1.z
|
|
159
|
+
name: zod_1.z
|
|
160
|
+
.string()
|
|
161
|
+
.describe('Series name for legend. Try to include measurements if needed'),
|
|
160
162
|
data: zod_1.z.array(zod_1.z.number()).describe('Values corresponding to categories'),
|
|
161
163
|
type: zod_1.z
|
|
162
164
|
.number()
|
|
@@ -165,16 +167,16 @@ exports.BarChartSlideDataSchema = zod_1.z.object({
|
|
|
165
167
|
.describe('Series type. Used to discriminate colors when applying theme'),
|
|
166
168
|
}))
|
|
167
169
|
.min(1)
|
|
168
|
-
.max(
|
|
169
|
-
.describe('Data series for the chart'),
|
|
170
|
+
.max(1)
|
|
171
|
+
.describe('Data series for the chart. Only one series is supported'),
|
|
170
172
|
yAxisLabel: zod_1.z.string().max(40).optional().describe('Y-axis label'),
|
|
171
173
|
unit: zod_1.z.string().max(10).optional().describe('Unit symbol (%, $, etc.)'),
|
|
172
174
|
version: zod_1.z.literal(1),
|
|
173
175
|
});
|
|
174
176
|
exports.ChartSlideDataSchema = zod_1.z.object({
|
|
175
177
|
contentType: zod_1.z.literal(constants_1.SLIDE_CONTENT_TYPE.CHART),
|
|
176
|
-
title: zod_1.z.string().describe('Slide title in about 6 words').
|
|
177
|
-
description: zod_1.z.string().describe("Information on slide's topic").
|
|
178
|
+
title: zod_1.z.string().describe('Slide title in about 2-6 words').max(100),
|
|
179
|
+
description: zod_1.z.string().describe("Information on slide's topic").max(600),
|
|
178
180
|
chart: zod_1.z.discriminatedUnion('type', [exports.BarChartSlideDataSchema]),
|
|
179
181
|
version: zod_1.z.literal(1),
|
|
180
182
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SlideSchema = void 0;
|
|
3
|
+
exports.SlideBulkUpdateSchema = exports.SlideUpdateSchema = exports.SlideSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const slide_content_schema_1 = require("./slide-content.schema");
|
|
6
6
|
const constants_1 = require("../../../constants");
|
|
7
7
|
const slide_icon_slot_schema_1 = require("./slide-icon-slot.schema");
|
|
8
8
|
const slide_image_slot_schema_1 = require("./slide-image-slot.schema");
|
|
9
|
+
const slide_content_edit_schema_1 = require("./slide-content-edit.schema");
|
|
9
10
|
exports.SlideSchema = zod_1.z.object({
|
|
10
11
|
uuid: zod_1.z.string().uuid(),
|
|
11
12
|
order: zod_1.z.number(),
|
|
@@ -18,3 +19,40 @@ exports.SlideSchema = zod_1.z.object({
|
|
|
18
19
|
createdAt: zod_1.z.date(),
|
|
19
20
|
updatedAt: zod_1.z.date(),
|
|
20
21
|
});
|
|
22
|
+
exports.SlideUpdateSchema = exports.SlideSchema.pick({
|
|
23
|
+
layoutId: true,
|
|
24
|
+
})
|
|
25
|
+
.extend({
|
|
26
|
+
content: slide_content_edit_schema_1.SlideContentUserEditSchema,
|
|
27
|
+
})
|
|
28
|
+
.partial();
|
|
29
|
+
exports.SlideBulkUpdateSchema = exports.SlideSchema.pick({
|
|
30
|
+
order: true,
|
|
31
|
+
contentTypeId: true,
|
|
32
|
+
layoutId: true,
|
|
33
|
+
presentationId: true,
|
|
34
|
+
})
|
|
35
|
+
.extend({
|
|
36
|
+
uuid: zod_1.z.string().uuid().optional(),
|
|
37
|
+
content: slide_content_edit_schema_1.SlideContentUserEditSchema,
|
|
38
|
+
})
|
|
39
|
+
.array()
|
|
40
|
+
.min(1, 'Must include at least one slide')
|
|
41
|
+
.refine((arr) => {
|
|
42
|
+
const orders = arr.map((s) => s.order);
|
|
43
|
+
const unique = new Set(orders);
|
|
44
|
+
if (unique.size !== orders.length)
|
|
45
|
+
return false;
|
|
46
|
+
const sorted = [...orders].sort((a, b) => a - b);
|
|
47
|
+
return sorted.every((val, idx) => val === idx);
|
|
48
|
+
}, {
|
|
49
|
+
message: 'Slide orders must be unique and sequential starting at 0',
|
|
50
|
+
path: ['order'],
|
|
51
|
+
})
|
|
52
|
+
.refine((arr) => {
|
|
53
|
+
const [firstId, ...rest] = arr.map((s) => s.presentationId);
|
|
54
|
+
return rest.every((id) => id === firstId);
|
|
55
|
+
}, {
|
|
56
|
+
message: 'All slides must belong to the same presentation',
|
|
57
|
+
path: ['presentationId'],
|
|
58
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace BuildBlankSlideCommand {
|
|
4
|
+
export const RequestSchema = z.object({
|
|
5
|
+
slideContentType: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
9
|
+
|
|
10
|
+
export const ResponseSchema = z.object({
|
|
11
|
+
data: z.object({
|
|
12
|
+
uuid: z.string().uuid(),
|
|
13
|
+
order: z.number(),
|
|
14
|
+
contentTypeId: z.string(),
|
|
15
|
+
layoutId: z.string(),
|
|
16
|
+
content: z.record(z.any()),
|
|
17
|
+
createdAt: z.date(),
|
|
18
|
+
updatedAt: z.date(),
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideSchema } from '../../../models/tools/presentation';
|
|
3
|
+
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../../constants';
|
|
4
|
+
|
|
5
|
+
export namespace GenerateAndInsertSlideCommand {
|
|
6
|
+
export const RequestSchema = z.object({
|
|
7
|
+
contentTypeId: z.nativeEnum(SLIDE_CONTENT_TYPE),
|
|
8
|
+
prompt: z.string().max(10000).optional(),
|
|
9
|
+
title: z.string().min(1).max(80),
|
|
10
|
+
position: z.number().min(0),
|
|
11
|
+
layoutId: z.nativeEnum(SLIDE_LAYOUT).optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
15
|
+
|
|
16
|
+
export const RequestParamsSchema = z.object({
|
|
17
|
+
uuid: z.string().uuid(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
21
|
+
|
|
22
|
+
export const ResponseSchema = z.object({
|
|
23
|
+
data: z.array(SlideSchema),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
27
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
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-slide-outline.command';
|
|
@@ -7,9 +8,15 @@ export * from './find-presentation-by-uuid.command';
|
|
|
7
8
|
export * from './find-presentation-outline.command';
|
|
8
9
|
export * from './find-presentations.command';
|
|
9
10
|
export * from './generate-presentation-slides.command';
|
|
11
|
+
export * from './generate-and-insert-slide.command';
|
|
10
12
|
export * from './get-presentation-config.command';
|
|
11
13
|
export * from './reposition-slide-outline.command';
|
|
12
14
|
export * from './update-slide-outline.command';
|
|
13
15
|
export * from './update-presentation-outline.command';
|
|
14
16
|
export * from './update-presentation.command';
|
|
17
|
+
export * from './update-presentation-slides.command';
|
|
18
|
+
export * from './update-slide-image-slot.command';
|
|
15
19
|
export * from './update-slide-outline.command';
|
|
20
|
+
export * from './presentation-paraphrase.command';
|
|
21
|
+
export * from './presentation-generate-report.command';
|
|
22
|
+
export * from './update-slide.command';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace PresentationGenerateReportCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
presentationId: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const RequestSchema = RequestParamsSchema;
|
|
9
|
+
|
|
10
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: z.object({
|
|
15
|
+
output: z.string(),
|
|
16
|
+
docxUrl: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export namespace PresentationParaphraseCommand {
|
|
4
|
+
export const RequestParamsSchema = z.object({
|
|
5
|
+
presentationId: z.string(),
|
|
6
|
+
slideId: z.string(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const RequestBodySchema = z.object({
|
|
10
|
+
selectionText: z.string().max(10000),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const RequestSchema = RequestParamsSchema.merge(RequestBodySchema);
|
|
14
|
+
|
|
15
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
16
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
17
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
18
|
+
|
|
19
|
+
export const ResponseSchema = z.object({
|
|
20
|
+
data: z.object({
|
|
21
|
+
output: z.string(),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideBulkUpdateSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace UpdatePresentationSlidesCommand {
|
|
5
|
+
export const RequestSchema = z.object({
|
|
6
|
+
data: SlideBulkUpdateSchema,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const RequestParamsSchema = z.object({
|
|
12
|
+
uuid: z.string().uuid(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
16
|
+
|
|
17
|
+
export const ResponseSchema = z.object({
|
|
18
|
+
data: z.array(
|
|
19
|
+
z.object({
|
|
20
|
+
uuid: z.string().uuid(),
|
|
21
|
+
order: z.number(),
|
|
22
|
+
contentTypeId: z.string(),
|
|
23
|
+
layoutId: z.string(),
|
|
24
|
+
content: z.record(z.any()),
|
|
25
|
+
createdAt: z.date(),
|
|
26
|
+
updatedAt: z.date(),
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
32
|
+
}
|
|
@@ -5,11 +5,12 @@ export namespace UpdatePresentationCommand {
|
|
|
5
5
|
export const RequestParamsSchema = z.object({
|
|
6
6
|
uuid: z.string().uuid(),
|
|
7
7
|
});
|
|
8
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
8
9
|
|
|
9
|
-
export const RequestBodySchema =
|
|
10
|
-
title:
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export const RequestBodySchema = PresentationSchema.pick({
|
|
11
|
+
title: true,
|
|
12
|
+
templateId: true,
|
|
13
|
+
}).partial();
|
|
13
14
|
export type Request = z.infer<typeof RequestBodySchema>;
|
|
14
15
|
|
|
15
16
|
export const ResponseSchema = z.object({
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SLIDE_IMAGE_SLOT_ACTION } from '../../../constants';
|
|
3
|
+
import { SlideImageSlotSchema } from '../../../models/tools/presentation/slide-image-slot.schema';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateSlideImageSlotCommand {
|
|
6
|
+
const ReplacePayload = z.object({
|
|
7
|
+
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.REPLACE),
|
|
8
|
+
fileId: z.string().uuid(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const GeneratePayload = z.object({
|
|
12
|
+
action: z.literal(SLIDE_IMAGE_SLOT_ACTION.GENERATE),
|
|
13
|
+
prompt: z.string().min(1).max(1000).optional(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const UpdateImageSlotPayloadSchema = z.discriminatedUnion('action', [
|
|
17
|
+
ReplacePayload,
|
|
18
|
+
GeneratePayload,
|
|
19
|
+
]);
|
|
20
|
+
export type UpdateImageSlotPayload = z.infer<typeof UpdateImageSlotPayloadSchema>;
|
|
21
|
+
|
|
22
|
+
export const RequestSchema = z.object({
|
|
23
|
+
payload: UpdateImageSlotPayloadSchema,
|
|
24
|
+
});
|
|
25
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
26
|
+
|
|
27
|
+
export const RequestParamsSchema = z.object({
|
|
28
|
+
presentationId: z.string().uuid(),
|
|
29
|
+
slideId: z.string().uuid(),
|
|
30
|
+
slotId: z.string().uuid().optional(),
|
|
31
|
+
});
|
|
32
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
33
|
+
|
|
34
|
+
export const ResponseSchema = z.object({
|
|
35
|
+
data: z.object({
|
|
36
|
+
imageSlot: SlideImageSlotSchema,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SlideSchema, SlideUpdateSchema } from '../../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export namespace UpdateSlideCommand {
|
|
5
|
+
export const RequestParamsSchema = z.object({
|
|
6
|
+
presentationId: z.string(),
|
|
7
|
+
slideId: z.string(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const RequestBodySchema = z.object({
|
|
11
|
+
data: SlideUpdateSchema,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const RequestSchema = RequestParamsSchema.merge(RequestBodySchema);
|
|
15
|
+
|
|
16
|
+
export type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
17
|
+
export type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
18
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
19
|
+
|
|
20
|
+
export const ResponseSchema = z.object({
|
|
21
|
+
data: SlideSchema,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
25
|
+
}
|
package/commands/user/index.ts
CHANGED
|
@@ -2294,8 +2294,18 @@ export const ERRORS = {
|
|
|
2294
2294
|
message: 'Не удалось применить бонусы вебмастеру',
|
|
2295
2295
|
httpCode: 500,
|
|
2296
2296
|
},
|
|
2297
|
-
|
|
2297
|
+
SLIDE_IMAGE_SLOT_UPDATE_ERROR: {
|
|
2298
2298
|
code: 'A468',
|
|
2299
|
+
message: 'Произошла ошибка при обновлении изображения на слайде',
|
|
2300
|
+
httpCode: 500,
|
|
2301
|
+
},
|
|
2302
|
+
FILE_TYPE_NOT_SUPPORTED: {
|
|
2303
|
+
code: 'A469',
|
|
2304
|
+
message: 'Неподдерживаемый тип файла',
|
|
2305
|
+
httpCode: 400,
|
|
2306
|
+
},
|
|
2307
|
+
WEBMASTER_BALANCE_LESS_THAN_MINIMUM_ERROR: {
|
|
2308
|
+
code: 'A470',
|
|
2299
2309
|
message: 'Минимальная сумма для вывода 5000 рублей',
|
|
2300
2310
|
httpCode: 400,
|
|
2301
2311
|
},
|
|
@@ -3,3 +3,7 @@ export * from './slide-content-type.enum';
|
|
|
3
3
|
export * from './slide-icon-slot-status.enum';
|
|
4
4
|
export * from './slide-image-slot.status.enum';
|
|
5
5
|
export * from './slide-layout.enum';
|
|
6
|
+
export * from './slide-image-slot-action.enum';
|
|
7
|
+
export * from './presentation-ai-action-type.enum';
|
|
8
|
+
export * from './presentation-ai-action-pricing-type.enum';
|
|
9
|
+
export * from './presentation-ai-action-call-status.enum';
|
package/helpers/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PRESENTATION_AI_ACTION_PRICING_TYPE } from '../../constants';
|
|
2
|
+
import { PresentationAiActionPricingRules } from '../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export function calculatePresentationAiActionPrice(
|
|
5
|
+
pricingRules: PresentationAiActionPricingRules,
|
|
6
|
+
selectionText: string,
|
|
7
|
+
): number {
|
|
8
|
+
switch (pricingRules.type) {
|
|
9
|
+
case PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
|
|
10
|
+
const characterCount = selectionText.length;
|
|
11
|
+
const price = characterCount * pricingRules.price;
|
|
12
|
+
return Math.max(1, Math.ceil(price));
|
|
13
|
+
|
|
14
|
+
case PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT:
|
|
15
|
+
return Math.max(1, Math.ceil(pricingRules.price));
|
|
16
|
+
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`Unknown pricing type`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-presentation-ai-action-price.util';
|
package/models/tools/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
PRESENTATION_AI_ACTION_PRICING_TYPE,
|
|
4
|
+
PRESENTATION_AI_ACTION_TYPE,
|
|
5
|
+
} from '../../../constants';
|
|
6
|
+
|
|
7
|
+
export const PresentationAiActionPricingRulesSchema = z.discriminatedUnion('type', [
|
|
8
|
+
z.object({
|
|
9
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
|
|
10
|
+
price: z.number(),
|
|
11
|
+
}),
|
|
12
|
+
z.object({
|
|
13
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT),
|
|
14
|
+
price: z.number(),
|
|
15
|
+
}),
|
|
16
|
+
]);
|
|
17
|
+
export type PresentationAiActionPricingRules = z.infer<
|
|
18
|
+
typeof PresentationAiActionPricingRulesSchema
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const PresentationAiActionSchema = z.object({
|
|
22
|
+
uuid: z.string(),
|
|
23
|
+
type: z.nativeEnum(PRESENTATION_AI_ACTION_TYPE),
|
|
24
|
+
pricingRules: PresentationAiActionPricingRulesSchema,
|
|
25
|
+
maxPromptLength: z.number(),
|
|
26
|
+
aiModel: z.string(),
|
|
27
|
+
title: z.string(),
|
|
28
|
+
icon: z.string(),
|
|
29
|
+
order: z.number(),
|
|
30
|
+
createdAt: z.date(),
|
|
31
|
+
updatedAt: z.date(),
|
|
32
|
+
});
|
|
33
|
+
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>;
|
|
@@ -13,6 +13,8 @@ export const PresentationSchema = z.object({
|
|
|
13
13
|
templateId: z.string(),
|
|
14
14
|
downloadUrl: z.string().nullable(),
|
|
15
15
|
slideCount: z.number(),
|
|
16
|
+
lastContentUpdateAt: z.date().nullable(),
|
|
17
|
+
lastPptxExportedAt: z.date().nullable(),
|
|
16
18
|
createdAt: z.date(),
|
|
17
19
|
updatedAt: z.date(),
|
|
18
20
|
});
|