@purpleschool/gptbot 0.7.30 → 0.7.32

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 (49) hide show
  1. package/api/controllers/http/image-editor.ts +14 -0
  2. package/api/controllers/http/index.ts +1 -0
  3. package/build/api/controllers/http/image-editor.js +16 -0
  4. package/build/api/controllers/http/index.js +1 -0
  5. package/build/commands/tools/image-editor/delete-all-image-editor-jobs.command.js +8 -0
  6. package/build/commands/tools/image-editor/delete-image-editor-job-by-uuid.command.js +11 -0
  7. package/build/commands/tools/image-editor/find-image-editor-job-by-uuid.command.js +14 -0
  8. package/build/commands/tools/image-editor/find-image-editor-jobs.command.js +18 -0
  9. package/build/commands/tools/image-editor/get-image-editor-tool-config.command.js +11 -0
  10. package/build/commands/tools/image-editor/image-editor.command.js +19 -0
  11. package/build/commands/tools/image-editor/index.js +25 -0
  12. package/build/commands/tools/image-editor/retry-image-editor-job.command.js +14 -0
  13. package/build/commands/tools/image-editor/set-reaction-to-image-editor-job.command.js +18 -0
  14. package/build/commands/tools/image-editor/update-image-editor-job-title.command.js +17 -0
  15. package/build/commands/tools/index.js +1 -0
  16. package/build/constants/errors/errors.js +50 -1
  17. package/build/constants/index.js +1 -0
  18. package/build/constants/tool-image-editor/enums/image-editor-model-type.enum.js +7 -0
  19. package/build/constants/tool-image-editor/enums/image-editor-strategy.enum.js +8 -0
  20. package/build/constants/tool-image-editor/enums/index.js +18 -0
  21. package/build/constants/tool-image-editor/index.js +17 -0
  22. package/build/models/tools/image-editor/image-editor-config.schema.js +32 -0
  23. package/build/models/tools/image-editor/image-editor-job.schema.js +17 -0
  24. package/build/models/tools/image-editor/image-editor-model.schema.js +25 -0
  25. package/build/models/tools/image-editor/index.js +19 -0
  26. package/build/models/tools/index.js +1 -0
  27. package/commands/tools/image-editor/delete-all-image-editor-jobs.command.ts +6 -0
  28. package/commands/tools/image-editor/delete-image-editor-job-by-uuid.command.ts +11 -0
  29. package/commands/tools/image-editor/find-image-editor-job-by-uuid.command.ts +16 -0
  30. package/commands/tools/image-editor/find-image-editor-jobs.command.ts +18 -0
  31. package/commands/tools/image-editor/get-image-editor-tool-config.command.ts +10 -0
  32. package/commands/tools/image-editor/image-editor.command.ts +20 -0
  33. package/commands/tools/image-editor/index.ts +9 -0
  34. package/commands/tools/image-editor/retry-image-editor-job.command.ts +14 -0
  35. package/commands/tools/image-editor/set-reaction-to-image-editor-job.command.ts +20 -0
  36. package/commands/tools/image-editor/update-image-editor-job-title.command.ts +19 -0
  37. package/commands/tools/index.ts +1 -0
  38. package/constants/errors/errors.ts +51 -1
  39. package/constants/index.ts +1 -0
  40. package/constants/tool-image-editor/enums/image-editor-model-type.enum.ts +3 -0
  41. package/constants/tool-image-editor/enums/image-editor-strategy.enum.ts +4 -0
  42. package/constants/tool-image-editor/enums/index.ts +2 -0
  43. package/constants/tool-image-editor/index.ts +1 -0
  44. package/models/tools/image-editor/image-editor-config.schema.ts +32 -0
  45. package/models/tools/image-editor/image-editor-job.schema.ts +20 -0
  46. package/models/tools/image-editor/image-editor-model.schema.ts +28 -0
  47. package/models/tools/image-editor/index.ts +3 -0
  48. package/models/tools/index.ts +1 -0
  49. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ export const IMAGE_EDITOR_CONTROLLER_PRIVATE = 'private/tools/image-editor' as const;
