@purpleschool/gptbot 0.5.79 → 0.5.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.
Files changed (43) hide show
  1. package/api/controllers/http/ai-vendor.ts +9 -0
  2. package/api/controllers/http/index.ts +1 -0
  3. package/build/api/controllers/http/ai-vendor.js +11 -0
  4. package/build/api/controllers/http/index.js +1 -0
  5. package/build/commands/ai-vendor/create-ai-vendor.command.js +16 -0
  6. package/build/commands/ai-vendor/delete-ai-vendor.command.js +11 -0
  7. package/build/commands/ai-vendor/find-ai-vendor-by-uuid.query.js +14 -0
  8. package/build/commands/ai-vendor/find-ai-vendors-by-criteria.query.js +16 -0
  9. package/build/commands/ai-vendor/find-all-ai-vendors.command.js +11 -0
  10. package/build/commands/ai-vendor/index.js +22 -0
  11. package/build/commands/ai-vendor/update-ai-vendor.command.js +14 -0
  12. package/build/commands/index.js +1 -0
  13. package/build/constants/ai-vendor/enums/ai-vendor.enum.js +8 -0
  14. package/build/constants/ai-vendor/enums/index.js +17 -0
  15. package/build/constants/ai-vendor/index.js +17 -0
  16. package/build/constants/errors/errors.js +20 -0
  17. package/build/constants/subscription/free-subscription.constant.js +10 -1
  18. package/build/models/ai-model.schema.js +9 -2
  19. package/build/models/ai-vendor.schema.js +23 -0
  20. package/build/models/index.js +1 -0
  21. package/build/models/product.schema.js +10 -0
  22. package/build/models/subscription-feature.schema.js +8 -2
  23. package/build/models/subscription.schema.js +10 -0
  24. package/commands/ai-vendor/create-ai-vendor.command.ts +17 -0
  25. package/commands/ai-vendor/delete-ai-vendor.command.ts +12 -0
  26. package/commands/ai-vendor/find-ai-vendor-by-uuid.query.ts +15 -0
  27. package/commands/ai-vendor/find-ai-vendors-by-criteria.query.ts +17 -0
  28. package/commands/ai-vendor/find-all-ai-vendors.command.ts +9 -0
  29. package/commands/ai-vendor/index.ts +6 -0
  30. package/commands/ai-vendor/update-ai-vendor.command.ts +15 -0
  31. package/commands/index.ts +1 -0
  32. package/constants/ai-vendor/enums/ai-vendor.enum.ts +4 -0
  33. package/constants/ai-vendor/enums/index.ts +1 -0
  34. package/constants/ai-vendor/index.ts +1 -0
  35. package/constants/errors/errors.ts +20 -0
  36. package/constants/subscription/free-subscription.constant.ts +10 -1
  37. package/models/ai-model.schema.ts +9 -2
  38. package/models/ai-vendor.schema.ts +21 -0
  39. package/models/index.ts +1 -0
  40. package/models/product.schema.ts +10 -0
  41. package/models/subscription-feature.schema.ts +8 -2
  42. package/models/subscription.schema.ts +10 -0
  43. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ export const AI_VENDOR_CONTROLLER = 'ai-vendor';
2
+
3
+ export const AI_VENDOR_ROUTES = {
4
+ CREATE: '',
5
+ UPDATE: (uuid: string) => `${uuid}`,
6
+ FIND_ALL: 'all',
7
+ DELETE: (uuid: string) => `${uuid}`,
8
+ FIND_BY_UUID: (uuid: string) => `${uuid}`,
9
+ } as const;
@@ -1,5 +1,6 @@
1
1
  export * from './account-merge';
2
2
  export * from './ai-model';
3
+ export * from './ai-vendor';
3
4
  export * from './auth';
4
5
  export * from './blog';
5
6
  export * from './category';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AI_VENDOR_ROUTES = exports.AI_VENDOR_CONTROLLER = void 0;
4
+ exports.AI_VENDOR_CONTROLLER = 'ai-vendor';
5
+ exports.AI_VENDOR_ROUTES = {
6
+ CREATE: '',
7
+ UPDATE: (uuid) => `${uuid}`,
8
+ FIND_ALL: 'all',
9
+ DELETE: (uuid) => `${uuid}`,
10
+ FIND_BY_UUID: (uuid) => `${uuid}`,
11
+ };
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./account-merge"), exports);
18
18
  __exportStar(require("./ai-model"), exports);
