@purpleschool/gptbot 0.11.4 → 0.11.6

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.
Files changed (107) hide show
  1. package/api/controllers/http/community.ts +1 -0
  2. package/api/controllers/http/index.ts +1 -0
  3. package/api/controllers/http/spell-corrector.ts +14 -0
  4. package/api/controllers/http/unregistered-user.ts +5 -0
  5. package/api/controllers/http/user.ts +1 -0
  6. package/api/routes.ts +36 -0
  7. package/build/api/controllers/http/community.js +1 -0
  8. package/build/api/controllers/http/index.js +1 -0
  9. package/build/api/controllers/http/spell-corrector.js +16 -0
  10. package/build/api/controllers/http/unregistered-user.js +5 -1
  11. package/build/api/controllers/http/user.js +1 -0
  12. package/build/api/routes.js +25 -0
  13. package/build/commands/community/index.js +1 -0
  14. package/build/commands/community/set-visibility-community-post.command.js +21 -0
  15. package/build/commands/subscription/buy-subscription.command.js +10 -0
  16. package/build/commands/subscription/find-subscription.command.js +4 -1
  17. package/build/commands/subscription/get-available-upgrades.command.js +3 -1
  18. package/build/commands/team-account/invite-team-account-member.command.js +2 -1
  19. package/build/commands/tools/index.js +1 -0
  20. package/build/commands/tools/spell-corrector/delete-all-spell-corrector-jobs.command.js +8 -0
  21. package/build/commands/tools/spell-corrector/delete-spell-corrector-job-by-uuid.command.js +11 -0
  22. package/build/commands/tools/spell-corrector/find-spell-corrector-job-by-uuid.command.js +14 -0
  23. package/build/commands/tools/spell-corrector/find-spell-corrector-jobs.command.js +18 -0
  24. package/build/commands/tools/spell-corrector/get-spell-corrector-tool-config.command.js +11 -0
  25. package/build/commands/tools/spell-corrector/index.js +25 -0
  26. package/build/commands/tools/spell-corrector/retry-spell-corrector-job.command.js +14 -0
  27. package/build/commands/tools/spell-corrector/set-reaction-to-spell-corrector-job.command.js +28 -0
  28. package/build/commands/tools/spell-corrector/spell-corrector.command.js +15 -0
  29. package/build/commands/tools/spell-corrector/update-spell-corrector-job-title.command.js +17 -0
  30. package/build/commands/tools/video-editor/edit-video.command.js +2 -0
  31. package/build/commands/tools/video-editor/retry-video-editor-job.command.js +2 -0
  32. package/build/commands/unregistered-user/index.js +1 -0
  33. package/build/commands/unregistered-user/patch-locale.command.js +16 -0
  34. package/build/commands/user/get-me.command.js +1 -0
  35. package/build/commands/user/index.js +1 -0
  36. package/build/commands/user/patch-locale.command.js +16 -0
  37. package/build/constants/ai-model/enums/ai-model-strategy.enum.js +1 -0
  38. package/build/constants/model/enums/unified-model-content-type.enum.js +2 -0
  39. package/build/constants/subscription/enums/subscription-feature-type.enum.js +11 -1
  40. package/build/constants/tool-video-editor/enums/index.js +1 -0
  41. package/build/constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum.js +8 -0
  42. package/build/constants/user/enums/index.js +1 -0
  43. package/build/constants/user/enums/locale.enum.js +8 -0
  44. package/build/helpers/video-editor/calculate-video-editing-price.helper.js +27 -2
  45. package/build/models/subscription-feature.schema.js +42 -1
  46. package/build/models/subscription.schema.js +7 -1
  47. package/build/models/team-account/team-account-invite.schema.js +4 -1
  48. package/build/models/tools/image-editor/image-editor-model.schema.js +2 -0
  49. package/build/models/tools/image-generation/image-generation-model.schema.js +1 -0
  50. package/build/models/tools/index.js +1 -0
  51. package/build/models/tools/spell-corrector/index.js +19 -0
  52. package/build/models/tools/spell-corrector/spell-corrector-config.schema.js +9 -0
  53. package/build/models/tools/spell-corrector/spell-corrector-job.schema.js +13 -0
  54. package/build/models/tools/spell-corrector/spell-corrector-model.schema.js +17 -0
  55. package/build/models/tools/stt/stt-response.schema.js +2 -0
  56. package/build/models/tools/video/video-config.schema.js +10 -2
  57. package/build/models/tools/video-editor/video-editor-job.schema.js +6 -1
  58. package/build/models/tools/video-editor/video-editor-model.schema.js +27 -2
  59. package/build/models/user.schema.js +2 -0
  60. package/commands/community/index.ts +1 -0
  61. package/commands/community/set-visibility-community-post.command.ts +24 -0
  62. package/commands/subscription/buy-subscription.command.ts +11 -0
  63. package/commands/subscription/find-subscription.command.ts +11 -1
  64. package/commands/subscription/get-available-upgrades.command.ts +3 -1
  65. package/commands/team-account/invite-team-account-member.command.ts +3 -2
  66. package/commands/tools/index.ts +1 -0
  67. package/commands/tools/spell-corrector/delete-all-spell-corrector-jobs.command.ts +6 -0
  68. package/commands/tools/spell-corrector/delete-spell-corrector-job-by-uuid.command.ts +11 -0
  69. package/commands/tools/spell-corrector/find-spell-corrector-job-by-uuid.command.ts +16 -0
  70. package/commands/tools/spell-corrector/find-spell-corrector-jobs.command.ts +18 -0
  71. package/commands/tools/spell-corrector/get-spell-corrector-tool-config.command.ts +10 -0
  72. package/commands/tools/spell-corrector/index.ts +9 -0
  73. package/commands/tools/spell-corrector/retry-spell-corrector-job.command.ts +14 -0
  74. package/commands/tools/spell-corrector/set-reaction-to-spell-corrector-job.command.ts +33 -0
  75. package/commands/tools/spell-corrector/spell-corrector.command.ts +17 -0
  76. package/commands/tools/spell-corrector/update-spell-corrector-job-title.command.ts +19 -0
  77. package/commands/tools/video-editor/edit-video.command.ts +2 -0
  78. package/commands/tools/video-editor/retry-video-editor-job.command.ts +2 -0
  79. package/commands/unregistered-user/index.ts +1 -0
  80. package/commands/unregistered-user/patch-locale.command.ts +18 -0
  81. package/commands/user/get-me.command.ts +2 -1
  82. package/commands/user/index.ts +1 -0
  83. package/commands/user/patch-locale.command.ts +18 -0
  84. package/constants/ai-model/enums/ai-model-strategy.enum.ts +1 -0
  85. package/constants/model/enums/unified-model-content-type.enum.ts +2 -0
  86. package/constants/subscription/enums/subscription-feature-type.enum.ts +11 -1
  87. package/constants/tool-video-editor/enums/index.ts +1 -0
  88. package/constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum.ts +4 -0
  89. package/constants/user/enums/index.ts +1 -0
  90. package/constants/user/enums/locale.enum.ts +4 -0
  91. package/helpers/video-editor/calculate-video-editing-price.helper.ts +52 -2
  92. package/models/subscription-feature.schema.ts +57 -0
  93. package/models/subscription.schema.ts +11 -0
  94. package/models/team-account/team-account-invite.schema.ts +4 -0
  95. package/models/tools/image-editor/image-editor-model.schema.ts +2 -0
  96. package/models/tools/image-generation/image-generation-model.schema.ts +1 -0
  97. package/models/tools/index.ts +1 -0
  98. package/models/tools/spell-corrector/index.ts +3 -0
  99. package/models/tools/spell-corrector/spell-corrector-config.schema.ts +7 -0
  100. package/models/tools/spell-corrector/spell-corrector-job.schema.ts +11 -0
  101. package/models/tools/spell-corrector/spell-corrector-model.schema.ts +15 -0
  102. package/models/tools/stt/stt-response.schema.ts +2 -0
  103. package/models/tools/video/video-config.schema.ts +14 -1
  104. package/models/tools/video-editor/video-editor-job.schema.ts +8 -0
  105. package/models/tools/video-editor/video-editor-model.schema.ts +36 -1
  106. package/models/user.schema.ts +2 -0
  107. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export namespace SetReactionToSpellCorrectorJobCommand {
6
+ export const RequestSchema = z
7
+ .object({
8
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
9
+ dislikeReason: z.string().nullable().default(null),
10
+ })
11
+ .refine(
12
+ (data) => {
13
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
14
+ return false;
15
+ }
16
+ return true;
17
+ },
18
+ {
19
+ message: 'Dislike reason is not allowed when reaction is not DISLIKED',
20
+ },
21
+ );
22
+ export type Request = z.infer<typeof RequestSchema>;
23
+
24
+ export const RequestParamsSchema = z.object({
25
+ uuid: z.string().uuid(),
26
+ });
27
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
28
+
29
+ export const ResponseSchema = z.object({
30
+ data: SpellCorrectorToolJobSchema,
31
+ });
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { ToolJobSchema } from '../../../models';
3
+
4
+ export namespace SpellCorrectorCommand {
5
+ export const RequestSchema = z.object({
6
+ modelId: z.string().uuid(),
7
+ prompt: z.string().min(1).max(100000),
8
+ });
9
+
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: ToolJobSchema,
14
+ });
15
+
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorToolJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateSpellCorrectorJobTitleCommand {
5
+ export const RequestSchema = z.object({
6
+ title: z.string().min(1).max(40).trim(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: SpellCorrectorToolJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -6,6 +6,8 @@ export namespace EditVideoCommand {
6
6
  modelId: z.string().uuid(),
7
7
  prompt: z.string(),
8
8
  fileId: z.string().uuid(),
9
+ resolution: z.string().optional(),
10
+ duration: z.number().optional(),
9
11
  });
10
12
 
11
13
  export type Request = z.infer<typeof RequestSchema>;
@@ -12,6 +12,8 @@ export namespace RetryVideoEditorJobCommand {
12
12
  modelId: z.string().uuid().optional(),
13
13
  prompt: z.string().optional(),
14
14
  fileId: z.string().uuid().optional(),
15
+ resolution: z.string().optional(),
16
+ duration: z.number().optional(),
15
17
  });
16
18
  export type RequestBody = z.infer<typeof RequestBodySchema>;
17
19
 
@@ -1 +1,2 @@
1
1
  export * from './create-unregistered-user.command';
2
+ export * from './patch-locale.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { LOCALE } from '../../constants';
3
+
4
+ export namespace PatchUnregisteredUserLocaleCommand {
5
+ export const RequestSchema = z.object({
6
+ locale: z.nativeEnum(LOCALE),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ locale: z.nativeEnum(LOCALE),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ROLE, SIGNUP_METHOD, USER_STATUS } from '../../constants';
2
+ import { LOCALE, ROLE, SIGNUP_METHOD, USER_STATUS } from '../../constants';
3
3
  import { UserProfileResponseSchema } from '../../models';
4
4
 
5
5
  export namespace GetMeCommand {
@@ -17,6 +17,7 @@ export namespace GetMeCommand {
17
17
  telegramId: z.number().nullable(),
18
18
  telegramUserName: z.string().nullable(),
19
19
  webmasterId: z.string().uuid().nullable(),
20
+ locale: z.nativeEnum(LOCALE),
20
21
  profile: UserProfileResponseSchema,
21
22
  }),
22
23
  });
@@ -1,6 +1,7 @@
1
1
  export * from './check-email.command';
2
2
  export * from './find-user-by-uuid.command';
3
3
  export * from './get-me.command';
4
+ export * from './patch-locale.command';
4
5
  export * from './up-token-bonus-balance.command';
5
6
  export * from './find-users-by-criteria.command';
6
7
  export * from './get-user-balance.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { LOCALE } from '../../constants';
3
+
4
+ export namespace PatchUserLocaleCommand {
5
+ export const RequestSchema = z.object({
6
+ locale: z.nativeEnum(LOCALE),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: z.object({
13
+ locale: z.nativeEnum(LOCALE),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -10,6 +10,7 @@ export enum AI_MODEL_STRATEGY {
10
10
  STABLE_DIFFUSION_IMAGE_GENERATION = 'stable_diffusion_image_generation',
11
11
  LLAMA_TEXT_GENERATION = 'llama_text_generation',
12
12
  QWEN_TEXT_GENERATION = 'qwen_text_generation',
13
+ KIE_OPENAI_TEXT_GENERATION = 'kie_openai_text_generation',
13
14
  GROK_IMAGE_GENERATION = 'grok_image_generation',
14
15
  GEMINI_TEXT_GENERATION = 'gemini_text_generation',
15
16
  GEMINI_IMAGE_GENERATION = 'gemini_image_generation',
@@ -15,4 +15,6 @@ export enum UNIFIED_MODEL_CONTENT_TYPE {
15
15
  IMAGE_GENERATION = 'IMAGE_GENERATION',
16
16
  INTERIOR_DESIGN = 'INTERIOR_DESIGN',
17
17
  MARKETPLACE_CARD = 'MARKETPLACE_CARD',
18
+ SOLVING_EDU_TASK = 'SOLVING_EDU_TASK',
19
+ SPELL_CORRECTOR = 'SPELL_CORRECTOR',
18
20
  }
@@ -25,6 +25,12 @@ export enum SUBSCRIPTION_FEATURE_TYPE {
25
25
  IMAGE_EDITOR_MODEL_ACCESS = 'image_editor_model_access',
26
26
  INTERIOR_DESIGN_QUOTA = 'interior_design_quota',
27
27
  INTERIOR_DESIGN_MODEL_ACCESS = 'interior_design_model_access',
28
+ SPELL_CORRECTOR_QUOTA = 'spell_corrector_quota',
29
+ SPELL_CORRECTOR_MODEL_ACCESS = 'spell_corrector_model_access',
30
+ PARAPHRASE_TYPE_ACCESS = 'paraphrase_type_access',
31
+ MARKETPLACE_CARD_MODEL_ACCESS = 'marketplace_card_model_access',
32
+ EDU_TASK_MODEL_ACCESS = 'edu_task_model_access',
33
+ VIDEO_EDITOR_MODEL_ACCESS = 'video_editor_model_access',
28
34
  }
29
35
 
30
36
  export enum SUBSCRIPTION_FEATURE_KIND {
@@ -33,7 +39,6 @@ export enum SUBSCRIPTION_FEATURE_KIND {
33
39
  IMAGE_GENERATION = 'image_generation',
34
40
  TTS = 'tts',
35
41
  STT = 'stt',
36
- PRESENTATIONS = 'presentations',
37
42
  VIDEO = 'video',
38
43
  PRESENTATION = 'presentation',
39
44
  BASE = 'base',
@@ -41,4 +46,9 @@ export enum SUBSCRIPTION_FEATURE_KIND {
41
46
  WRITER = 'writer',
42
47
  IMAGE_EDITOR = 'image_editor',
43
48
  INTERIOR_DESIGN = 'interior_design',
49
+ SPELL_CORRECTOR = 'spell_corrector',
50
+ PARAPHRASE = 'paraphrase',
51
+ MARKETPLACE_CARD = 'marketplace_card',
52
+ EDU_TASK = 'edu_task',
53
+ VIDEO_EDITOR = 'video_editor',
44
54
  }
@@ -1 +1,2 @@
1
1
  export * from './video-editor-model-strategy.enum';
2
+ export * from './video-editor-pricing-rule-type.enum';
@@ -0,0 +1,4 @@
1
+ export enum VIDEO_EDITOR_PRICING_RULE_TYPE {
2
+ FLAT = 'flat',
3
+ PER_SECOND = 'per_second',
4
+ }
@@ -2,3 +2,4 @@ export * from './singup-method.enum';
2
2
  export * from './user-status';
3
3
  export * from './user-sort-by.enum';
4
4
  export * from './sort-order.enum';
5
+ export * from './locale.enum';
@@ -0,0 +1,4 @@
1
+ export enum LOCALE {
2
+ RU = 'ru',
3
+ EN = 'en',
4
+ }
@@ -1,3 +1,53 @@
1
- export function calculateVideoEditingPrice({ pricePerCall }: { pricePerCall: number }) {
2
- return pricePerCall;
1
+ import { VIDEO_EDITOR_PRICING_RULE_TYPE } from '../../constants';
2
+ import {
3
+ VideoEditorModelPricingRuleCondition,
4
+ VideoEditorModelPricingRules,
5
+ VideoEditorPricingRequestParams,
6
+ } from '../../models';
7
+
8
+ function matchesCondition(
9
+ condition: VideoEditorModelPricingRuleCondition,
10
+ params: VideoEditorPricingRequestParams,
11
+ ): boolean {
12
+ const keys = Object.keys(condition) as (keyof VideoEditorModelPricingRuleCondition)[];
13
+
14
+ return keys.every((key) => {
15
+ const expected = condition[key];
16
+ if (expected === undefined || expected === null || expected === '') {
17
+ return true;
18
+ }
19
+
20
+ const value = params[key];
21
+ if (value === undefined || value === null) {
22
+ return false;
23
+ }
24
+
25
+ return value === expected;
26
+ });
27
+ }
28
+
29
+ export function calculateVideoEditingPrice({
30
+ pricePerCall,
31
+ params,
32
+ rules,
33
+ }: {
34
+ pricePerCall: number;
35
+ params: VideoEditorPricingRequestParams;
36
+ rules: VideoEditorModelPricingRules;
37
+ }): number {
38
+ const perSecondRule = rules
39
+ .filter((r) => r.type === VIDEO_EDITOR_PRICING_RULE_TYPE.PER_SECOND)
40
+ .find((r) => matchesCondition(r.condition, params));
41
+
42
+ const base = perSecondRule ? perSecondRule.value * params.duration : pricePerCall;
43
+
44
+ const flatMarkup = rules.reduce((sum, r) => {
45
+ if (r.type !== VIDEO_EDITOR_PRICING_RULE_TYPE.FLAT) {
46
+ return sum;
47
+ }
48
+
49
+ return matchesCondition(r.condition, params) ? sum + r.value : sum;
50
+ }, 0);
51
+
52
+ return Math.ceil(base + flatMarkup);
3
53
  }
@@ -214,6 +214,57 @@ export type InteriorDesignModelAccessFeature = z.infer<
214
214
  typeof InteriorDesignModelAccessFeatureSchema
215
215
  >;
216
216
 
217
+ export const SpellCorrectorQuotaFeatureSchema = SubscriptionFeatureBaseSchema.extend({
218
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.SPELL_CORRECTOR),
219
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.SPELL_CORRECTOR_QUOTA),
220
+ value: z.number(),
221
+ });
222
+ export type SpellCorrectorQuotaFeature = z.infer<typeof SpellCorrectorQuotaFeatureSchema>;
223
+
224
+ export const SpellCorrectorModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
225
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.SPELL_CORRECTOR),
226
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.SPELL_CORRECTOR_MODEL_ACCESS),
227
+ isAvailable: z.boolean(),
228
+ modelId: z.string(),
229
+ });
230
+ export type SpellCorrectorModelAccessFeature = z.infer<
231
+ typeof SpellCorrectorModelAccessFeatureSchema
232
+ >;
233
+
234
+ export const ParaphraseTypeAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
235
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.PARAPHRASE),
236
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.PARAPHRASE_TYPE_ACCESS),
237
+ isAvailable: z.boolean(),
238
+ modelId: z.string(),
239
+ });
240
+ export type ParaphraseTypeAccessFeature = z.infer<typeof ParaphraseTypeAccessFeatureSchema>;
241
+
242
+ export const MarketplaceCardModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
243
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.MARKETPLACE_CARD),
244
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.MARKETPLACE_CARD_MODEL_ACCESS),
245
+ isAvailable: z.boolean(),
246
+ modelId: z.string(),
247
+ });
248
+ export type MarketplaceCardModelAccessFeature = z.infer<
249
+ typeof MarketplaceCardModelAccessFeatureSchema
250
+ >;
251
+
252
+ export const EduTaskModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
253
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.EDU_TASK),
254
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.EDU_TASK_MODEL_ACCESS),
255
+ isAvailable: z.boolean(),
256
+ modelId: z.string(),
257
+ });
258
+ export type EduTaskModelAccessFeature = z.infer<typeof EduTaskModelAccessFeatureSchema>;
259
+
260
+ export const VideoEditorModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
261
+ kind: z.literal(SUBSCRIPTION_FEATURE_KIND.VIDEO_EDITOR),
262
+ type: z.literal(SUBSCRIPTION_FEATURE_TYPE.VIDEO_EDITOR_MODEL_ACCESS),
263
+ isAvailable: z.boolean(),
264
+ modelId: z.string(),
265
+ });
266
+ export type VideoEditorModelAccessFeature = z.infer<typeof VideoEditorModelAccessFeatureSchema>;
267
+
217
268
  export const SubscriptionFeatureSchema = z.union([
218
269
  AiModelAccessFeatureSchema,
219
270
  RequestsQuotaFeatureSchema,
@@ -240,6 +291,12 @@ export const SubscriptionFeatureSchema = z.union([
240
291
  InteriorDesignQuotaFeatureSchema,
241
292
  InteriorDesignModelAccessFeatureSchema,
242
293
  ImageGenerationAccessFeatureSchema,
294
+ SpellCorrectorQuotaFeatureSchema,
295
+ SpellCorrectorModelAccessFeatureSchema,
296
+ ParaphraseTypeAccessFeatureSchema,
297
+ MarketplaceCardModelAccessFeatureSchema,
298
+ EduTaskModelAccessFeatureSchema,
299
+ VideoEditorModelAccessFeatureSchema,
243
300
  ]);
244
301
 
245
302
  export type SubscriptionFeature = z.infer<typeof SubscriptionFeatureSchema>;
@@ -58,3 +58,14 @@ export const SubscriptionWithSubTypesSchema = z.intersection(
58
58
  export const SubscriptionWithFeaturesSchema = SubscriptionSchema.extend({
59
59
  features: z.array(SubscriptionFeatureSchema),
60
60
  });
61
+
62
+ export const SubscriptionWithoutFeaturesSchema = SubscriptionSchema.omit({
63
+ features: true,
64
+ });
65
+
66
+ export const SubscriptionWithSubTypesWithoutFeaturesSchema = z.intersection(
67
+ SubscriptionWithoutFeaturesSchema,
68
+ z.object({
69
+ subTypes: z.array(SubscriptionWithoutFeaturesSchema),
70
+ }),
71
+ );
@@ -16,3 +16,7 @@ export const TeamAccountInviteSchema = z.object({
16
16
  createdAt: z.date(),
17
17
  updatedAt: z.date(),
18
18
  });
19
+
20
+ export const TeamAccountInviteResponseSchema = TeamAccountInviteSchema.omit({
21
+ tokenHash: true,
22
+ });
@@ -40,6 +40,8 @@ export const ImageEditorModelSchema = z.object({
40
40
  uuid: z.string(),
41
41
  title: z.string(),
42
42
  description: z.string(),
43
+ isNew: z.boolean(),
44
+ tierLabel: z.string(),
43
45
  pricePerImage: z.number(),
44
46
  order: z.number(),
45
47
  icons: IconVariantsSchema,
@@ -43,6 +43,7 @@ export const ImageGenerationModelSchema = z.object({
43
43
  order: z.number(),
44
44
  status: z.string(),
45
45
  price: z.number(),
46
+ isNew: z.boolean(),
46
47
  params: ImageGenerationModelParamsSchema,
47
48
  supportsImageAttachment: z.boolean(),
48
49
  maxAttachedImages: z.number(),
@@ -13,3 +13,4 @@ export * from './image-generation';
13
13
  export * from './marketplace-card';
14
14
  export * from './interior-design';
15
15
  export * from './solving-edu-task';
16
+ export * from './spell-corrector';
@@ -0,0 +1,3 @@
1
+ export * from './spell-corrector-config.schema';
2
+ export * from './spell-corrector-job.schema';
3
+ export * from './spell-corrector-model.schema';
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { SpellCorrectorModelSchema } from './spell-corrector-model.schema';
3
+
4
+ export const SpellCorrectorToolConfigSchema = z.object({
5
+ maxSymbols: z.number(),
6
+ models: z.array(SpellCorrectorModelSchema),
7
+ });
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { ToolJobSchema } from '../../tool-job.schema';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export const SpellCorrectorToolJobSchema = ToolJobSchema.extend({
6
+ modelId: z.string().uuid().nullable().optional(),
7
+ userInput: z.string(),
8
+ aiOutput: z.string().nullable().optional(),
9
+ title: z.string(),
10
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
11
+ });
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../icon-variants.schema';
3
+ import { UnlockedBySchema } from '../../unlocked-by-subscription.schema';
4
+
5
+ export const SpellCorrectorModelSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ title: z.string(),
8
+ description: z.string(),
9
+ icon: z.string(),
10
+ price: z.number(),
11
+ order: z.number(),
12
+ canUse: z.boolean(),
13
+ icons: IconVariantsSchema,
14
+ unlockedBy: UnlockedBySchema.nullable(),
15
+ });
@@ -3,6 +3,8 @@ import { z } from 'zod';
3
3
  export const STTResponseSchema = z.object({
4
4
  raw: z.object({}),
5
5
  md: z.string(),
6
+ txtUrl: z.string().optional(),
7
+ srtUrl: z.string().optional(),
6
8
  });
7
9
 
8
10
  export type STTResponse = z.infer<typeof STTResponseSchema>;
@@ -1,6 +1,19 @@
1
1
  import { z } from 'zod';
2
2
  import { VideoModelSchema } from './video-model.schema';
3
+ import { IconVariantsSchema } from '../../icon-variants.schema';
3
4
 
4
- export const VideoConfigSchema = z.object({
5
+ export const VideoVendorSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ title: z.string(),
8
+ order: z.number(),
9
+ icons: IconVariantsSchema,
5
10
  models: z.array(VideoModelSchema),
6
11
  });
12
+
13
+ export type VideoVendor = z.infer<typeof VideoVendorSchema>;
14
+
15
+ export const VideoConfigSchema = z.object({
16
+ vendors: z.array(VideoVendorSchema),
17
+ });
18
+
19
+ export type VideoConfig = z.infer<typeof VideoConfigSchema>;
@@ -2,6 +2,13 @@ import { z } from 'zod';
2
2
  import { USER_REACTION } from '../../../constants';
3
3
  import { ToolJobSchema } from '../../tool-job.schema';
4
4
 
5
+ export const VideoEditorJobParamsSchema = z.object({
6
+ duration: z.number().optional(),
7
+ resolution: z.string().optional(),
8
+ });
9
+
10
+ export type VideoEditorJobParams = z.infer<typeof VideoEditorJobParamsSchema>;
11
+
5
12
  export const VideoEditorJobSchema = ToolJobSchema.extend({
6
13
  title: z.string(),
7
14
  prompt: z.string(),
@@ -21,6 +28,7 @@ export const VideoEditorJobSchema = ToolJobSchema.extend({
21
28
  url: z.string(),
22
29
  })
23
30
  .nullable(),
31
+ params: VideoEditorJobParamsSchema.optional(),
24
32
  modelId: z.string(),
25
33
  isPublished: z.boolean(),
26
34
  postId: z.string().nullable(),
@@ -1,11 +1,44 @@
1
1
  import { z } from 'zod';
2
2
  import { VIDEO_EDITOR_MODEL_LIMITATION } from '../../../constants/tool-video-editor/enums/video-editor-model-limitation.enum';
3
+ import { VIDEO_EDITOR_PRICING_RULE_TYPE } from '../../../constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum';
3
4
  import { IconVariantsSchema } from '../../icon-variants.schema';
4
5
  import { UnlockedBySchema } from '../../unlocked-by-subscription.schema';
5
6
 
6
7
  export const VideoEditorModelParamsSchema = z.object({
7
- supportedFormats: z.array(z.string()),
8
+ duration: z
9
+ .object({
10
+ options: z.array(z.number()),
11
+ })
12
+ .optional(),
13
+ resolution: z
14
+ .object({
15
+ options: z.array(z.string()),
16
+ })
17
+ .optional(),
18
+ });
19
+
20
+ export const VideoEditorPricingRequestParamsSchema = z.object({
21
+ duration: z.number(),
22
+ resolution: z.string().optional(),
8
23
  });
24
+ export type VideoEditorPricingRequestParams = z.infer<typeof VideoEditorPricingRequestParamsSchema>;
25
+
26
+ export const VideoEditorModelPricingRuleConditionSchema = z.object({
27
+ duration: z.number().optional(),
28
+ resolution: z.string().optional(),
29
+ });
30
+ export type VideoEditorModelPricingRuleCondition = z.infer<
31
+ typeof VideoEditorModelPricingRuleConditionSchema
32
+ >;
33
+
34
+ export const VideoEditorModelPricingRulesSchema = z.array(
35
+ z.object({
36
+ type: z.nativeEnum(VIDEO_EDITOR_PRICING_RULE_TYPE),
37
+ condition: VideoEditorModelPricingRuleConditionSchema,
38
+ value: z.number(),
39
+ }),
40
+ );
41
+ export type VideoEditorModelPricingRules = z.infer<typeof VideoEditorModelPricingRulesSchema>;
9
42
 
10
43
  export const VideoEditorModelSchema = z.object({
11
44
  uuid: z.string(),
@@ -19,6 +52,8 @@ export const VideoEditorModelSchema = z.object({
19
52
  maxInputVideoSizeBytes: z.number(),
20
53
  maxInputVideoDurationInSeconds: z.number(),
21
54
  supportedFormats: z.array(z.string()),
55
+ params: VideoEditorModelParamsSchema,
56
+ pricingRules: VideoEditorModelPricingRulesSchema,
22
57
  createdAt: z.date(),
23
58
  updatedAt: z.date(),
24
59
  unlockedBy: UnlockedBySchema.nullable(),
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { UserToSubscriptionSchema } from './user-to-subscription.schema';
3
3
  import { UserToProductSchema } from './user-to-product.schema';
4
+ import { LOCALE } from '../constants';
4
5
 
5
6
  export const UserSchema = z.object({
6
7
  uuid: z.string().uuid(),
@@ -13,6 +14,7 @@ export const UserSchema = z.object({
13
14
  restoreTokenHash: z.string(),
14
15
  tokenBonusBalance: z.number(),
15
16
  role: z.string(),
17
+ locale: z.nativeEnum(LOCALE),
16
18
 
17
19
  createdAt: z.date(),
18
20
  updatedAt: z.date(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",