@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.
- package/api/controllers/http/community.ts +1 -0
- package/api/controllers/http/index.ts +1 -0
- package/api/controllers/http/spell-corrector.ts +14 -0
- package/api/controllers/http/unregistered-user.ts +5 -0
- package/api/controllers/http/user.ts +1 -0
- package/api/routes.ts +36 -0
- package/build/api/controllers/http/community.js +1 -0
- package/build/api/controllers/http/index.js +1 -0
- package/build/api/controllers/http/spell-corrector.js +16 -0
- package/build/api/controllers/http/unregistered-user.js +5 -1
- package/build/api/controllers/http/user.js +1 -0
- package/build/api/routes.js +25 -0
- package/build/commands/community/index.js +1 -0
- package/build/commands/community/set-visibility-community-post.command.js +21 -0
- package/build/commands/subscription/buy-subscription.command.js +10 -0
- package/build/commands/subscription/find-subscription.command.js +4 -1
- package/build/commands/subscription/get-available-upgrades.command.js +3 -1
- package/build/commands/team-account/invite-team-account-member.command.js +2 -1
- package/build/commands/tools/index.js +1 -0
- package/build/commands/tools/spell-corrector/delete-all-spell-corrector-jobs.command.js +8 -0
- package/build/commands/tools/spell-corrector/delete-spell-corrector-job-by-uuid.command.js +11 -0
- package/build/commands/tools/spell-corrector/find-spell-corrector-job-by-uuid.command.js +14 -0
- package/build/commands/tools/spell-corrector/find-spell-corrector-jobs.command.js +18 -0
- package/build/commands/tools/spell-corrector/get-spell-corrector-tool-config.command.js +11 -0
- package/build/commands/tools/spell-corrector/index.js +25 -0
- package/build/commands/tools/spell-corrector/retry-spell-corrector-job.command.js +14 -0
- package/build/commands/tools/spell-corrector/set-reaction-to-spell-corrector-job.command.js +28 -0
- package/build/commands/tools/spell-corrector/spell-corrector.command.js +15 -0
- package/build/commands/tools/spell-corrector/update-spell-corrector-job-title.command.js +17 -0
- package/build/commands/tools/video-editor/edit-video.command.js +2 -0
- package/build/commands/tools/video-editor/retry-video-editor-job.command.js +2 -0
- package/build/commands/unregistered-user/index.js +1 -0
- package/build/commands/unregistered-user/patch-locale.command.js +16 -0
- package/build/commands/user/get-me.command.js +1 -0
- package/build/commands/user/index.js +1 -0
- package/build/commands/user/patch-locale.command.js +16 -0
- package/build/constants/ai-model/enums/ai-model-strategy.enum.js +1 -0
- package/build/constants/model/enums/unified-model-content-type.enum.js +2 -0
- package/build/constants/subscription/enums/subscription-feature-type.enum.js +11 -1
- package/build/constants/tool-video-editor/enums/index.js +1 -0
- package/build/constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum.js +8 -0
- package/build/constants/user/enums/index.js +1 -0
- package/build/constants/user/enums/locale.enum.js +8 -0
- package/build/helpers/video-editor/calculate-video-editing-price.helper.js +27 -2
- package/build/models/subscription-feature.schema.js +42 -1
- package/build/models/subscription.schema.js +7 -1
- package/build/models/team-account/team-account-invite.schema.js +4 -1
- package/build/models/tools/image-editor/image-editor-model.schema.js +2 -0
- package/build/models/tools/image-generation/image-generation-model.schema.js +1 -0
- package/build/models/tools/index.js +1 -0
- package/build/models/tools/spell-corrector/index.js +19 -0
- package/build/models/tools/spell-corrector/spell-corrector-config.schema.js +9 -0
- package/build/models/tools/spell-corrector/spell-corrector-job.schema.js +13 -0
- package/build/models/tools/spell-corrector/spell-corrector-model.schema.js +17 -0
- package/build/models/tools/stt/stt-response.schema.js +2 -0
- package/build/models/tools/video/video-config.schema.js +10 -2
- package/build/models/tools/video-editor/video-editor-job.schema.js +6 -1
- package/build/models/tools/video-editor/video-editor-model.schema.js +27 -2
- package/build/models/user.schema.js +2 -0
- package/commands/community/index.ts +1 -0
- package/commands/community/set-visibility-community-post.command.ts +24 -0
- package/commands/subscription/buy-subscription.command.ts +11 -0
- package/commands/subscription/find-subscription.command.ts +11 -1
- package/commands/subscription/get-available-upgrades.command.ts +3 -1
- package/commands/team-account/invite-team-account-member.command.ts +3 -2
- package/commands/tools/index.ts +1 -0
- package/commands/tools/spell-corrector/delete-all-spell-corrector-jobs.command.ts +6 -0
- package/commands/tools/spell-corrector/delete-spell-corrector-job-by-uuid.command.ts +11 -0
- package/commands/tools/spell-corrector/find-spell-corrector-job-by-uuid.command.ts +16 -0
- package/commands/tools/spell-corrector/find-spell-corrector-jobs.command.ts +18 -0
- package/commands/tools/spell-corrector/get-spell-corrector-tool-config.command.ts +10 -0
- package/commands/tools/spell-corrector/index.ts +9 -0
- package/commands/tools/spell-corrector/retry-spell-corrector-job.command.ts +14 -0
- package/commands/tools/spell-corrector/set-reaction-to-spell-corrector-job.command.ts +33 -0
- package/commands/tools/spell-corrector/spell-corrector.command.ts +17 -0
- package/commands/tools/spell-corrector/update-spell-corrector-job-title.command.ts +19 -0
- package/commands/tools/video-editor/edit-video.command.ts +2 -0
- package/commands/tools/video-editor/retry-video-editor-job.command.ts +2 -0
- package/commands/unregistered-user/index.ts +1 -0
- package/commands/unregistered-user/patch-locale.command.ts +18 -0
- package/commands/user/get-me.command.ts +2 -1
- package/commands/user/index.ts +1 -0
- package/commands/user/patch-locale.command.ts +18 -0
- package/constants/ai-model/enums/ai-model-strategy.enum.ts +1 -0
- package/constants/model/enums/unified-model-content-type.enum.ts +2 -0
- package/constants/subscription/enums/subscription-feature-type.enum.ts +11 -1
- package/constants/tool-video-editor/enums/index.ts +1 -0
- package/constants/tool-video-editor/enums/video-editor-pricing-rule-type.enum.ts +4 -0
- package/constants/user/enums/index.ts +1 -0
- package/constants/user/enums/locale.enum.ts +4 -0
- package/helpers/video-editor/calculate-video-editing-price.helper.ts +52 -2
- package/models/subscription-feature.schema.ts +57 -0
- package/models/subscription.schema.ts +11 -0
- package/models/team-account/team-account-invite.schema.ts +4 -0
- package/models/tools/image-editor/image-editor-model.schema.ts +2 -0
- package/models/tools/image-generation/image-generation-model.schema.ts +1 -0
- package/models/tools/index.ts +1 -0
- package/models/tools/spell-corrector/index.ts +3 -0
- package/models/tools/spell-corrector/spell-corrector-config.schema.ts +7 -0
- package/models/tools/spell-corrector/spell-corrector-job.schema.ts +11 -0
- package/models/tools/spell-corrector/spell-corrector-model.schema.ts +15 -0
- package/models/tools/stt/stt-response.schema.ts +2 -0
- package/models/tools/video/video-config.schema.ts +14 -1
- package/models/tools/video-editor/video-editor-job.schema.ts +8 -0
- package/models/tools/video-editor/video-editor-model.schema.ts +36 -1
- package/models/user.schema.ts +2 -0
- 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
|
+
}
|
|
@@ -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
|
|
|
@@ -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
|
});
|
package/commands/user/index.ts
CHANGED
|
@@ -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',
|
|
@@ -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,3 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
);
|
|
@@ -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(),
|
package/models/tools/index.ts
CHANGED
|
@@ -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
|
+
});
|
|
@@ -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
|
|
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
|
-
|
|
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(),
|
package/models/user.schema.ts
CHANGED
|
@@ -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(),
|