19
+ __exportStar(require("./ai-vendor"), exports);
19
20
  __exportStar(require("./auth"), exports);
20
21
  __exportStar(require("./blog"), exports);
21
22
  __exportStar(require("./category"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateAiVendorCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var CreateAiVendorCommand;
7
+ (function (CreateAiVendorCommand) {
8
+ CreateAiVendorCommand.RequestSchema = models_1.AiVendorSchema.omit({
9
+ uuid: true,
10
+ createdAt: true,
11
+ updatedAt: true,
12
+ });
13
+ CreateAiVendorCommand.ResponseSchema = zod_1.z.object({
14
+ data: models_1.AiVendorSchema,
15
+ });
16
+ })(CreateAiVendorCommand || (exports.CreateAiVendorCommand = CreateAiVendorCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAiVendorCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var DeleteAiVendorCommand;
6
+ (function (DeleteAiVendorCommand) {
7
+ DeleteAiVendorCommand.RequestSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ });
10
+ DeleteAiVendorCommand.ResponseSchema = zod_1.z.void();
11
+ })(DeleteAiVendorCommand || (exports.DeleteAiVendorCommand = DeleteAiVendorCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindAiVendorByUuidCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const ai_vendor_schema_1 = require("../../models/ai-vendor.schema");
6
+ var FindAiVendorByUuidCommand;
7
+ (function (FindAiVendorByUuidCommand) {
8
+ FindAiVendorByUuidCommand.RequestSchema = zod_1.z.object({
9
+ uuid: zod_1.z.string().uuid(),
10
+ });
11
+ FindAiVendorByUuidCommand.ResponseSchema = zod_1.z.object({
12
+ data: ai_vendor_schema_1.AiVendorSchema,
13
+ });
14
+ })(FindAiVendorByUuidCommand || (exports.FindAiVendorByUuidCommand = FindAiVendorByUuidCommand = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindAiVendorsByCriteriaCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const ai_vendor_schema_1 = require("../../models/ai-vendor.schema");
6
+ var FindAiVendorsByCriteriaCommand;
7
+ (function (FindAiVendorsByCriteriaCommand) {
8
+ FindAiVendorsByCriteriaCommand.RequestSchema = ai_vendor_schema_1.AiVendorSchema.omit({
9
+ uuid: true,
10
+ createdAt: true,
11
+ updatedAt: true,
12
+ });
13
+ FindAiVendorsByCriteriaCommand.ResponseSchema = zod_1.z.object({
14
+ data: zod_1.z.array(ai_vendor_schema_1.AiVendorSchema),
15
+ });
16
+ })(FindAiVendorsByCriteriaCommand || (exports.FindAiVendorsByCriteriaCommand = FindAiVendorsByCriteriaCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindAllAiVendorsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const ai_vendor_schema_1 = require("../../models/ai-vendor.schema");
6
+ var FindAllAiVendorsCommand;
7
+ (function (FindAllAiVendorsCommand) {
8
+ FindAllAiVendorsCommand.ResponseSchema = zod_1.z.object({
9
+ data: zod_1.z.array(ai_vendor_schema_1.AiVendorSchema),
10
+ });
11
+ })(FindAllAiVendorsCommand || (exports.FindAllAiVendorsCommand = FindAllAiVendorsCommand = {}));
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./create-ai-vendor.command"), exports);
18
+ __exportStar(require("./update-ai-vendor.command"), exports);
19
+ __exportStar(require("./delete-ai-vendor.command"), exports);
20
+ __exportStar(require("./find-ai-vendor-by-uuid.query"), exports);
21
+ __exportStar(require("./find-all-ai-vendors.command"), exports);
22
+ __exportStar(require("./find-ai-vendors-by-criteria.query"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateAiVendorCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const ai_vendor_schema_1 = require("../../models/ai-vendor.schema");
6
+ var UpdateAiVendorCommand;
7
+ (function (UpdateAiVendorCommand) {
8
+ UpdateAiVendorCommand.RequestSchema = ai_vendor_schema_1.AiVendorSchema.omit({
9
+ uuid: true,
10
+ }).partial();
11
+ UpdateAiVendorCommand.ResponseSchema = zod_1.z.object({
12
+ data: ai_vendor_schema_1.AiVendorSchema,
13
+ });
14
+ })(UpdateAiVendorCommand || (exports.UpdateAiVendorCommand = UpdateAiVendorCommand = {}));
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./account-merge"), exports);
18
18
  __exportStar(require("./ai-model"), exports);
19
+ __exportStar(require("./ai-vendor"), exports);
19
20
  __exportStar(require("./auth"), exports);
20
21
  __exportStar(require("./blog"), exports);
21
22
  __exportStar(require("./category"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AI_VENDOR_STATUS = void 0;
4
+ var AI_VENDOR_STATUS;
5
+ (function (AI_VENDOR_STATUS) {
6
+ AI_VENDOR_STATUS["ACTIVE"] = "active";
7
+ AI_VENDOR_STATUS["INACTIVE"] = "inactive";
8
+ })(AI_VENDOR_STATUS || (exports.AI_VENDOR_STATUS = AI_VENDOR_STATUS = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ai-vendor.enum"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums"), exports);
@@ -1124,6 +1124,26 @@ exports.ERRORS = {
1124
1124
  message: 'Не удалось найти указанный тип голоса',
1125
1125
  httpCode: 400,
1126
1126
  },
1127
+ AI_VENDOR_CREATE_ERROR: {
1128
+ code: 'A243',
1129
+ message: 'Произошла ошибка при создании AI Vendor',
1130
+ httpCode: 500,
1131
+ },
1132
+ AI_VENDOR_UPDATE_ERROR: {
1133
+ code: 'A244',
1134
+ message: 'Произошла ошибка при обновлении AI Vendor',
1135
+ httpCode: 500,
1136
+ },
1137
+ AI_VENDOR_DELETE_ERROR: {
1138
+ code: 'A245',
1139
+ message: 'Произошла ошибка при удалении AI Vendor',
1140
+ httpCode: 500,
1141
+ },
1142
+ AI_VENDOR_FIND_ERROR: {
1143
+ code: 'A246',
1144
+ message: 'AI Vendor не найден',
1145
+ httpCode: 404,
1146
+ },
1127
1147
  AI_MODEL_DOES_NOT_SUPPORT_WEB_SEARCH: {
1128
1148
  code: 'A250',
1129
1149
  message: 'ИИ модель не поддерживает поиск в интернете',
@@ -14,7 +14,16 @@ exports.FREE_SUBSCRIPTION_DATA = {
14
14
  maxDiscountPercent: 0,
15
15
  period: 1,
16
16
  plan: enums_1.SUBSCRIPTION_PLAN.mock,
17
- icon: 'https://rugpt.hb.bizmrg.com/images/images/ac095d48-a66b-4862-82c7-eb120b5bd467.svg',
17
+ icons: {
18
+ light: {
19
+ svg: 'https://rugpt.hb.bizmrg.com/images/images/81b60ce5-b687-43ff-85dd-e4e47c8e81e9.svg',
20
+ png: 'https://rugpt.hb.bizmrg.com/images/images/e1bb1acd-a387-4596-8fd5-0159f692ff11.png',
21
+ },
22
+ dark: {
23
+ svg: 'https://rugpt.hb.bizmrg.com/images/images/ac095d48-a66b-4862-82c7-eb120b5bd467.svg',
24
+ png: 'https://rugpt.hb.bizmrg.com/images/images/e2208949-a73a-4137-b5bd-760599a70691.png',
25
+ },
26
+ },
18
27
  interval: '',
19
28
  createdAt: new Date(),
20
29
  updatedAt: new Date(),
@@ -16,9 +16,16 @@ exports.AiModelSchema = zod_1.z.object({
16
16
  contentType: zod_1.z.enum(Object.values(constants_1.AI_MODEL_CONTENT_TYPE)),
17
17
  features: zod_1.z.array(zod_1.z.nativeEnum(constants_1.AI_MODEL_FEATURE)),
18
18
  iconVariants: zod_1.z.object({
19
- svg: zod_1.z.string(),
20
- png: zod_1.z.string(),
19
+ light: zod_1.z.object({
20
+ svg: zod_1.z.string(),
21
+ png: zod_1.z.string(),
22
+ }),
23
+ dark: zod_1.z.object({
24
+ svg: zod_1.z.string(),
25
+ png: zod_1.z.string(),
26
+ }),
21
27
  }),
28
+ vendorId: zod_1.z.string().uuid().nullable(),
22
29
  maxInputLength: zod_1.z.number(),
23
30
  config: ai_model_config_schema_1.AiModelConfigSchema,
24
31
  createdAt: zod_1.z.date(),
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AiVendorSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const ai_vendor_1 = require("../constants/ai-vendor");
6
+ exports.AiVendorSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string().uuid(),
8
+ title: zod_1.z.string(),
9
+ icons: zod_1.z.object({
10
+ light: zod_1.z.object({
11
+ svg: zod_1.z.string(),
12
+ png: zod_1.z.string(),
13
+ }),
14
+ dark: zod_1.z.object({
15
+ svg: zod_1.z.string(),
16
+ png: zod_1.z.string(),
17
+ }),
18
+ }),
19
+ order: zod_1.z.number(),
20
+ status: zod_1.z.nativeEnum(ai_vendor_1.AI_VENDOR_STATUS),
21
+ createdAt: zod_1.z.date(),
22
+ updatedAt: zod_1.z.date(),
23
+ });
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ai-model-config.schema"), exports);
18
18
  __exportStar(require("./ai-model-formatted.schema"), exports);
19
19
  __exportStar(require("./ai-model.schema"), exports);
20
+ __exportStar(require("./ai-vendor.schema"), exports);
20
21
  __exportStar(require("./category.schema"), exports);
21
22
  __exportStar(require("./chat.schema"), exports);
22
23
  __exportStar(require("./cloud-payments-receipt.schema"), exports);
@@ -13,6 +13,16 @@ exports.ProductSchema = zod_1.z.object({
13
13
  requests: zod_1.z.number(),
14
14
  price: zod_1.z.number(),
15
15
  icon: zod_1.z.string(),
16
+ icons: zod_1.z.object({
17
+ light: zod_1.z.object({
18
+ png: zod_1.z.string(),
19
+ svg: zod_1.z.string(),
20
+ }),
21
+ dark: zod_1.z.object({
22
+ png: zod_1.z.string(),
23
+ svg: zod_1.z.string(),
24
+ }),
25
+ }),
16
26
  features: zod_1.z.array(subscription_feature_schema_1.SubscriptionFeatureSchema),
17
27
  maxInputLength: zod_1.z.number(),
18
28
  maxInputTokens: zod_1.z.number(),
@@ -6,8 +6,14 @@ const zod_1 = require("zod");
6
6
  exports.SubscriptionFeatureBaseSchema = zod_1.z.object({
7
7
  title: zod_1.z.string(),
8
8
  iconVariants: zod_1.z.object({
9
- svg: zod_1.z.string(),
10
- png: zod_1.z.string(),
9
+ light: zod_1.z.object({
10
+ svg: zod_1.z.string(),
11
+ png: zod_1.z.string(),
12
+ }),
13
+ dark: zod_1.z.object({
14
+ svg: zod_1.z.string(),
15
+ png: zod_1.z.string(),
16
+ }),
11
17
  }),
12
18
  type: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_FEATURE_TYPE),
13
19
  });
@@ -16,6 +16,16 @@ exports.SubscriptionSchema = zod_1.z.object({
16
16
  period: zod_1.z.number(),
17
17
  tokens: zod_1.z.number(),
18
18
  icon: zod_1.z.string(),
19
+ icons: zod_1.z.object({
20
+ light: zod_1.z.object({
21
+ png: zod_1.z.string(),
22
+ svg: zod_1.z.string(),
23
+ }),
24
+ dark: zod_1.z.object({
25
+ png: zod_1.z.string(),
26
+ svg: zod_1.z.string(),
27
+ }),
28
+ }),
19
29
  action: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_ACTION).optional().nullable(),
20
30
  features: zod_1.z.array(subscription_feature_schema_1.SubscriptionFeatureSchema),
21
31
  maxInputLength: zod_1.z.number(),
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { AiVendorSchema } from '../../models';
3
+
4
+ export namespace CreateAiVendorCommand {
5
+ export const RequestSchema = AiVendorSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: AiVendorSchema,
15
+ });
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteAiVendorCommand {
4
+ export const RequestSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = z.void();
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { AiVendorSchema } from '../../models/ai-vendor.schema';
3
+
4
+ export namespace FindAiVendorByUuidCommand {
5
+ export const RequestSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: AiVendorSchema,
13
+ });
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { AiVendorSchema } from '../../models/ai-vendor.schema';
3
+
4
+ export namespace FindAiVendorsByCriteriaCommand {
5
+ export const RequestSchema = AiVendorSchema.omit({
6
+ uuid: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ export const ResponseSchema = z.object({
14
+ data: z.array(AiVendorSchema),
15
+ });
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { AiVendorSchema } from '../../models/ai-vendor.schema';
3
+
4
+ export namespace FindAllAiVendorsCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: z.array(AiVendorSchema),
7
+ });
8
+ export type Response = z.infer<typeof ResponseSchema>;
9
+ }
@@ -0,0 +1,6 @@
1
+ export * from './create-ai-vendor.command';
2
+ export * from './update-ai-vendor.command';
3
+ export * from './delete-ai-vendor.command';
4
+ export * from './find-ai-vendor-by-uuid.query';
5
+ export * from './find-all-ai-vendors.command';
6
+ export * from './find-ai-vendors-by-criteria.query';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { AiVendorSchema } from '../../models/ai-vendor.schema';
3
+
4
+ export namespace UpdateAiVendorCommand {
5
+ export const RequestSchema = AiVendorSchema.omit({
6
+ uuid: true,
7
+ }).partial();
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: AiVendorSchema,
13
+ });
14
+ export type Response = z.infer<typeof ResponseSchema>;
15
+ }
package/commands/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './account-merge';
2
2
  export * from './ai-model';
3
+ export * from './ai-vendor';
3
4
  export * from './auth';
4
5
  export * from './blog';
5
6
  export * from './category';
@@ -0,0 +1,4 @@
1
+ export enum AI_VENDOR_STATUS {
2
+ ACTIVE = 'active',
3
+ INACTIVE = 'inactive',
4
+ }
@@ -0,0 +1 @@
1
+ export * from './ai-vendor.enum';
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -1130,6 +1130,26 @@ export const ERRORS = {
1130
1130
  message: 'Не удалось найти указанный тип голоса',
1131
1131
  httpCode: 400,
1132
1132
  },
1133
+ AI_VENDOR_CREATE_ERROR: {
1134
+ code: 'A243',
1135
+ message: 'Произошла ошибка при создании AI Vendor',
1136
+ httpCode: 500,
1137
+ },
1138
+ AI_VENDOR_UPDATE_ERROR: {
1139
+ code: 'A244',
1140
+ message: 'Произошла ошибка при обновлении AI Vendor',
1141
+ httpCode: 500,
1142
+ },
1143
+ AI_VENDOR_DELETE_ERROR: {
1144
+ code: 'A245',
1145
+ message: 'Произошла ошибка при удалении AI Vendor',
1146
+ httpCode: 500,
1147
+ },
1148
+ AI_VENDOR_FIND_ERROR: {
1149
+ code: 'A246',
1150
+ message: 'AI Vendor не найден',
1151
+ httpCode: 404,
1152
+ },
1133
1153
  AI_MODEL_DOES_NOT_SUPPORT_WEB_SEARCH: {
1134
1154
  code: 'A250',
1135
1155
  message: 'ИИ модель не поддерживает поиск в интернете',
@@ -17,7 +17,16 @@ export const FREE_SUBSCRIPTION_DATA = {
17
17
  maxDiscountPercent: 0,
18
18
  period: 1,
19
19
  plan: SUBSCRIPTION_PLAN.mock,
20
- icon: 'https://rugpt.hb.bizmrg.com/images/images/ac095d48-a66b-4862-82c7-eb120b5bd467.svg',
20
+ icons: {
21
+ light: {
22
+ svg: 'https://rugpt.hb.bizmrg.com/images/images/81b60ce5-b687-43ff-85dd-e4e47c8e81e9.svg',
23
+ png: 'https://rugpt.hb.bizmrg.com/images/images/e1bb1acd-a387-4596-8fd5-0159f692ff11.png',
24
+ },
25
+ dark: {
26
+ svg: 'https://rugpt.hb.bizmrg.com/images/images/ac095d48-a66b-4862-82c7-eb120b5bd467.svg',
27
+ png: 'https://rugpt.hb.bizmrg.com/images/images/e2208949-a73a-4137-b5bd-760599a70691.png',
28
+ },
29
+ },
21
30
  interval: '',
22
31
  createdAt: new Date(),
23
32
  updatedAt: new Date(),
@@ -19,9 +19,16 @@ export const AiModelSchema = z.object({
19
19
  contentType: z.enum(Object.values(AI_MODEL_CONTENT_TYPE) as [TAIModelContentTypeEnum]),
20
20
  features: z.array(z.nativeEnum(AI_MODEL_FEATURE)),
21
21
  iconVariants: z.object({
22
- svg: z.string(),
23
- png: z.string(),
22
+ light: z.object({
23
+ svg: z.string(),
24
+ png: z.string(),
25
+ }),
26
+ dark: z.object({
27
+ svg: z.string(),
28
+ png: z.string(),
29
+ }),
24
30
  }),
31
+ vendorId: z.string().uuid().nullable(),
25
32
  maxInputLength: z.number(),
26
33
  config: AiModelConfigSchema,
27
34
  createdAt: z.date(),
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { AI_VENDOR_STATUS } from '../constants/ai-vendor';
3
+
4
+ export const AiVendorSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ title: z.string(),
7
+ icons: z.object({
8
+ light: z.object({
9
+ svg: z.string(),
10
+ png: z.string(),
11
+ }),
12
+ dark: z.object({
13
+ svg: z.string(),
14
+ png: z.string(),
15
+ }),
16
+ }),
17
+ order: z.number(),
18
+ status: z.nativeEnum(AI_VENDOR_STATUS),
19
+ createdAt: z.date(),
20
+ updatedAt: z.date(),
21
+ });
package/models/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './ai-model-config.schema';
2
2
  export * from './ai-model-formatted.schema';
3
3
  export * from './ai-model.schema';
4
+ export * from './ai-vendor.schema';
4
5
  export * from './category.schema';
5
6
  export * from './chat.schema';
6
7
  export * from './cloud-payments-receipt.schema';
@@ -12,6 +12,16 @@ export const ProductSchema = z.object({
12
12
  requests: z.number(),
13
13
  price: z.number(),
14
14
  icon: z.string(),
15
+ icons: z.object({
16
+ light: z.object({
17
+ png: z.string(),
18
+ svg: z.string(),
19
+ }),
20
+ dark: z.object({
21
+ png: z.string(),
22
+ svg: z.string(),
23
+ }),
24
+ }),
15
25
  features: z.array(SubscriptionFeatureSchema),
16
26
  maxInputLength: z.number(),
17
27
  maxInputTokens: z.number(),
@@ -4,8 +4,14 @@ import { z } from 'zod';
4
4
  export const SubscriptionFeatureBaseSchema = z.object({
5
5
  title: z.string(),
6
6
  iconVariants: z.object({
7
- svg: z.string(),
8
- png: z.string(),
7
+ light: z.object({
8
+ svg: z.string(),
9
+ png: z.string(),
10
+ }),
11
+ dark: z.object({
12
+ svg: z.string(),
13
+ png: z.string(),
14
+ }),
9
15
  }),
10
16
  type: z.nativeEnum(SUBSCRIPTION_FEATURE_TYPE),
11
17
  });
@@ -14,6 +14,16 @@ export const SubscriptionSchema = z.object({
14
14
  period: z.number(),
15
15
  tokens: z.number(),
16
16
  icon: z.string(),
17
+ icons: z.object({
18
+ light: z.object({
19
+ png: z.string(),
20
+ svg: z.string(),
21
+ }),
22
+ dark: z.object({
23
+ png: z.string(),
24
+ svg: z.string(),
25
+ }),
26
+ }),
17
27
  action: z.nativeEnum(SUBSCRIPTION_ACTION).optional().nullable(),
18
28
  features: z.array(SubscriptionFeatureSchema),
19
29
  maxInputLength: z.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.5.79",
3
+ "version": "0.5.81",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",