@purpleschool/gptbot 0.7.77 → 0.7.78
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/auth/register-user.command.js +1 -18
- package/build/commands/auth/vk-login.command.js +1 -18
- package/build/commands/auth/yandex-login.command.js +1 -18
- package/build/commands/product/buy-product.command.js +1 -25
- package/build/commands/subscription/buy-subscription.command.js +1 -25
- package/build/commands/telegram-auth/create-telegram-auth-link.command.js +1 -19
- package/build/commands/telegram-profile/auth-with-telegram-web-app.command.js +0 -7
- 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/constants/errors/errors.js +10 -2
- 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/constants/webmaster/enums/organization-type.enum.js +1 -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/build/models/user-referrals.schema.js +0 -6
- package/commands/auth/register-user.command.ts +1 -23
- package/commands/auth/vk-login.command.ts +1 -23
- package/commands/auth/yandex-login.command.ts +1 -23
- package/commands/product/buy-product.command.ts +9 -38
- package/commands/subscription/buy-subscription.command.ts +9 -38
- package/commands/telegram-auth/create-telegram-auth-link.command.ts +1 -24
- package/commands/telegram-profile/auth-with-telegram-web-app.command.ts +0 -7
- 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/constants/errors/errors.ts +10 -2
- 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/constants/webmaster/enums/organization-type.enum.ts +1 -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/models/user-referrals.schema.ts +0 -6
- package/package.json +1 -1
|
@@ -19,14 +19,95 @@ export const IconSlotSchema = 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: z
|
|
23
|
-
.string()
|
|
24
|
-
.describe(
|
|
25
|
-
'Icons are stored locally. Provide a search query for a fitting icon. MUST BE IN ENGLISH',
|
|
26
|
-
),
|
|
22
|
+
prompt: z.string().describe('Provide a search query for an fitting icon. MUST BE IN ENGLISH'),
|
|
27
23
|
});
|
|
28
24
|
export type IconSlot = z.infer<typeof IconSlotSchema>;
|
|
29
25
|
|
|
26
|
+
export interface ICoverSlideDataStructure {
|
|
27
|
+
contentType: SLIDE_CONTENT_TYPE.COVER;
|
|
28
|
+
title: string;
|
|
29
|
+
author: { label: string; value: string };
|
|
30
|
+
date: { label: string; value: string };
|
|
31
|
+
email: { label: string; value: string };
|
|
32
|
+
version: 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface IThankYouSlideDataStructure {
|
|
36
|
+
contentType: SLIDE_CONTENT_TYPE.THANK_YOU;
|
|
37
|
+
title: string;
|
|
38
|
+
author: { label: string; value: string };
|
|
39
|
+
date: { label: string; value: string };
|
|
40
|
+
email: { label: string; value: string };
|
|
41
|
+
version: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ITextSlideDataStructure {
|
|
45
|
+
contentType: SLIDE_CONTENT_TYPE.TEXT;
|
|
46
|
+
title: string;
|
|
47
|
+
description: string;
|
|
48
|
+
version: 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IStructuredListSlideDataStructure {
|
|
52
|
+
contentType: SLIDE_CONTENT_TYPE.STRUCTURED_LIST;
|
|
53
|
+
title: string;
|
|
54
|
+
description: string;
|
|
55
|
+
list: Array<{ title: string; description: string }>;
|
|
56
|
+
version: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface IContentsSlideDataStructure {
|
|
60
|
+
contentType: SLIDE_CONTENT_TYPE.CONTENTS;
|
|
61
|
+
title: string;
|
|
62
|
+
items: Array<{ pageNumber: number; title: string }>;
|
|
63
|
+
version: 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IImageSlideDataStructure {
|
|
67
|
+
contentType: SLIDE_CONTENT_TYPE.TEXT_WITH_IMAGE;
|
|
68
|
+
title: string;
|
|
69
|
+
description: string;
|
|
70
|
+
imageSlot?: ImageSlot;
|
|
71
|
+
version: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface ISectionBreakSlideDataStructure {
|
|
75
|
+
contentType: SLIDE_CONTENT_TYPE.SECTION_BREAK;
|
|
76
|
+
title: string;
|
|
77
|
+
description: string;
|
|
78
|
+
version: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ITableSlideDataStructure {
|
|
82
|
+
contentType: SLIDE_CONTENT_TYPE.TABLE;
|
|
83
|
+
title: string;
|
|
84
|
+
description: string;
|
|
85
|
+
table: {
|
|
86
|
+
columnHeaders: string[];
|
|
87
|
+
rows: string[][];
|
|
88
|
+
hasRowHeaders: boolean;
|
|
89
|
+
hasSummaryRow: boolean;
|
|
90
|
+
};
|
|
91
|
+
version: 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface IBarChartSlideDataStructure {
|
|
95
|
+
type: SLIDE_CHART_TYPE.BAR;
|
|
96
|
+
categories: string[];
|
|
97
|
+
series: Array<{ name: string; data: number[]; type: number }>;
|
|
98
|
+
yAxisLabel?: string;
|
|
99
|
+
unit?: string;
|
|
100
|
+
version: 1;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface IChartSlideDataStructure {
|
|
104
|
+
contentType: SLIDE_CONTENT_TYPE.CHART;
|
|
105
|
+
title: string;
|
|
106
|
+
description: string;
|
|
107
|
+
chart: IBarChartSlideDataStructure;
|
|
108
|
+
version: 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
30
111
|
export const CoverSlideDataSchema = z.object({
|
|
31
112
|
contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
|
|
32
113
|
title: z.string().describe('Slide title in about 6 words').min(10).max(150),
|
|
@@ -49,20 +130,22 @@ export const CoverSlideDataSchema = z.object({
|
|
|
49
130
|
value: z.string().describe('Just default "email@example.com"'),
|
|
50
131
|
}),
|
|
51
132
|
version: z.literal(1),
|
|
52
|
-
})
|
|
133
|
+
}) satisfies z.ZodType<ICoverSlideDataStructure>;
|
|
53
134
|
export type CoverSlideData = z.infer<typeof CoverSlideDataSchema>;
|
|
54
135
|
|
|
55
136
|
export const ThankYouSlideDataSchema = z.object({
|
|
56
137
|
contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
|
|
57
|
-
title: z
|
|
138
|
+
title: z
|
|
139
|
+
.string()
|
|
140
|
+
.describe('"Thank you for your attention" in presentation\'s language')
|
|
141
|
+
.min(10)
|
|
142
|
+
.max(150),
|
|
58
143
|
author: z.object({
|
|
59
|
-
label: z.string().describe('
|
|
60
|
-
value: z
|
|
61
|
-
.string()
|
|
62
|
-
.describe('Literal "Author of the presentation" in presentation\'s language'),
|
|
144
|
+
label: z.string().describe('"Author" in presentation\'s language'),
|
|
145
|
+
value: z.string().describe('"Author of the presentation" in presentation\'s language'),
|
|
63
146
|
}),
|
|
64
147
|
date: z.object({
|
|
65
|
-
label: z.string().describe('
|
|
148
|
+
label: z.string().describe('"Date" in presentation\'s language'),
|
|
66
149
|
value: z
|
|
67
150
|
.string()
|
|
68
151
|
.describe(
|
|
@@ -74,7 +157,7 @@ export const ThankYouSlideDataSchema = z.object({
|
|
|
74
157
|
value: z.string().describe('Just default "email@example.com"'),
|
|
75
158
|
}),
|
|
76
159
|
version: z.literal(1),
|
|
77
|
-
})
|
|
160
|
+
}) satisfies z.ZodType<IThankYouSlideDataStructure>;
|
|
78
161
|
export type ThankYouSlideData = z.infer<typeof ThankYouSlideDataSchema>;
|
|
79
162
|
|
|
80
163
|
export const StructuredListSlideDataSchema = z.object({
|
|
@@ -90,7 +173,7 @@ export const StructuredListSlideDataSchema = z.object({
|
|
|
90
173
|
)
|
|
91
174
|
.length(4),
|
|
92
175
|
version: z.literal(1),
|
|
93
|
-
})
|
|
176
|
+
}) satisfies z.ZodType<IStructuredListSlideDataStructure>;
|
|
94
177
|
export type StructuredListSlideData = z.infer<typeof StructuredListSlideDataSchema>;
|
|
95
178
|
|
|
96
179
|
export const TextSlideDataSchema = z.object({
|
|
@@ -99,12 +182,12 @@ export const TextSlideDataSchema = z.object({
|
|
|
99
182
|
description: z
|
|
100
183
|
.string()
|
|
101
184
|
.describe(
|
|
102
|
-
|
|
185
|
+
"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.",
|
|
103
186
|
)
|
|
104
187
|
.min(300)
|
|
105
|
-
.max(
|
|
188
|
+
.max(600),
|
|
106
189
|
version: z.literal(1),
|
|
107
|
-
})
|
|
190
|
+
}) satisfies z.ZodType<ITextSlideDataStructure>;
|
|
108
191
|
export type TextSlideData = z.infer<typeof TextSlideDataSchema>;
|
|
109
192
|
|
|
110
193
|
export const ContentsSlideDataSchema = z.object({
|
|
@@ -128,7 +211,7 @@ export const ContentsSlideDataSchema = z.object({
|
|
|
128
211
|
'List of slide titles. Must be relevant and generated after all the slides are generated',
|
|
129
212
|
),
|
|
130
213
|
version: z.literal(1),
|
|
131
|
-
})
|
|
214
|
+
}) satisfies z.ZodType<IContentsSlideDataStructure>;
|
|
132
215
|
export type ContentsSlideData = z.infer<typeof ContentsSlideDataSchema>;
|
|
133
216
|
|
|
134
217
|
export const ImageSlideDataSchema = z
|
|
@@ -143,7 +226,9 @@ export const ImageSlideDataSchema = z
|
|
|
143
226
|
imageSlot: ImageSlotSchema,
|
|
144
227
|
version: z.literal(1),
|
|
145
228
|
})
|
|
146
|
-
.describe(
|
|
229
|
+
.describe(
|
|
230
|
+
'Slide that contains a title, description of the title',
|
|
231
|
+
) satisfies z.ZodType<IImageSlideDataStructure>;
|
|
147
232
|
export type ImageSlideData = z.infer<typeof ImageSlideDataSchema>;
|
|
148
233
|
|
|
149
234
|
export const SectionBreakSlideDataSchema = z.object({
|
|
@@ -151,7 +236,7 @@ export const SectionBreakSlideDataSchema = z.object({
|
|
|
151
236
|
title: z.string().describe('Slide title in about 6 words').min(10).max(200),
|
|
152
237
|
description: z.string().describe('Description of the slide in about 6 words').min(10).max(200),
|
|
153
238
|
version: z.literal(1),
|
|
154
|
-
})
|
|
239
|
+
}) satisfies z.ZodType<ISectionBreakSlideDataStructure>;
|
|
155
240
|
export type SectionBreakSlideData = z.infer<typeof SectionBreakSlideDataSchema>;
|
|
156
241
|
|
|
157
242
|
export const TableSlideDataSchema = z.object({
|
|
@@ -169,9 +254,9 @@ export const TableSlideDataSchema = z.object({
|
|
|
169
254
|
.max(10)
|
|
170
255
|
.describe('Array of column header labels'),
|
|
171
256
|
rows: z
|
|
172
|
-
.array(z.array(z.string().min(1).max(
|
|
173
|
-
.min(
|
|
174
|
-
.max(
|
|
257
|
+
.array(z.array(z.string().min(1).max(75)))
|
|
258
|
+
.min(3)
|
|
259
|
+
.max(4)
|
|
175
260
|
.describe(
|
|
176
261
|
'Table rows; each row must have exactly the same number of cells as columnHeaders',
|
|
177
262
|
),
|
|
@@ -179,21 +264,23 @@ export const TableSlideDataSchema = z.object({
|
|
|
179
264
|
hasSummaryRow: z.boolean().describe('If table needs a summary row, set this to true'),
|
|
180
265
|
}),
|
|
181
266
|
version: z.literal(1),
|
|
182
|
-
})
|
|
267
|
+
}) satisfies z.ZodType<ITableSlideDataStructure>;
|
|
183
268
|
export type TableSlideData = z.infer<typeof TableSlideDataSchema>;
|
|
184
269
|
|
|
185
270
|
// Charts
|
|
186
271
|
export const BarChartSlideDataSchema = z.object({
|
|
187
272
|
type: z.literal(SLIDE_CHART_TYPE.BAR),
|
|
188
273
|
categories: z
|
|
189
|
-
.array(z.string()
|
|
274
|
+
.array(z.string())
|
|
190
275
|
.min(1)
|
|
191
276
|
.max(12)
|
|
192
277
|
.describe('Category labels (e.g., months, products, regions)'),
|
|
193
278
|
series: z
|
|
194
279
|
.array(
|
|
195
280
|
z.object({
|
|
196
|
-
name: z
|
|
281
|
+
name: z
|
|
282
|
+
.string()
|
|
283
|
+
.describe('Series name for legend. Try to include measurements if needed'),
|
|
197
284
|
data: z.array(z.number()).describe('Values corresponding to categories'),
|
|
198
285
|
type: z
|
|
199
286
|
.number()
|
|
@@ -203,21 +290,21 @@ export const BarChartSlideDataSchema = z.object({
|
|
|
203
290
|
}),
|
|
204
291
|
)
|
|
205
292
|
.min(1)
|
|
206
|
-
.max(
|
|
207
|
-
.describe('Data series for the chart'),
|
|
293
|
+
.max(1)
|
|
294
|
+
.describe('Data series for the chart. Only one series is supported'),
|
|
208
295
|
yAxisLabel: z.string().max(40).optional().describe('Y-axis label'),
|
|
209
296
|
unit: z.string().max(10).optional().describe('Unit symbol (%, $, etc.)'),
|
|
210
297
|
version: z.literal(1),
|
|
211
|
-
})
|
|
298
|
+
}) satisfies z.ZodType<IBarChartSlideDataStructure>;
|
|
212
299
|
export type BarChartSlideData = z.infer<typeof BarChartSlideDataSchema>;
|
|
213
300
|
|
|
214
301
|
export const ChartSlideDataSchema = z.object({
|
|
215
302
|
contentType: z.literal(SLIDE_CONTENT_TYPE.CHART),
|
|
216
|
-
title: z.string().describe('Slide title in about 6 words').
|
|
217
|
-
description: z.string().describe("Information on slide's topic").
|
|
303
|
+
title: z.string().describe('Slide title in about 2-6 words').max(100),
|
|
304
|
+
description: z.string().describe("Information on slide's topic").max(600),
|
|
218
305
|
chart: z.discriminatedUnion('type', [BarChartSlideDataSchema]),
|
|
219
306
|
version: z.literal(1),
|
|
220
|
-
})
|
|
307
|
+
}) satisfies z.ZodType<IChartSlideDataStructure>;
|
|
221
308
|
export type ChartSlideData = z.infer<typeof ChartSlideDataSchema>;
|
|
222
309
|
|
|
223
310
|
export const SlideContentSchema = z.discriminatedUnion('contentType', [
|
|
@@ -3,6 +3,7 @@ import { SlideContentSchema } from './slide-content.schema';
|
|
|
3
3
|
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../../constants';
|
|
4
4
|
import { SlideIconSlotSchema } from './slide-icon-slot.schema';
|
|
5
5
|
import { SlideImageSlotSchema } from './slide-image-slot.schema';
|
|
6
|
+
import { SlideContentUserEditSchema } from './slide-content-edit.schema';
|
|
6
7
|
|
|
7
8
|
export const SlideSchema = z.object({
|
|
8
9
|
uuid: z.string().uuid(),
|
|
@@ -17,3 +18,49 @@ export const SlideSchema = z.object({
|
|
|
17
18
|
updatedAt: z.date(),
|
|
18
19
|
});
|
|
19
20
|
export type Slide = z.infer<typeof SlideSchema>;
|
|
21
|
+
|
|
22
|
+
export const SlideUpdateSchema = SlideSchema.pick({
|
|
23
|
+
layoutId: true,
|
|
24
|
+
})
|
|
25
|
+
.extend({
|
|
26
|
+
content: SlideContentUserEditSchema,
|
|
27
|
+
})
|
|
28
|
+
.partial();
|
|
29
|
+
export type SlideUpdate = z.infer<typeof SlideUpdateSchema>;
|
|
30
|
+
|
|
31
|
+
export const SlideBulkUpdateSchema = SlideSchema.pick({
|
|
32
|
+
order: true,
|
|
33
|
+
contentTypeId: true,
|
|
34
|
+
layoutId: true,
|
|
35
|
+
presentationId: true,
|
|
36
|
+
})
|
|
37
|
+
.extend({
|
|
38
|
+
uuid: z.string().uuid().optional(),
|
|
39
|
+
content: SlideContentUserEditSchema,
|
|
40
|
+
})
|
|
41
|
+
.array()
|
|
42
|
+
.min(1, 'Must include at least one slide')
|
|
43
|
+
.refine(
|
|
44
|
+
(arr) => {
|
|
45
|
+
const orders = arr.map((s) => s.order);
|
|
46
|
+
const unique = new Set(orders);
|
|
47
|
+
if (unique.size !== orders.length) return false;
|
|
48
|
+
const sorted = [...orders].sort((a, b) => a - b);
|
|
49
|
+
return sorted.every((val, idx) => val === idx);
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
message: 'Slide orders must be unique and sequential starting at 0',
|
|
53
|
+
path: ['order'],
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
.refine(
|
|
57
|
+
(arr) => {
|
|
58
|
+
const [firstId, ...rest] = arr.map((s) => s.presentationId);
|
|
59
|
+
return rest.every((id) => id === firstId);
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
message: 'All slides must belong to the same presentation',
|
|
63
|
+
path: ['presentationId'],
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
export type SlideBulkUpdate = z.infer<typeof SlideBulkUpdateSchema>;
|
|
@@ -7,10 +7,4 @@ export const UserReferralsSchema = z.object({
|
|
|
7
7
|
.string()
|
|
8
8
|
.transform((date) => new Date(date))
|
|
9
9
|
.optional(),
|
|
10
|
-
admitadUid: z.string().optional(),
|
|
11
|
-
admitadClickDate: z
|
|
12
|
-
.string()
|
|
13
|
-
.datetime()
|
|
14
|
-
.transform((date) => new Date(date))
|
|
15
|
-
.optional(),
|
|
16
10
|
});
|