@purpleschool/gptbot-tools 0.2.9-stage → 0.2.11-stage

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 (57) hide show
  1. package/build/common/enums/file-type.enum.js +5 -0
  2. package/build/diagrams/commands/delete-all-diagrams-jobs.command.js +13 -0
  3. package/build/diagrams/commands/delete-diagrams-job-by-uuid.command.js +14 -0
  4. package/build/diagrams/commands/diagrams.command.js +19 -0
  5. package/build/diagrams/commands/edit-diagrams-job.command.js +27 -0
  6. package/build/diagrams/commands/index.js +23 -0
  7. package/build/diagrams/commands/retry-diagrams-job.command.js +20 -0
  8. package/build/diagrams/commands/set-reaction-to-diagrams-job.command.js +27 -0
  9. package/build/diagrams/commands/update-diagrams-job-title.command.js +19 -0
  10. package/build/diagrams/index.js +20 -0
  11. package/build/diagrams/models/diagrams-chart-type.schema.js +14 -0
  12. package/build/diagrams/models/diagrams-config.schema.js +10 -0
  13. package/build/diagrams/models/diagrams-job.schema.js +46 -0
  14. package/build/diagrams/models/diagrams-model.schema.js +33 -0
  15. package/build/diagrams/models/index.js +20 -0
  16. package/build/diagrams/queries/find-diagrams-job-by-uuid.query.js +12 -0
  17. package/build/diagrams/queries/find-diagrams-jobs.query.js +28 -0
  18. package/build/diagrams/queries/get-diagrams-config.query.js +11 -0
  19. package/build/diagrams/queries/index.js +19 -0
  20. package/build/diagrams/routes/diagrams.amqp.routes.js +15 -0
  21. package/build/diagrams/routes/index.js +17 -0
  22. package/build/html-page-builder/commands/get-html-page-builder-price.command.js +2 -0
  23. package/build/html-page-builder/models/html-page-builder-model.schema.js +2 -1
  24. package/build/index.js +3 -0
  25. package/build/tools/enums/tool-content-type.enum.js +1 -0
  26. package/build/tools/enums/tool-type.enum.js +1 -0
  27. package/build/tools/models/global-tools-config.schema.js +2 -0
  28. package/build/tools/models/tools-with-configs.schema.js +5 -0
  29. package/common/enums/file-type.enum.ts +5 -0
  30. package/diagrams/commands/delete-all-diagrams-jobs.command.ts +13 -0
  31. package/diagrams/commands/delete-diagrams-job-by-uuid.command.ts +14 -0
  32. package/diagrams/commands/diagrams.command.ts +19 -0
  33. package/diagrams/commands/edit-diagrams-job.command.ts +29 -0
  34. package/diagrams/commands/index.ts +7 -0
  35. package/diagrams/commands/retry-diagrams-job.command.ts +20 -0
  36. package/diagrams/commands/set-reaction-to-diagrams-job.command.ts +30 -0
  37. package/diagrams/commands/update-diagrams-job-title.command.ts +21 -0
  38. package/diagrams/index.ts +4 -0
  39. package/diagrams/models/diagrams-chart-type.schema.ts +14 -0
  40. package/diagrams/models/diagrams-config.schema.ts +10 -0
  41. package/diagrams/models/diagrams-job.schema.ts +56 -0
  42. package/diagrams/models/diagrams-model.schema.ts +36 -0
  43. package/diagrams/models/index.ts +4 -0
  44. package/diagrams/queries/find-diagrams-job-by-uuid.query.ts +13 -0
  45. package/diagrams/queries/find-diagrams-jobs.query.ts +33 -0
  46. package/diagrams/queries/get-diagrams-config.query.ts +10 -0
  47. package/diagrams/queries/index.ts +3 -0
  48. package/diagrams/routes/diagrams.amqp.routes.ts +12 -0
  49. package/diagrams/routes/index.ts +1 -0
  50. package/html-page-builder/commands/get-html-page-builder-price.command.ts +2 -0
  51. package/html-page-builder/models/html-page-builder-model.schema.ts +2 -1
  52. package/index.ts +3 -0
  53. package/package.json +1 -1
  54. package/tools/enums/tool-content-type.enum.ts +1 -0
  55. package/tools/enums/tool-type.enum.ts +1 -0
  56. package/tools/models/global-tools-config.schema.ts +2 -0
  57. package/tools/models/tools-with-configs.schema.ts +7 -0
@@ -5,4 +5,9 @@ var FILE_TYPE;
5
5
  (function (FILE_TYPE) {
6
6
  FILE_TYPE["PDF"] = "PDF";
7
7
  FILE_TYPE["DOCX"] = "DOCX";
8
+ FILE_TYPE["JSON"] = "JSON";
9
+ FILE_TYPE["CSV"] = "CSV";
10
+ FILE_TYPE["TSV"] = "TSV";
11
+ FILE_TYPE["XLS"] = "XLS";
12
+ FILE_TYPE["XLSX"] = "XLSX";
8
13
  })(FILE_TYPE || (exports.FILE_TYPE = FILE_TYPE = {}));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAllDiagramsJobsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ var DeleteAllDiagramsJobsCommand;