2
+ export const IMAGE_EDITOR_CONTROLLER_PUBLIC = 'public/tools/image-editor' as const;
3
+
4
+ export const IMAGE_EDITOR_ROUTES = {
5
+ CONFIG: 'config',
6
+ EXECUTE: 'execute',
7
+ GET_JOBS: 'jobs',
8
+ GET_JOB: (uuid: string) => `jobs/${uuid}`,
9
+ UPDATE: (uuid: string) => `jobs/${uuid}`,
10
+ SET_REACTION: (uuid: string) => `jobs/${uuid}/reaction`,
11
+ DELETE: (uuid: string) => `jobs/${uuid}`,
12
+ DELETE_ALL: 'jobs',
13
+ RETRY: (uuid: string) => `jobs/${uuid}/retry`,
14
+ } as const;
@@ -44,4 +44,5 @@ export * from './folder';
44
44
  export * from './user-to-product';
45
45
  export * from './user-to-subscription';
46
46
  export * from './video';
47
+ export * from './image-editor';
47
48
  export * from './daily-streak';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDITOR_ROUTES = exports.IMAGE_EDITOR_CONTROLLER_PUBLIC = exports.IMAGE_EDITOR_CONTROLLER_PRIVATE = void 0;
4
+ exports.IMAGE_EDITOR_CONTROLLER_PRIVATE = 'private/tools/image-editor';
5
+ exports.IMAGE_EDITOR_CONTROLLER_PUBLIC = 'public/tools/image-editor';
6
+ exports.IMAGE_EDITOR_ROUTES = {
7
+ CONFIG: 'config',
8
+ EXECUTE: 'execute',
9
+ GET_JOBS: 'jobs',
10
+ GET_JOB: (uuid) => `jobs/${uuid}`,
11
+ UPDATE: (uuid) => `jobs/${uuid}`,
12
+ SET_REACTION: (uuid) => `jobs/${uuid}/reaction`,
13
+ DELETE: (uuid) => `jobs/${uuid}`,
14
+ DELETE_ALL: 'jobs',
15
+ RETRY: (uuid) => `jobs/${uuid}/retry`,
16
+ };
@@ -60,4 +60,5 @@ __exportStar(require("./folder"), exports);
60
60
  __exportStar(require("./user-to-product"), exports);
61
61
  __exportStar(require("./user-to-subscription"), exports);
62
62
  __exportStar(require("./video"), exports);
63
+ __exportStar(require("./image-editor"), exports);
63
64
  __exportStar(require("./daily-streak"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAllImageEditorJobsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var DeleteAllImageEditorJobsCommand;
6
+ (function (DeleteAllImageEditorJobsCommand) {
7
+ DeleteAllImageEditorJobsCommand.ResponseSchema = zod_1.z.void();
8
+ })(DeleteAllImageEditorJobsCommand || (exports.DeleteAllImageEditorJobsCommand = DeleteAllImageEditorJobsCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteImageEditorJobByUuidCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var DeleteImageEditorJobByUuidCommand;
6
+ (function (DeleteImageEditorJobByUuidCommand) {
7
+ DeleteImageEditorJobByUuidCommand.RequestParamsSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ });
10
+ DeleteImageEditorJobByUuidCommand.ResponseSchema = zod_1.z.void();
11
+ })(DeleteImageEditorJobByUuidCommand || (exports.DeleteImageEditorJobByUuidCommand = DeleteImageEditorJobByUuidCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindImageEditorJobByUUIDCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var FindImageEditorJobByUUIDCommand;
7
+ (function (FindImageEditorJobByUUIDCommand) {
8
+ FindImageEditorJobByUUIDCommand.RequestParamsSchema = models_1.ToolJobSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindImageEditorJobByUUIDCommand.ResponseSchema = zod_1.z.object({
12
+ data: models_1.ImageEditorJobSchema,
13
+ });
14
+ })(FindImageEditorJobByUUIDCommand || (exports.FindImageEditorJobByUUIDCommand = FindImageEditorJobByUUIDCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindImageEditorJobsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var FindImageEditorJobsCommand;
7
+ (function (FindImageEditorJobsCommand) {
8
+ FindImageEditorJobsCommand.RequestQuerySchema = zod_1.z.object({
9
+ limit: zod_1.z.coerce.number().min(1).optional(),
10
+ offset: zod_1.z.coerce.number().min(0).default(0).optional(),
11
+ title: zod_1.z.string().optional(),
12
+ });
13
+ FindImageEditorJobsCommand.ResponseSchema = zod_1.z.object({
14
+ data: zod_1.z.array(models_1.ImageEditorJobSchema),
15
+ totalPages: zod_1.z.number(),
16
+ page: zod_1.z.number(),
17
+ });
18
+ })(FindImageEditorJobsCommand || (exports.FindImageEditorJobsCommand = FindImageEditorJobsCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetImageEditorToolConfigCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var GetImageEditorToolConfigCommand;
7
+ (function (GetImageEditorToolConfigCommand) {
8
+ GetImageEditorToolConfigCommand.ResponseSchema = zod_1.z.object({
9
+ data: models_1.ImageEditorConfigSchema,
10
+ });
11
+ })(GetImageEditorToolConfigCommand || (exports.GetImageEditorToolConfigCommand = GetImageEditorToolConfigCommand = {}));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var ImageEditorCommand;
7
+ (function (ImageEditorCommand) {
8
+ ImageEditorCommand.RequestSchema = zod_1.z.object({
9
+ modelId: zod_1.z.string().uuid(),
10
+ prompt: zod_1.z.string(),
11
+ params: zod_1.z.object({
12
+ imageUrls: zod_1.z.array(zod_1.z.string()),
13
+ systemPromptId: zod_1.z.string().optional(),
14
+ }),
15
+ });
16
+ ImageEditorCommand.ResponseSchema = zod_1.z.object({
17
+ data: models_1.ToolJobSchema,
18
+ });
19
+ })(ImageEditorCommand || (exports.ImageEditorCommand = ImageEditorCommand = {}));
@@ -0,0 +1,25 @@
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("./delete-image-editor-job-by-uuid.command"), exports);
18
+ __exportStar(require("./delete-all-image-editor-jobs.command"), exports);
19
+ __exportStar(require("./retry-image-editor-job.command"), exports);
20
+ __exportStar(require("./set-reaction-to-image-editor-job.command"), exports);
21
+ __exportStar(require("./image-editor.command"), exports);
22
+ __exportStar(require("./update-image-editor-job-title.command"), exports);
23
+ __exportStar(require("./find-image-editor-job-by-uuid.command"), exports);
24
+ __exportStar(require("./find-image-editor-jobs.command"), exports);
25
+ __exportStar(require("./get-image-editor-tool-config.command"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryImageEditorJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var RetryImageEditorJobCommand;
7
+ (function (RetryImageEditorJobCommand) {
8
+ RetryImageEditorJobCommand.RequestParamsSchema = zod_1.z.object({
9
+ uuid: zod_1.z.string().uuid(),
10
+ });
11
+ RetryImageEditorJobCommand.ResponseSchema = zod_1.z.object({
12
+ data: models_1.ImageEditorJobSchema,
13
+ });
14
+ })(RetryImageEditorJobCommand || (exports.RetryImageEditorJobCommand = RetryImageEditorJobCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetReactionToImageEditorJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ const constants_1 = require("../../../constants");
7
+ var SetReactionToImageEditorJobCommand;
8
+ (function (SetReactionToImageEditorJobCommand) {
9
+ SetReactionToImageEditorJobCommand.RequestSchema = zod_1.z.object({
10
+ reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
11
+ });
12
+ SetReactionToImageEditorJobCommand.RequestParamsSchema = zod_1.z.object({
13
+ uuid: zod_1.z.string().uuid(),
14
+ });
15
+ SetReactionToImageEditorJobCommand.ResponseSchema = zod_1.z.object({
16
+ data: models_1.ImageEditorJobSchema,
17
+ });
18
+ })(SetReactionToImageEditorJobCommand || (exports.SetReactionToImageEditorJobCommand = SetReactionToImageEditorJobCommand = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateImageEditorJobTitleCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var UpdateImageEditorJobTitleCommand;
7
+ (function (UpdateImageEditorJobTitleCommand) {
8
+ UpdateImageEditorJobTitleCommand.RequestSchema = zod_1.z.object({
9
+ title: zod_1.z.string().min(1).max(40).trim(),
10
+ });
11
+ UpdateImageEditorJobTitleCommand.RequestParamsSchema = zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ });
14
+ UpdateImageEditorJobTitleCommand.ResponseSchema = zod_1.z.object({
15
+ data: models_1.ImageEditorJobSchema,
16
+ });
17
+ })(UpdateImageEditorJobTitleCommand || (exports.UpdateImageEditorJobTitleCommand = UpdateImageEditorJobTitleCommand = {}));
@@ -20,3 +20,4 @@ __exportStar(require("./stt"), exports);
20
20
  __exportStar(require("./tool"), exports);
21
21
  __exportStar(require("./tts"), exports);
22
22
  __exportStar(require("./video"), exports);
23
+ __exportStar(require("./image-editor"), exports);
@@ -1657,8 +1657,52 @@ exports.ERRORS = {
1657
1657
  message: 'Произошла ошибка при обновлении презентации',
1658
1658
  httpCode: 500,
1659
1659
  },
1660
- MESSAGE_COUNT_ERROR: {
1660
+ IMAGE_EDITOR_CONFIG_ERROR: {
1661
1661
  code: 'A352',
1662
+ message: 'Произошла ошибка при получении конфигурации инструмента для редактирования картинки',
1663
+ httpCode: 500,
1664
+ },
1665
+ IMAGE_EDITOR_SEND_REQUEST_ERROR: {
1666
+ code: 'A353',
1667
+ message: 'Произошла ошибка при отправке запроса на редактирование картинки',
1668
+ httpCode: 500,
1669
+ },
1670
+ IMAGE_EDITOR_MODEL_NOT_FOUND: {
1671
+ code: 'A354',
1672
+ message: 'Не удалось найти указанную модель для редактирования картинки',
1673
+ httpCode: 400,
1674
+ },
1675
+ IMAGE_EDITOR_MAX_SYMBOLS_EXCEEDED: {
1676
+ code: 'A355',
1677
+ message: 'Превышена максимальная количество символов',
1678
+ },
1679
+ IMAGE_EDITOR_SET_REACTION_ERROR: {
1680
+ code: 'A356',
1681
+ message: 'Произошла ошибка при установке оценке сообщения',
1682
+ httpCode: 500,
1683
+ },
1684
+ IMAGE_EDITOR_UPDATE_TITLE_ERROR: {
1685
+ code: 'A357',
1686
+ message: 'Произошла ошибка при обновлении названия чата',
1687
+ httpCode: 500,
1688
+ },
1689
+ IMAGE_EDITOR_JOB_DELETE_ERROR: {
1690
+ code: 'A358',
1691
+ message: 'Произошла ошибка при удалении сообщения',
1692
+ httpCode: 500,
1693
+ },
1694
+ IMAGE_EDITOR_RETRY_REQUEST_ERROR: {
1695
+ code: 'A359',
1696
+ message: 'Произошла ошибка при повторном запросе на редактирование картинки',
1697
+ httpCode: 500,
1698
+ },
1699
+ IMAGE_EDITOR_MODEL_NOT_AVAILABLE: {
1700
+ code: 'A360',
1701
+ message: 'Данная модель для редактирования картинки недоступна',
1702
+ httpCode: 401,
1703
+ },
1704
+ MESSAGE_COUNT_ERROR: {
1705
+ code: 'A361',
1662
1706
  message: 'Произошла ошибка при подсчёте количества сообщений для юзера',
1663
1707
  httpCode: 500,
1664
1708
  },
@@ -1712,4 +1756,9 @@ exports.ERRORS = {
1712
1756
  message: 'Произошла ошибка при удалении Telegram профиля',
1713
1757
  httpCode: 500,
1714
1758
  },
1759
+ TOOL_NOT_FOUND_ERROR: {
1760
+ code: 'A363',
1761
+ message: 'Инструмент не найден',
1762
+ httpCode: 404,
1763
+ },
1715
1764
  };
@@ -47,5 +47,6 @@ __exportStar(require("./promocode"), exports);
47
47
  __exportStar(require("./ui-notification"), exports);
48
48
  __exportStar(require("./review"), exports);
49
49
  __exportStar(require("./tool-video"), exports);
50
+ __exportStar(require("./tool-image-editor"), exports);
50
51
  __exportStar(require("./feedback"), exports);
51
52
  __exportStar(require("./daily-streak"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDITOR_MODEL_TYPE = void 0;
4
+ var IMAGE_EDITOR_MODEL_TYPE;
5
+ (function (IMAGE_EDITOR_MODEL_TYPE) {
6
+ IMAGE_EDITOR_MODEL_TYPE["NANO_BANANA_EDIT"] = "NANO_BANANA_EDIT";
7
+ })(IMAGE_EDITOR_MODEL_TYPE || (exports.IMAGE_EDITOR_MODEL_TYPE = IMAGE_EDITOR_MODEL_TYPE = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IMAGE_EDIING_STRATEGY = void 0;
4
+ var IMAGE_EDIING_STRATEGY;
5
+ (function (IMAGE_EDIING_STRATEGY) {
6
+ IMAGE_EDIING_STRATEGY["NANO_BANANA_POLLING"] = "NANO_BANANA_POLLING";
7
+ IMAGE_EDIING_STRATEGY["NANO_BANANA_CALLBACK"] = "NANO_BANANA_CALLBACK";
8
+ })(IMAGE_EDIING_STRATEGY || (exports.IMAGE_EDIING_STRATEGY = IMAGE_EDIING_STRATEGY = {}));
@@ -0,0 +1,18 @@
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("./image-editor-model-type.enum"), exports);
18
+ __exportStar(require("./image-editor-strategy.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);
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorConfigSchema = exports.PromptGroupSchema = exports.SystemPromptSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const image_editor_model_schema_1 = require("./image-editor-model.schema");
6
+ const icon_variants_schema_1 = require("../../icon-variants.schema");
7
+ exports.SystemPromptSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string(),
9
+ title: zod_1.z.string(),
10
+ description: zod_1.z.string(),
11
+ prompt: zod_1.z.string(),
12
+ allowUserPrompt: zod_1.z.boolean(),
13
+ groupId: zod_1.z.string().uuid(),
14
+ preview: zod_1.z
15
+ .object({
16
+ before: zod_1.z.string(),
17
+ after: zod_1.z.string(),
18
+ })
19
+ .optional()
20
+ .nullable(),
21
+ });
22
+ exports.PromptGroupSchema = zod_1.z.object({
23
+ uuid: zod_1.z.string(),
24
+ title: zod_1.z.string(),
25
+ icons: icon_variants_schema_1.IconVariantsSchema,
26
+ prompts: zod_1.z.array(exports.SystemPromptSchema),
27
+ order: zod_1.z.number(),
28
+ });
29
+ exports.ImageEditorConfigSchema = zod_1.z.object({
30
+ models: zod_1.z.array(image_editor_model_schema_1.ImageEditorModelSchema),
31
+ promptGroups: zod_1.z.array(exports.SystemPromptSchema),
32
+ });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorJobSchema = exports.ImageEditorJobParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ exports.ImageEditorJobParamsSchema = zod_1.z.object({
7
+ imageUrls: zod_1.z.array(zod_1.z.string()).optional(),
8
+ systemPromptId: zod_1.z.string().optional(),
9
+ });
10
+ exports.ImageEditorJobSchema = zod_1.z.object({
11
+ title: zod_1.z.string(),
12
+ prompt: zod_1.z.string(),
13
+ reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
14
+ imageUrls: zod_1.z.array(zod_1.z.string()).nullable(),
15
+ params: exports.ImageEditorJobParamsSchema,
16
+ modelId: zod_1.z.string(),
17
+ });
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageEditorModelSchema = exports.ImageEditorModelParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const icon_variants_schema_1 = require("../../icon-variants.schema");
6
+ const unlocked_by_subscription_schema_1 = require("../../unlocked-by-subscription.schema");
7
+ exports.ImageEditorModelParamsSchema = zod_1.z.object({
8
+ imageAttachment: zod_1.z.object({
9
+ supported: zod_1.z.boolean(),
10
+ maxImages: zod_1.z.number(),
11
+ acceptedTypes: zod_1.z.array(zod_1.z.string()),
12
+ }),
13
+ });
14
+ exports.ImageEditorModelSchema = zod_1.z.object({
15
+ uuid: zod_1.z.string(),
16
+ title: zod_1.z.string(),
17
+ description: zod_1.z.string(),
18
+ pricePerImage: zod_1.z.number(),
19
+ order: zod_1.z.number(),
20
+ icons: icon_variants_schema_1.IconVariantsSchema,
21
+ maxInputLength: zod_1.z.number(),
22
+ params: exports.ImageEditorModelParamsSchema,
23
+ unlockedBy: unlocked_by_subscription_schema_1.UnlockedBySchema.nullable(),
24
+ canUse: zod_1.z.boolean(),
25
+ });
@@ -0,0 +1,19 @@
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("./image-editor-config.schema"), exports);
18
+ __exportStar(require("./image-editor-job.schema"), exports);
19
+ __exportStar(require("./image-editor-model.schema"), exports);
@@ -19,3 +19,4 @@ __exportStar(require("./paraphrase"), exports);
19
19
  __exportStar(require("./stt"), exports);
20
20
  __exportStar(require("./tts"), exports);
21
21
  __exportStar(require("./video"), exports);
22
+ __exportStar(require("./image-editor"), exports);
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteAllImageEditorJobsCommand {
4
+ export const ResponseSchema = z.void();
5
+ export type Response = z.infer<typeof ResponseSchema>;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteImageEditorJobByUuidCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const ResponseSchema = z.void();
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorJobSchema, ToolJobSchema } from '../../../models';
3
+
4
+ export namespace FindImageEditorJobByUUIDCommand {
5
+ export const RequestParamsSchema = ToolJobSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: ImageEditorJobSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorJobSchema } from '../../../models';
3
+
4
+ export namespace FindImageEditorJobsCommand {
5
+ export const RequestQuerySchema = z.object({
6
+ limit: z.coerce.number().min(1).optional(),
7
+ offset: z.coerce.number().min(0).default(0).optional(),
8
+ title: z.string().optional(),
9
+ });
10
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
11
+
12
+ export const ResponseSchema = z.object({
13
+ data: z.array(ImageEditorJobSchema),
14
+ totalPages: z.number(),
15
+ page: z.number(),
16
+ });
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorConfigSchema } from '../../../models';
3
+
4
+ export namespace GetImageEditorToolConfigCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: ImageEditorConfigSchema,
7
+ });
8
+
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { ToolJobSchema } from '../../../models';
3
+
4
+ export namespace ImageEditorCommand {
5
+ export const RequestSchema = z.object({
6
+ modelId: z.string().uuid(),
7
+ prompt: z.string(),
8
+ params: z.object({
9
+ imageUrls: z.array(z.string()),
10
+ systemPromptId: z.string().optional(),
11
+ }),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: ToolJobSchema,
17
+ });
18
+
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,9 @@
1
+ export * from './delete-image-editor-job-by-uuid.command';
2
+ export * from './delete-all-image-editor-jobs.command';
3
+ export * from './retry-image-editor-job.command';
4
+ export * from './set-reaction-to-image-editor-job.command';
5
+ export * from './image-editor.command';
6
+ export * from './update-image-editor-job-title.command';
7
+ export * from './find-image-editor-job-by-uuid.command';
8
+ export * from './find-image-editor-jobs.command';
9
+ export * from './get-image-editor-tool-config.command';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorJobSchema } from '../../../models';
3
+
4
+ export namespace RetryImageEditorJobCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: ImageEditorJobSchema,
12
+ });
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorJobSchema } from '../../../models';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export namespace SetReactionToImageEditorJobCommand {
6
+ export const RequestSchema = z.object({
7
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
8
+ });
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const RequestParamsSchema = z.object({
12
+ uuid: z.string().uuid(),
13
+ });
14
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
15
+
16
+ export const ResponseSchema = z.object({
17
+ data: ImageEditorJobSchema,
18
+ });
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateImageEditorJobTitleCommand {
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: ImageEditorJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -4,3 +4,4 @@ export * from './stt';
4
4
  export * from './tool';
5
5
  export * from './tts';
6
6
  export * from './video';
7
+ export * from './image-editor';
@@ -1664,8 +1664,53 @@ export const ERRORS = {
1664
1664
  message: 'Произошла ошибка при обновлении презентации',
1665
1665
  httpCode: 500,
1666
1666
  },
1667
- MESSAGE_COUNT_ERROR: {
1667
+ IMAGE_EDITOR_CONFIG_ERROR: {
1668
1668
  code: 'A352',
1669
+ message:
1670
+ 'Произошла ошибка при получении конфигурации инструмента для редактирования картинки',
1671
+ httpCode: 500,
1672
+ },
1673
+ IMAGE_EDITOR_SEND_REQUEST_ERROR: {
1674
+ code: 'A353',
1675
+ message: 'Произошла ошибка при отправке запроса на редактирование картинки',
1676
+ httpCode: 500,
1677
+ },
1678
+ IMAGE_EDITOR_MODEL_NOT_FOUND: {
1679
+ code: 'A354',
1680
+ message: 'Не удалось найти указанную модель для редактирования картинки',
1681
+ httpCode: 400,
1682
+ },
1683
+ IMAGE_EDITOR_MAX_SYMBOLS_EXCEEDED: {
1684
+ code: 'A355',
1685
+ message: 'Превышена максимальная количество символов',
1686
+ },
1687
+ IMAGE_EDITOR_SET_REACTION_ERROR: {
1688
+ code: 'A356',
1689
+ message: 'Произошла ошибка при установке оценке сообщения',
1690
+ httpCode: 500,
1691
+ },
1692
+ IMAGE_EDITOR_UPDATE_TITLE_ERROR: {
1693
+ code: 'A357',
1694
+ message: 'Произошла ошибка при обновлении названия чата',
1695
+ httpCode: 500,
1696
+ },
1697
+ IMAGE_EDITOR_JOB_DELETE_ERROR: {
1698
+ code: 'A358',
1699
+ message: 'Произошла ошибка при удалении сообщения',
1700
+ httpCode: 500,
1701
+ },
1702
+ IMAGE_EDITOR_RETRY_REQUEST_ERROR: {
1703
+ code: 'A359',
1704
+ message: 'Произошла ошибка при повторном запросе на редактирование картинки',
1705
+ httpCode: 500,
1706
+ },
1707
+ IMAGE_EDITOR_MODEL_NOT_AVAILABLE: {
1708
+ code: 'A360',
1709
+ message: 'Данная модель для редактирования картинки недоступна',
1710
+ httpCode: 401,
1711
+ },
1712
+ MESSAGE_COUNT_ERROR: {
1713
+ code: 'A361',
1669
1714
  message: 'Произошла ошибка при подсчёте количества сообщений для юзера',
1670
1715
  httpCode: 500,
1671
1716
  },
@@ -1719,4 +1764,9 @@ export const ERRORS = {
1719
1764
  message: 'Произошла ошибка при удалении Telegram профиля',
1720
1765
  httpCode: 500,
1721
1766
  },
1767
+ TOOL_NOT_FOUND_ERROR: {
1768
+ code: 'A363',
1769
+ message: 'Инструмент не найден',
1770
+ httpCode: 404,
1771
+ },
1722
1772
  };
@@ -31,5 +31,6 @@ export * from './promocode';
31
31
  export * from './ui-notification';
32
32
  export * from './review';
33
33
  export * from './tool-video';
34
+ export * from './tool-image-editor';
34
35
  export * from './feedback';
35
36
  export * from './daily-streak';
@@ -0,0 +1,3 @@
1
+ export enum IMAGE_EDITOR_MODEL_TYPE {
2
+ NANO_BANANA_EDIT = 'NANO_BANANA_EDIT',
3
+ }
@@ -0,0 +1,4 @@
1
+ export enum IMAGE_EDIING_STRATEGY {
2
+ NANO_BANANA_POLLING = 'NANO_BANANA_POLLING',
3
+ NANO_BANANA_CALLBACK = 'NANO_BANANA_CALLBACK',
4
+ }
@@ -0,0 +1,2 @@
1
+ export * from './image-editor-model-type.enum';
2
+ export * from './image-editor-strategy.enum';
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { ImageEditorModelSchema } from './image-editor-model.schema';
3
+ import { IconVariantsSchema } from '../../icon-variants.schema';
4
+
5
+ export const SystemPromptSchema = z.object({
6
+ uuid: z.string(),
7
+ title: z.string(),
8
+ description: z.string(),
9
+ prompt: z.string(),
10
+ allowUserPrompt: z.boolean(),
11
+ groupId: z.string().uuid(),
12
+ preview: z
13
+ .object({
14
+ before: z.string(),
15
+ after: z.string(),
16
+ })
17
+ .optional()
18
+ .nullable(),
19
+ });
20
+
21
+ export const PromptGroupSchema = z.object({
22
+ uuid: z.string(),
23
+ title: z.string(),
24
+ icons: IconVariantsSchema,
25
+ prompts: z.array(SystemPromptSchema),
26
+ order: z.number(),
27
+ });
28
+
29
+ export const ImageEditorConfigSchema = z.object({
30
+ models: z.array(ImageEditorModelSchema),
31
+ promptGroups: z.array(SystemPromptSchema),
32
+ });
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { USER_REACTION } from '../../../constants';
3
+
4
+ export const ImageEditorJobParamsSchema = z.object({
5
+ imageUrls: z.array(z.string()).optional(),
6
+ systemPromptId: z.string().optional(),
7
+ });
8
+
9
+ export type ImageEditorJobParams = z.infer<typeof ImageEditorJobParamsSchema>;
10
+
11
+ export const ImageEditorJobSchema = z.object({
12
+ title: z.string(),
13
+ prompt: z.string(),
14
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
15
+ imageUrls: z.array(z.string()).nullable(),
16
+ params: ImageEditorJobParamsSchema,
17
+ modelId: z.string(),
18
+ });
19
+
20
+ export type ImageEditorJob = z.infer<typeof ImageEditorJobSchema>;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../icon-variants.schema';
3
+ import { UnlockedBySchema } from '../../unlocked-by-subscription.schema';
4
+
5
+ export const ImageEditorModelParamsSchema = z.object({
6
+ imageAttachment: z.object({
7
+ supported: z.boolean(),
8
+ maxImages: z.number(),
9
+ acceptedTypes: z.array(z.string()),
10
+ }),
11
+ });
12
+
13
+ export type ImageEditorModelParams = z.infer<typeof ImageEditorModelParamsSchema>;
14
+
15
+ export const ImageEditorModelSchema = z.object({
16
+ uuid: z.string(),
17
+ title: z.string(),
18
+ description: z.string(),
19
+ pricePerImage: z.number(),
20
+ order: z.number(),
21
+ icons: IconVariantsSchema,
22
+ maxInputLength: z.number(),
23
+ params: ImageEditorModelParamsSchema,
24
+ unlockedBy: UnlockedBySchema.nullable(),
25
+ canUse: z.boolean(),
26
+ });
27
+
28
+ export type ImageEditorModel = z.infer<typeof ImageEditorModelSchema>;
@@ -0,0 +1,3 @@
1
+ export * from './image-editor-config.schema';
2
+ export * from './image-editor-job.schema';
3
+ export * from './image-editor-model.schema';
@@ -3,3 +3,4 @@ export * from './paraphrase';
3
3
  export * from './stt';
4
4
  export * from './tts';
5
5
  export * from './video';
6
+ export * from './image-editor';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.7.30",
3
+ "version": "0.7.32",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",