7
+ (function (DeleteAllDiagramsJobsCommand) {
8
+ DeleteAllDiagramsJobsCommand.RequestSchema = zod_1.z.object({
9
+ userId: zod_1.z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
11
+ });
12
+ DeleteAllDiagramsJobsCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
13
+ })(DeleteAllDiagramsJobsCommand || (exports.DeleteAllDiagramsJobsCommand = DeleteAllDiagramsJobsCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteDiagramsJobByUuidCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ var DeleteDiagramsJobByUuidCommand;
7
+ (function (DeleteDiagramsJobByUuidCommand) {
8
+ DeleteDiagramsJobByUuidCommand.RequestSchema = zod_1.z.object({
9
+ userId: zod_1.z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
11
+ uuid: zod_1.z.string().uuid(),
12
+ });
13
+ DeleteDiagramsJobByUuidCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.boolean());
14
+ })(DeleteDiagramsJobByUuidCommand || (exports.DeleteDiagramsJobByUuidCommand = DeleteDiagramsJobByUuidCommand = {}));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiagramsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ const models_1 = require("../models");
7
+ var DiagramsCommand;
8
+ (function (DiagramsCommand) {
9
+ DiagramsCommand.RequestSchema = zod_1.z.object({
10
+ userId: zod_1.z.string().uuid().nullable().optional(),
11
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
12
+ prompt: zod_1.z.string(),
13
+ modelId: zod_1.z.string().uuid(),
14
+ params: models_1.DiagramsJobParamsSchema,
15
+ tokenReservationId: zod_1.z.string().uuid(),
16
+ precalculatedPrice: zod_1.z.number(),
17
+ });
18
+ DiagramsCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.DiagramsJobSchema);
19
+ })(DiagramsCommand || (exports.DiagramsCommand = DiagramsCommand = {}));
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EditDiagramsJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ const models_1 = require("../models");
7
+ var EditDiagramsJobCommand;
8
+ (function (EditDiagramsJobCommand) {
9
+ EditDiagramsJobCommand.RequestSchema = zod_1.z.object({
10
+ userId: zod_1.z.string().uuid().nullable().optional(),
11
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
12
+ uuid: zod_1.z.string().uuid(),
13
+ prompt: zod_1.z.string(),
14
+ parentVersionUuid: zod_1.z.string().uuid(),
15
+ modelId: zod_1.z.string().uuid().optional(),
16
+ chartTypeUuid: zod_1.z.string().uuid().optional(),
17
+ tokenReservationId: zod_1.z.string().uuid(),
18
+ precalculatedPrice: zod_1.z.number(),
19
+ data: zod_1.z
20
+ .array(zod_1.z.object({
21
+ fileId: zod_1.z.string().uuid(),
22
+ url: zod_1.z.string(),
23
+ }))
24
+ .optional(),
25
+ });
26
+ EditDiagramsJobCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.DiagramsJobSchema);
27
+ })(EditDiagramsJobCommand || (exports.EditDiagramsJobCommand = EditDiagramsJobCommand = {}));
@@ -0,0 +1,23 @@
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("./diagrams.command"), exports);
18
+ __exportStar(require("./edit-diagrams-job.command"), exports);
19
+ __exportStar(require("./update-diagrams-job-title.command"), exports);
20
+ __exportStar(require("./set-reaction-to-diagrams-job.command"), exports);
21
+ __exportStar(require("./retry-diagrams-job.command"), exports);
22
+ __exportStar(require("./delete-diagrams-job-by-uuid.command"), exports);
23
+ __exportStar(require("./delete-all-diagrams-jobs.command"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryDiagramsJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var RetryDiagramsJobCommand;
8
+ (function (RetryDiagramsJobCommand) {
9
+ RetryDiagramsJobCommand.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ userId: zod_1.z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ prompt: zod_1.z.string().optional(),
14
+ modelId: zod_1.z.string().uuid().optional(),
15
+ params: models_1.DiagramsJobParamsSchema.optional(),
16
+ tokenReservationId: zod_1.z.string().uuid(),
17
+ precalculatedPrice: zod_1.z.number(),
18
+ });
19
+ RetryDiagramsJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.DiagramsJobSchema);
20
+ })(RetryDiagramsJobCommand || (exports.RetryDiagramsJobCommand = RetryDiagramsJobCommand = {}));
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetReactionToDiagramsJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const common_1 = require("../../common");
7
+ const models_1 = require("../models");
8
+ var SetReactionToDiagramsJobCommand;
9
+ (function (SetReactionToDiagramsJobCommand) {
10
+ SetReactionToDiagramsJobCommand.RequestSchema = zod_1.z
11
+ .object({
12
+ userId: zod_1.z.string().uuid().nullable().optional(),
13
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
+ uuid: zod_1.z.string().uuid(),
15
+ reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
16
+ dislikeReason: zod_1.z.string().nullable().default(null),
17
+ })
18
+ .refine((data) => {
19
+ if (data.reaction !== common_1.USER_REACTION.DISLIKED && data.dislikeReason) {
20
+ return false;
21
+ }
22
+ return true;
23
+ }, {
24
+ message: 'Dislike reason is not allowed when reaction is not disliked',
25
+ });
26
+ SetReactionToDiagramsJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.DiagramsJobSchema);
27
+ })(SetReactionToDiagramsJobCommand || (exports.SetReactionToDiagramsJobCommand = SetReactionToDiagramsJobCommand = {}));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateDiagramsJobTitleCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const diagrams_job_schema_1 = require("../models/diagrams-job.schema");
7
+ var UpdateDiagramsJobTitleCommand;
8
+ (function (UpdateDiagramsJobTitleCommand) {
9
+ UpdateDiagramsJobTitleCommand.RequestSchema = zod_1.z.object({
10
+ uuid: zod_1.z.string().uuid(),
11
+ userId: zod_1.z.string().uuid().nullable().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
+ title: zod_1.z.string().min(1).max(40),
14
+ });
15
+ UpdateDiagramsJobTitleCommand.RequestParamsSchema = zod_1.z.object({
16
+ uuid: zod_1.z.string(),
17
+ });
18
+ UpdateDiagramsJobTitleCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(diagrams_job_schema_1.DiagramsJobSchema);
19
+ })(UpdateDiagramsJobTitleCommand || (exports.UpdateDiagramsJobTitleCommand = UpdateDiagramsJobTitleCommand = {}));
@@ -0,0 +1,20 @@
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("./commands"), exports);
18
+ __exportStar(require("./models"), exports);
19
+ __exportStar(require("./queries"), exports);
20
+ __exportStar(require("./routes"), exports);
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiagramsChartTypeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ exports.DiagramsChartTypeSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string(),
8
+ title: zod_1.z.string(),
9
+ icons: common_1.IconVariantsSchema,
10
+ systemPrompt: zod_1.z.string(),
11
+ order: zod_1.z.number(),
12
+ createdAt: zod_1.z.date(),
13
+ updatedAt: zod_1.z.date(),
14
+ });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiagramsConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const diagrams_model_schema_1 = require("./diagrams-model.schema");
6
+ const diagrams_chart_type_schema_1 = require("./diagrams-chart-type.schema");
7
+ exports.DiagramsConfigSchema = zod_1.z.object({
8
+ models: zod_1.z.array(diagrams_model_schema_1.DiagramsModelSchema),
9
+ chartTypes: zod_1.z.array(diagrams_chart_type_schema_1.DiagramsChartTypeSchema),
10
+ });
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiagramsJobSchema = exports.DiagramsJobOutputSchema = exports.DiagramsJobParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const tools_1 = require("../../tools");
6
+ const common_1 = require("../../common");
7
+ exports.DiagramsJobParamsSchema = zod_1.z.object({
8
+ chartTypeUuid: zod_1.z.string().uuid(),
9
+ data: zod_1.z
10
+ .array(zod_1.z.object({
11
+ fileId: zod_1.z.string().uuid(),
12
+ url: zod_1.z.string(),
13
+ fileType: zod_1.z.nativeEnum(common_1.FILE_TYPE).optional(),
14
+ }))
15
+ .optional(),
16
+ });
17
+ exports.DiagramsJobOutputSchema = zod_1.z.object({
18
+ versions: zod_1.z.array(zod_1.z.object({
19
+ uuid: zod_1.z.string().uuid(),
20
+ htmlUrl: zod_1.z.string(),
21
+ createdAt: zod_1.z.string(),
22
+ parentUuid: zod_1.z.string().uuid().optional(),
23
+ })),
24
+ });
25
+ exports.DiagramsJobSchema = zod_1.z.object({
26
+ uuid: zod_1.z.string(),
27
+ prompt: zod_1.z.string(),
28
+ title: zod_1.z.string(),
29
+ status: zod_1.z.nativeEnum(tools_1.JOB_STATUS),
30
+ error: zod_1.z.string().nullable(),
31
+ internalError: zod_1.z.string().nullable().optional(),
32
+ modelId: zod_1.z.string(),
33
+ price: zod_1.z.number(),
34
+ params: exports.DiagramsJobParamsSchema,
35
+ output: exports.DiagramsJobOutputSchema,
36
+ reaction: zod_1.z.nativeEnum(common_1.USER_REACTION).nullable(),
37
+ dislikeReason: zod_1.z.string().nullable(),
38
+ attempts: zod_1.z.array(zod_1.z.any()),
39
+ userId: zod_1.z.string().nullable().optional(),
40
+ unregisteredUserId: zod_1.z.string().nullable().optional(),
41
+ tokenReservationId: zod_1.z.string().nullable().optional(),
42
+ isDeleted: zod_1.z.boolean(),
43
+ createdAt: zod_1.z.date(),
44
+ completedAt: zod_1.z.date().nullable().optional(),
45
+ updatedAt: zod_1.z.date(),
46
+ });
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiagramsModelSchema = exports.DiagramsModelConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ exports.DiagramsModelConfigSchema = zod_1.z.object({
7
+ dataAttachment: zod_1.z.object({
8
+ supported: zod_1.z.boolean(),
9
+ maxFileSizeMb: zod_1.z.number(),
10
+ acceptedTypes: zod_1.z.array(zod_1.z.string()),
11
+ }),
12
+ });
13
+ exports.DiagramsModelSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string(),
15
+ title: zod_1.z.string(),
16
+ description: zod_1.z.string(),
17
+ aiModel: zod_1.z.string(),
18
+ inputPrice: zod_1.z.number(),
19
+ outputPrice: zod_1.z.number(),
20
+ tokenMultiplicator: zod_1.z.number(),
21
+ freeTokenMultiplicator: zod_1.z.number(),
22
+ isPremium: zod_1.z.boolean(),
23
+ isNew: zod_1.z.boolean(),
24
+ order: zod_1.z.number(),
25
+ status: zod_1.z.nativeEnum(common_1.TOOL_MODEL_STATUS),
26
+ icons: common_1.IconVariantsSchema,
27
+ maxPromptLength: zod_1.z.number(),
28
+ maxPromptTokens: zod_1.z.number(),
29
+ maxContextCharacters: zod_1.z.number(),
30
+ config: exports.DiagramsModelConfigSchema,
31
+ createdAt: zod_1.z.date(),
32
+ updatedAt: zod_1.z.date(),
33
+ });
@@ -0,0 +1,20 @@
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("./diagrams-config.schema"), exports);
18
+ __exportStar(require("./diagrams-chart-type.schema"), exports);
19
+ __exportStar(require("./diagrams-job.schema"), exports);
20
+ __exportStar(require("./diagrams-model.schema"), exports);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindDiagramsJobByUuidQuery = void 0;
4
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
5
+ const models_1 = require("../models");
6
+ var FindDiagramsJobByUuidQuery;
7
+ (function (FindDiagramsJobByUuidQuery) {
8
+ FindDiagramsJobByUuidQuery.RequestSchema = models_1.DiagramsJobSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindDiagramsJobByUuidQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.DiagramsJobSchema);
12
+ })(FindDiagramsJobByUuidQuery || (exports.FindDiagramsJobByUuidQuery = FindDiagramsJobByUuidQuery = {}));
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindDiagramsJobsQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var FindDiagramsJobsQuery;
8
+ (function (FindDiagramsJobsQuery) {
9
+ FindDiagramsJobsQuery.RequestSchema = zod_1.z
10
+ .object({
11
+ userId: zod_1.z.string().uuid().optional(),
12
+ unregisteredUserId: zod_1.z.string().uuid().optional(),
13
+ title: zod_1.z.string().optional(),
14
+ limit: zod_1.z.coerce.number().min(1).optional(),
15
+ offset: zod_1.z.coerce.number().min(0).default(0).optional(),
16
+ })
17
+ .refine((data) => {
18
+ return !(data.userId && data.unregisteredUserId);
19
+ }, {
20
+ message: 'userId and unregisteredUserId cannot be used together',
21
+ path: ['userId', 'unregisteredUserId'],
22
+ });
23
+ FindDiagramsJobsQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(zod_1.z.object({
24
+ data: zod_1.z.array(models_1.DiagramsJobSchema),
25
+ page: zod_1.z.number(),
26
+ totalPages: zod_1.z.number(),
27
+ }));
28
+ })(FindDiagramsJobsQuery || (exports.FindDiagramsJobsQuery = FindDiagramsJobsQuery = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetDiagramsConfigQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ const models_1 = require("../models");
7
+ var GetDiagramsConfigQuery;
8
+ (function (GetDiagramsConfigQuery) {
9
+ GetDiagramsConfigQuery.Request = zod_1.z.object({});
10
+ GetDiagramsConfigQuery.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.DiagramsConfigSchema);
11
+ })(GetDiagramsConfigQuery || (exports.GetDiagramsConfigQuery = GetDiagramsConfigQuery = {}));
@@ -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("./find-diagrams-job-by-uuid.query"), exports);
18
+ __exportStar(require("./find-diagrams-jobs.query"), exports);
19
+ __exportStar(require("./get-diagrams-config.query"), exports);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DIAGRAMS_AMQP_ROUTES = void 0;
4
+ exports.DIAGRAMS_AMQP_ROUTES = {
5
+ EXECUTE: 'tools.diagrams.execute.rpc',
6
+ CONFIG: 'tools.diagrams.config.rpc',
7
+ GET_JOB: 'tools.diagrams.jobs.get.rpc',
8
+ LIST_JOBS: 'tools.diagrams.jobs.list.rpc',
9
+ EDIT: 'tools.diagrams.jobs.edit.rpc',
10
+ UPDATE_TITLE: 'tools.diagrams.jobs.update-title.rpc',
11
+ SET_REACTION: 'tools.diagrams.jobs.set-reaction.rpc',
12
+ SOFT_DELETE: 'tools.diagrams.jobs.soft-delete.rpc',
13
+ SOFT_DELETE_ALL: 'tools.diagrams.jobs.soft-delete-all.rpc',
14
+ RETRY: 'tools.diagrams.jobs.retry.rpc',
15
+ };
@@ -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("./diagrams.amqp.routes"), exports);
@@ -7,6 +7,8 @@ var GetHtmlPageBuilderPriceCommand;
7
7
  (function (GetHtmlPageBuilderPriceCommand) {
8
8
  GetHtmlPageBuilderPriceCommand.RequestSchema = zod_1.z.object({
9
9
  modelId: zod_1.z.string().uuid(),
10
+ userPrompt: zod_1.z.string(),
11
+ sessionId: zod_1.z.string().uuid().nullable().optional(),
10
12
  });
11
13
  GetHtmlPageBuilderPriceCommand.ResponseDataSchema = zod_1.z.object({
12
14
  price: zod_1.z.number(),
@@ -8,7 +8,8 @@ exports.HtmlPageBuilderModelSchema = zod_1.z.object({
8
8
  title: zod_1.z.string(),
9
9
  description: zod_1.z.string(),
10
10
  aiModel: zod_1.z.string(),
11
- price: zod_1.z.number(),
11
+ inputPrice: zod_1.z.number(),
12
+ outputPrice: zod_1.z.number(),
12
13
  order: zod_1.z.number(),
13
14
  status: zod_1.z.nativeEnum(common_1.TOOL_MODEL_STATUS),
14
15
  icons: common_1.IconVariantsSchema,
package/build/index.js CHANGED
@@ -59,6 +59,7 @@ __exportStar(require("./solving-edu-task"), exports);
59
59
  __exportStar(require("./spell-corrector"), exports);
60
60
  __exportStar(require("./html-page-builder"), exports);
61
61
  __exportStar(require("./tool-workspace"), exports);
62
+ __exportStar(require("./diagrams"), exports);
62
63
  const common = __importStar(require("./common"));
63
64
  const paraphrase = __importStar(require("./paraphrase"));
64
65
  const tools = __importStar(require("./tools"));
@@ -81,6 +82,7 @@ const spellCorrector = __importStar(require("./spell-corrector"));
81
82
  const htmlPageBuilder = __importStar(require("./html-page-builder"));
82
83
  const accountMerge = __importStar(require("./account-merge"));
83
84
  const toolWorkspace = __importStar(require("./tool-workspace"));
85
+ const diagrams = __importStar(require("./diagrams"));
84
86
  var ToolService;
85
87
  (function (ToolService) {
86
88
  ToolService.Common = common;
@@ -105,4 +107,5 @@ var ToolService;
105
107
  ToolService.HtmlPageBuilder = htmlPageBuilder;
106
108
  ToolService.AccountMerge = accountMerge;
107
109
  ToolService.ToolWorkspace = toolWorkspace;
110
+ ToolService.Diagrams = diagrams;
108
111
  })(ToolService || (exports.ToolService = ToolService = {}));
@@ -18,5 +18,6 @@ var TOOL_CONTENT_TYPE;
18
18
  TOOL_CONTENT_TYPE["MARKETPLACE_CARD_GENERATION"] = "MARKETPLACE_CARD";
19
19
  TOOL_CONTENT_TYPE["SOLVING_EDU_TASK"] = "SOLVING_EDU_TASK";
20
20
  TOOL_CONTENT_TYPE["SPELL_CORRECTOR"] = "SPELL_CORRECTOR";
21
+ TOOL_CONTENT_TYPE["DIAGRAMS"] = "DIAGRAMS";
21
22
  TOOL_CONTENT_TYPE["HTML_PAGE_BUILDER"] = "HTML_PAGE_BUILDER";
22
23
  })(TOOL_CONTENT_TYPE || (exports.TOOL_CONTENT_TYPE = TOOL_CONTENT_TYPE = {}));
@@ -20,5 +20,6 @@ var TOOL_TYPE;
20
20
  TOOL_TYPE["INTERIOR_DESIGN"] = "INTERIOR_DESIGN";
21
21
  TOOL_TYPE["SPELL_CORRECTOR"] = "SPELL_CORRECTOR";
22
22
  TOOL_TYPE["SOLVING_EDU_TASK"] = "SOLVING_EDU_TASK";
23
+ TOOL_TYPE["DIAGRAMS"] = "DIAGRAMS";
23
24
  TOOL_TYPE["HTML_PAGE_BUILDER"] = "HTML_PAGE_BUILDER";
24
25
  })(TOOL_TYPE || (exports.TOOL_TYPE = TOOL_TYPE = {}));
@@ -17,6 +17,7 @@ const models_1 = require("../../marketplace-card/models");
17
17
  const interior_design_1 = require("../../interior-design");
18
18
  const solving_edu_task_1 = require("../../solving-edu-task");
19
19
  const spell_corrector_1 = require("../../spell-corrector");
20
+ const diagrams_1 = require("../../diagrams");
20
21
  const models_2 = require("../../html-page-builder/models");
21
22
  exports.GlobalToolsConfigSchema = zod_1.z.object({
22
23
  [enums_1.TOOL_CONTENT_TYPE.VIDEO]: video_1.VideoConfigSchema,
@@ -33,5 +34,6 @@ exports.GlobalToolsConfigSchema = zod_1.z.object({
33
34
  [enums_1.TOOL_CONTENT_TYPE.INTERIOR_DESIGN]: interior_design_1.InteriorDesignConfigSchema,
34
35
  [enums_1.TOOL_CONTENT_TYPE.SOLVING_EDU_TASK]: solving_edu_task_1.SolvingEduTaskConfigSchema,
35
36
  [enums_1.TOOL_CONTENT_TYPE.SPELL_CORRECTOR]: spell_corrector_1.SpellCorrectorToolConfigSchema,
37
+ [enums_1.TOOL_CONTENT_TYPE.DIAGRAMS]: diagrams_1.DiagramsConfigSchema,
36
38
  [enums_1.TOOL_CONTENT_TYPE.HTML_PAGE_BUILDER]: models_2.HtmlPageBuilderConfigSchema,
37
39
  });
@@ -18,6 +18,7 @@ const tool_schema_1 = require("./tool.schema");
18
18
  const interior_design_1 = require("../../interior-design");
19
19
  const solving_edu_task_1 = require("../../solving-edu-task");
20
20
  const spell_corrector_1 = require("../../spell-corrector");
21
+ const diagrams_1 = require("../../diagrams");
21
22
  const models_2 = require("../../html-page-builder/models");
22
23
  // Discriminated union array: Tools with their configs
23
24
  exports.ToolWithConfigSchema = zod_1.z.discriminatedUnion('contentType', [
@@ -77,6 +78,10 @@ exports.ToolWithConfigSchema = zod_1.z.discriminatedUnion('contentType', [
77
78
  contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.SPELL_CORRECTOR),
78
79
  config: spell_corrector_1.SpellCorrectorToolConfigSchema,
79
80
  })),
81
+ tool_schema_1.ToolSchema.merge(zod_1.z.object({
82
+ contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.DIAGRAMS),
83
+ config: diagrams_1.DiagramsConfigSchema,
84
+ })),
80
85
  tool_schema_1.ToolSchema.merge(zod_1.z.object({
81
86
  contentType: zod_1.z.literal(enums_1.TOOL_CONTENT_TYPE.HTML_PAGE_BUILDER),
82
87
  config: models_2.HtmlPageBuilderConfigSchema,
@@ -1,4 +1,9 @@
1
1
  export enum FILE_TYPE {
2
2
  PDF = 'PDF',
3
3
  DOCX = 'DOCX',
4
+ JSON = 'JSON',
5
+ CSV = 'CSV',
6
+ TSV = 'TSV',
7
+ XLS = 'XLS',
8
+ XLSX = 'XLSX',
4
9
  }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace DeleteAllDiagramsJobsCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ });
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace DeleteDiagramsJobByUuidCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ uuid: z.string().uuid(),
9
+ });
10
+ export type Request = z.infer<typeof RequestSchema>;
11
+
12
+ export const ResponseSchema = ICommandResponseSchema(z.boolean());
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common';
3
+ import { DiagramsJobParamsSchema, DiagramsJobSchema } from '../models';
4
+
5
+ export namespace DiagramsCommand {
6
+ export const RequestSchema = z.object({
7
+ userId: z.string().uuid().nullable().optional(),
8
+ unregisteredUserId: z.string().uuid().nullable().optional(),
9
+ prompt: z.string(),
10
+ modelId: z.string().uuid(),
11
+ params: DiagramsJobParamsSchema,
12
+ tokenReservationId: z.string().uuid(),
13
+ precalculatedPrice: z.number(),
14
+ });
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseSchema = ICommandResponseSchema(DiagramsJobSchema);
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common';
3
+ import { DiagramsJobSchema } from '../models';
4
+
5
+ export namespace EditDiagramsJobCommand {
6
+ export const RequestSchema = z.object({
7
+ userId: z.string().uuid().nullable().optional(),
8
+ unregisteredUserId: z.string().uuid().nullable().optional(),
9
+ uuid: z.string().uuid(),
10
+ prompt: z.string(),
11
+ parentVersionUuid: z.string().uuid(),
12
+ modelId: z.string().uuid().optional(),
13
+ chartTypeUuid: z.string().uuid().optional(),
14
+ tokenReservationId: z.string().uuid(),
15
+ precalculatedPrice: z.number(),
16
+ data: z
17
+ .array(
18
+ z.object({
19
+ fileId: z.string().uuid(),
20
+ url: z.string(),
21
+ }),
22
+ )
23
+ .optional(),
24
+ });
25
+ export type Request = z.infer<typeof RequestSchema>;
26
+
27
+ export const ResponseSchema = ICommandResponseSchema(DiagramsJobSchema);
28
+ export type Response = z.infer<typeof ResponseSchema>;
29
+ }
@@ -0,0 +1,7 @@
1
+ export * from './diagrams.command';
2
+ export * from './edit-diagrams-job.command';
3
+ export * from './update-diagrams-job-title.command';
4
+ export * from './set-reaction-to-diagrams-job.command';
5
+ export * from './retry-diagrams-job.command';
6
+ export * from './delete-diagrams-job-by-uuid.command';
7
+ export * from './delete-all-diagrams-jobs.command';
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { DiagramsJobParamsSchema, DiagramsJobSchema } from '../models';
4
+
5
+ export namespace RetryDiagramsJobCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ prompt: z.string().optional(),
11
+ modelId: z.string().uuid().optional(),
12
+ params: DiagramsJobParamsSchema.optional(),
13
+ tokenReservationId: z.string().uuid(),
14
+ precalculatedPrice: z.number(),
15
+ });
16
+ export type Request = z.infer<typeof RequestSchema>;
17
+
18
+ export const ResponseSchema = ICommandResponseSchema(DiagramsJobSchema);
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { USER_REACTION } from '../../common';
4
+ import { DiagramsJobSchema } from '../models';
5
+
6
+ export namespace SetReactionToDiagramsJobCommand {
7
+ export const RequestSchema = z
8
+ .object({
9
+ userId: z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ uuid: z.string().uuid(),
12
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
13
+ dislikeReason: z.string().nullable().default(null),
14
+ })
15
+ .refine(
16
+ (data) => {
17
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
18
+ return false;
19
+ }
20
+ return true;
21
+ },
22
+ {
23
+ message: 'Dislike reason is not allowed when reaction is not disliked',
24
+ },
25
+ );
26
+ export type Request = z.infer<typeof RequestSchema>;
27
+
28
+ export const ResponseSchema = ICommandResponseSchema(DiagramsJobSchema);
29
+ export type Response = z.infer<typeof ResponseSchema>;
30
+ }
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { DiagramsJobSchema } from '../models/diagrams-job.schema';
4
+
5
+ export namespace UpdateDiagramsJobTitleCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ title: z.string().min(1).max(40),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const RequestParamsSchema = z.object({
15
+ uuid: z.string(),
16
+ });
17
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
18
+
19
+ export const ResponseSchema = ICommandResponseSchema(DiagramsJobSchema);
20
+ export type Response = z.infer<typeof ResponseSchema>;
21
+ }
@@ -0,0 +1,4 @@
1
+ export * from './commands';
2
+ export * from './models';
3
+ export * from './queries';
4
+ export * from './routes';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema } from '../../common';
3
+
4
+ export const DiagramsChartTypeSchema = z.object({
5
+ uuid: z.string(),
6
+ title: z.string(),
7
+ icons: IconVariantsSchema,
8
+ systemPrompt: z.string(),
9
+ order: z.number(),
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
13
+
14
+ export type DiagramsChartType = z.infer<typeof DiagramsChartTypeSchema>;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { DiagramsModelSchema } from './diagrams-model.schema';
3
+ import { DiagramsChartTypeSchema } from './diagrams-chart-type.schema';
4
+
5
+ export const DiagramsConfigSchema = z.object({
6
+ models: z.array(DiagramsModelSchema),
7
+ chartTypes: z.array(DiagramsChartTypeSchema),
8
+ });
9
+
10
+ export type DiagramsConfig = z.infer<typeof DiagramsConfigSchema>;
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { JOB_STATUS } from '../../tools';
3
+ import { FILE_TYPE, USER_REACTION } from '../../common';
4
+
5
+ export const DiagramsJobParamsSchema = z.object({
6
+ chartTypeUuid: z.string().uuid(),
7
+ data: z
8
+ .array(
9
+ z.object({
10
+ fileId: z.string().uuid(),
11
+ url: z.string(),
12
+ fileType: z.nativeEnum(FILE_TYPE).optional(),
13
+ }),
14
+ )
15
+ .optional(),
16
+ });
17
+
18
+ export type DiagramsJobParams = z.infer<typeof DiagramsJobParamsSchema>;
19
+
20
+ export const DiagramsJobOutputSchema = z.object({
21
+ versions: z.array(
22
+ z.object({
23
+ uuid: z.string().uuid(),
24
+ htmlUrl: z.string(),
25
+ createdAt: z.string(),
26
+ parentUuid: z.string().uuid().optional(),
27
+ }),
28
+ ),
29
+ });
30
+
31
+ export type DiagramsJobOutput = z.infer<typeof DiagramsJobOutputSchema>;
32
+
33
+ export const DiagramsJobSchema = z.object({
34
+ uuid: z.string(),
35
+ prompt: z.string(),
36
+ title: z.string(),
37
+ status: z.nativeEnum(JOB_STATUS),
38
+ error: z.string().nullable(),
39
+ internalError: z.string().nullable().optional(),
40
+ modelId: z.string(),
41
+ price: z.number(),
42
+ params: DiagramsJobParamsSchema,
43
+ output: DiagramsJobOutputSchema,
44
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
45
+ dislikeReason: z.string().nullable(),
46
+ attempts: z.array(z.any()),
47
+ userId: z.string().nullable().optional(),
48
+ unregisteredUserId: z.string().nullable().optional(),
49
+ tokenReservationId: z.string().nullable().optional(),
50
+ isDeleted: z.boolean(),
51
+ createdAt: z.date(),
52
+ completedAt: z.date().nullable().optional(),
53
+ updatedAt: z.date(),
54
+ });
55
+
56
+ export type DiagramsJob = z.infer<typeof DiagramsJobSchema>;
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema, TOOL_MODEL_STATUS } from '../../common';
3
+
4
+ export const DiagramsModelConfigSchema = z.object({
5
+ dataAttachment: z.object({
6
+ supported: z.boolean(),
7
+ maxFileSizeMb: z.number(),
8
+ acceptedTypes: z.array(z.string()),
9
+ }),
10
+ });
11
+
12
+ export type DiagramsModelConfig = z.infer<typeof DiagramsModelConfigSchema>;
13
+
14
+ export const DiagramsModelSchema = z.object({
15
+ uuid: z.string(),
16
+ title: z.string(),
17
+ description: z.string(),
18
+ aiModel: z.string(),
19
+ inputPrice: z.number(),
20
+ outputPrice: z.number(),
21
+ tokenMultiplicator: z.number(),
22
+ freeTokenMultiplicator: z.number(),
23
+ isPremium: z.boolean(),
24
+ isNew: z.boolean(),
25
+ order: z.number(),
26
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
27
+ icons: IconVariantsSchema,
28
+ maxPromptLength: z.number(),
29
+ maxPromptTokens: z.number(),
30
+ maxContextCharacters: z.number(),
31
+ config: DiagramsModelConfigSchema,
32
+ createdAt: z.date(),
33
+ updatedAt: z.date(),
34
+ });
35
+
36
+ export type DiagramsModel = z.infer<typeof DiagramsModelSchema>;
@@ -0,0 +1,4 @@
1
+ export * from './diagrams-config.schema';
2
+ export * from './diagrams-chart-type.schema';
3
+ export * from './diagrams-job.schema';
4
+ export * from './diagrams-model.schema';
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { DiagramsJobSchema } from '../models';
4
+
5
+ export namespace FindDiagramsJobByUuidQuery {
6
+ export const RequestSchema = DiagramsJobSchema.pick({
7
+ uuid: true,
8
+ });
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = ICommandResponseSchema(DiagramsJobSchema);
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { DiagramsJobSchema } from '../models';
4
+
5
+ export namespace FindDiagramsJobsQuery {
6
+ export const RequestSchema = z
7
+ .object({
8
+ userId: z.string().uuid().optional(),
9
+ unregisteredUserId: z.string().uuid().optional(),
10
+ title: z.string().optional(),
11
+ limit: z.coerce.number().min(1).optional(),
12
+ offset: z.coerce.number().min(0).default(0).optional(),
13
+ })
14
+ .refine(
15
+ (data) => {
16
+ return !(data.userId && data.unregisteredUserId);
17
+ },
18
+ {
19
+ message: 'userId and unregisteredUserId cannot be used together',
20
+ path: ['userId', 'unregisteredUserId'],
21
+ },
22
+ );
23
+ export type Request = z.infer<typeof RequestSchema>;
24
+
25
+ export const ResponseSchema = ICommandResponseSchema(
26
+ z.object({
27
+ data: z.array(DiagramsJobSchema),
28
+ page: z.number(),
29
+ totalPages: z.number(),
30
+ }),
31
+ );
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { DiagramsConfigSchema } from '../models';
4
+
5
+ export namespace GetDiagramsConfigQuery {
6
+ export const Request = z.object({});
7
+ export type Request = z.infer<typeof Request>;
8
+ export const ResponseSchema = ICommandResponseSchema(DiagramsConfigSchema);
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,3 @@
1
+ export * from './find-diagrams-job-by-uuid.query';
2
+ export * from './find-diagrams-jobs.query';
3
+ export * from './get-diagrams-config.query';
@@ -0,0 +1,12 @@
1
+ export const DIAGRAMS_AMQP_ROUTES = {
2
+ EXECUTE: 'tools.diagrams.execute.rpc',
3
+ CONFIG: 'tools.diagrams.config.rpc',
4
+ GET_JOB: 'tools.diagrams.jobs.get.rpc',
5
+ LIST_JOBS: 'tools.diagrams.jobs.list.rpc',
6
+ EDIT: 'tools.diagrams.jobs.edit.rpc',
7
+ UPDATE_TITLE: 'tools.diagrams.jobs.update-title.rpc',
8
+ SET_REACTION: 'tools.diagrams.jobs.set-reaction.rpc',
9
+ SOFT_DELETE: 'tools.diagrams.jobs.soft-delete.rpc',
10
+ SOFT_DELETE_ALL: 'tools.diagrams.jobs.soft-delete-all.rpc',
11
+ RETRY: 'tools.diagrams.jobs.retry.rpc',
12
+ } as const;
@@ -0,0 +1 @@
1
+ export * from './diagrams.amqp.routes';
@@ -4,6 +4,8 @@ import { ICommandResponseSchema } from '../../common/models/command-response.sch
4
4
  export namespace GetHtmlPageBuilderPriceCommand {
5
5
  export const RequestSchema = z.object({
6
6
  modelId: z.string().uuid(),
7
+ userPrompt: z.string(),
8
+ sessionId: z.string().uuid().nullable().optional(),
7
9
  });
8
10
  export type Request = z.infer<typeof RequestSchema>;
9
11
 
@@ -6,7 +6,8 @@ export const HtmlPageBuilderModelSchema = z.object({
6
6
  title: z.string(),
7
7
  description: z.string(),
8
8
  aiModel: z.string(),
9
- price: z.number(),
9
+ inputPrice: z.number(),
10
+ outputPrice: z.number(),
10
11
  order: z.number(),
11
12
  status: z.nativeEnum(TOOL_MODEL_STATUS),
12
13
  icons: IconVariantsSchema,
package/index.ts CHANGED
@@ -20,6 +20,7 @@ export * from './solving-edu-task';
20
20
  export * from './spell-corrector';
21
21
  export * from './html-page-builder';
22
22
  export * from './tool-workspace';
23
+ export * from './diagrams';
23
24
 
24
25
  import * as common from './common';
25
26
  import * as paraphrase from './paraphrase';
@@ -43,6 +44,7 @@ import * as spellCorrector from './spell-corrector';
43
44
  import * as htmlPageBuilder from './html-page-builder';
44
45
  import * as accountMerge from './account-merge';
45
46
  import * as toolWorkspace from './tool-workspace';
47
+ import * as diagrams from './diagrams';
46
48
 
47
49
  export namespace ToolService {
48
50
  export import Common = common;
@@ -67,4 +69,5 @@ export namespace ToolService {
67
69
  export import HtmlPageBuilder = htmlPageBuilder;
68
70
  export import AccountMerge = accountMerge;
69
71
  export import ToolWorkspace = toolWorkspace;
72
+ export import Diagrams = diagrams;
70
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.2.9-stage",
3
+ "version": "0.2.11-stage",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -14,5 +14,6 @@ export enum TOOL_CONTENT_TYPE {
14
14
  MARKETPLACE_CARD_GENERATION = 'MARKETPLACE_CARD',
15
15
  SOLVING_EDU_TASK = 'SOLVING_EDU_TASK',
16
16
  SPELL_CORRECTOR = 'SPELL_CORRECTOR',
17
+ DIAGRAMS = 'DIAGRAMS',
17
18
  HTML_PAGE_BUILDER = 'HTML_PAGE_BUILDER',
18
19
  }
@@ -16,5 +16,6 @@ export enum TOOL_TYPE {
16
16
  INTERIOR_DESIGN = 'INTERIOR_DESIGN',
17
17
  SPELL_CORRECTOR = 'SPELL_CORRECTOR',
18
18
  SOLVING_EDU_TASK = 'SOLVING_EDU_TASK',
19
+ DIAGRAMS = 'DIAGRAMS',
19
20
  HTML_PAGE_BUILDER = 'HTML_PAGE_BUILDER',
20
21
  }
@@ -14,6 +14,7 @@ import { MarketplaceCardConfigSchema } from '../../marketplace-card/models';
14
14
  import { InteriorDesignConfigSchema } from '../../interior-design';
15
15
  import { SolvingEduTaskConfigSchema } from '../../solving-edu-task';
16
16
  import { SpellCorrectorToolConfigSchema } from '../../spell-corrector';
17
+ import { DiagramsConfigSchema } from '../../diagrams';
17
18
  import { HtmlPageBuilderConfigSchema } from '../../html-page-builder/models';
18
19
 
19
20
  export const GlobalToolsConfigSchema = z.object({
@@ -31,6 +32,7 @@ export const GlobalToolsConfigSchema = z.object({
31
32
  [TOOL_CONTENT_TYPE.INTERIOR_DESIGN]: InteriorDesignConfigSchema,
32
33
  [TOOL_CONTENT_TYPE.SOLVING_EDU_TASK]: SolvingEduTaskConfigSchema,
33
34
  [TOOL_CONTENT_TYPE.SPELL_CORRECTOR]: SpellCorrectorToolConfigSchema,
35
+ [TOOL_CONTENT_TYPE.DIAGRAMS]: DiagramsConfigSchema,
34
36
  [TOOL_CONTENT_TYPE.HTML_PAGE_BUILDER]: HtmlPageBuilderConfigSchema,
35
37
  });
36
38
 
@@ -15,6 +15,7 @@ import { ToolSchema } from './tool.schema';
15
15
  import { InteriorDesignConfigSchema } from '../../interior-design';
16
16
  import { SolvingEduTaskConfigSchema } from '../../solving-edu-task';
17
17
  import { SpellCorrectorToolConfigSchema } from '../../spell-corrector';
18
+ import { DiagramsConfigSchema } from '../../diagrams';
18
19
  import { HtmlPageBuilderConfigSchema } from '../../html-page-builder/models';
19
20
 
20
21
  // Discriminated union array: Tools with their configs
@@ -104,6 +105,12 @@ export const ToolWithConfigSchema = z.discriminatedUnion('contentType', [
104
105
  }),
105
106
  ),
106
107
  ToolSchema.merge(
108
+ z.object({
109
+ contentType: z.literal(TOOL_CONTENT_TYPE.DIAGRAMS),
110
+ config: DiagramsConfigSchema,
111
+ }),
112
+ ),
113
+ ToolSchema.merge(
107
114
  z.object({
108
115
  contentType: z.literal(TOOL_CONTENT_TYPE.HTML_PAGE_BUILDER),
109
116
  config: HtmlPageBuilderConfigSchema,