@purpleschool/gptbot 0.9.21 → 0.9.23

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 (41) hide show
  1. package/api/controllers/http/index.ts +1 -0
  2. package/api/controllers/http/solving-edu-task.ts +14 -0
  3. package/build/api/controllers/http/index.js +1 -0
  4. package/build/api/controllers/http/solving-edu-task.js +16 -0
  5. package/build/commands/tools/index.js +1 -0
  6. package/build/commands/tools/solving-edu-task/delete-all-solving-edu-task-jobs.command.js +10 -0
  7. package/build/commands/tools/solving-edu-task/delete-solving-edu-task-job-by-uuid.command.js +13 -0
  8. package/build/commands/tools/solving-edu-task/find-solving-edu-task-job-by-uuid.command.js +14 -0
  9. package/build/commands/tools/solving-edu-task/find-solving-edu-task-jobs.command.js +18 -0
  10. package/build/commands/tools/solving-edu-task/get-solving-edu-task-tool-config.command.js +11 -0
  11. package/build/commands/tools/solving-edu-task/index.js +25 -0
  12. package/build/commands/tools/solving-edu-task/retry-solving-edu-task-job.command.js +23 -0
  13. package/build/commands/tools/solving-edu-task/set-reaction-to-solving-edu-task-job.command.js +28 -0
  14. package/build/commands/tools/solving-edu-task/solving-edu-task.command.js +30 -0
  15. package/build/commands/tools/solving-edu-task/update-solving-edu-task-job-title.command.js +17 -0
  16. package/build/constants/tool/enums/index.js +0 -1
  17. package/build/models/tools/index.js +1 -0
  18. package/build/models/tools/solving-edu-task/index.js +19 -0
  19. package/build/models/tools/solving-edu-task/solving-edu-task-config.schema.js +8 -0
  20. package/build/models/tools/solving-edu-task/solving-edu-task-job.schema.js +24 -0
  21. package/build/models/tools/solving-edu-task/solving-edu-task-model.schema.js +22 -0
  22. package/commands/tools/index.ts +1 -0
  23. package/commands/tools/solving-edu-task/delete-all-solving-edu-task-jobs.command.ts +8 -0
  24. package/commands/tools/solving-edu-task/delete-solving-edu-task-job-by-uuid.command.ts +13 -0
  25. package/commands/tools/solving-edu-task/find-solving-edu-task-job-by-uuid.command.ts +16 -0
  26. package/commands/tools/solving-edu-task/find-solving-edu-task-jobs.command.ts +18 -0
  27. package/commands/tools/solving-edu-task/get-solving-edu-task-tool-config.command.ts +9 -0
  28. package/commands/tools/solving-edu-task/index.ts +9 -0
  29. package/commands/tools/solving-edu-task/retry-solving-edu-task-job.command.ts +25 -0
  30. package/commands/tools/solving-edu-task/set-reaction-to-solving-edu-task-job.command.ts +33 -0
  31. package/commands/tools/solving-edu-task/solving-edu-task.command.ts +31 -0
  32. package/commands/tools/solving-edu-task/update-solving-edu-task-job-title.command.ts +19 -0
  33. package/constants/tool/enums/index.ts +0 -1
  34. package/models/tools/index.ts +1 -0
  35. package/models/tools/solving-edu-task/index.ts +3 -0
  36. package/models/tools/solving-edu-task/solving-edu-task-config.schema.ts +8 -0
  37. package/models/tools/solving-edu-task/solving-edu-task-job.schema.ts +27 -0
  38. package/models/tools/solving-edu-task/solving-edu-task-model.schema.ts +25 -0
  39. package/package.json +1 -1
  40. package/build/constants/tool/enums/tool-type.enum.js +0 -13
  41. package/constants/tool/enums/tool-type.enum.ts +0 -9
@@ -58,3 +58,4 @@ export * from './user-profile';
58
58
  export * from './image-generation';
59
59
  export * from './marketplace-card';
60
60
  export * from './interior-design';
61
+ export * from './solving-edu-task';
@@ -0,0 +1,14 @@
1
+ export const SOLVING_EDU_TASK_CONTROLLER_PRIVATE = 'private/tools/solving-edu-task' as const;
2
+ export const SOLVING_EDU_TASK_CONTROLLER_PUBLIC = 'public/tools/solving-edu-task' as const;
3
+
4
+ export const SOLVING_EDU_TASK_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;
@@ -74,3 +74,4 @@ __exportStar(require("./user-profile"), exports);
74
74
  __exportStar(require("./image-generation"), exports);
75
75
  __exportStar(require("./marketplace-card"), exports);
76
76
  __exportStar(require("./interior-design"), exports);
77
+ __exportStar(require("./solving-edu-task"), exports);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SOLVING_EDU_TASK_ROUTES = exports.SOLVING_EDU_TASK_CONTROLLER_PUBLIC = exports.SOLVING_EDU_TASK_CONTROLLER_PRIVATE = void 0;
4
+ exports.SOLVING_EDU_TASK_CONTROLLER_PRIVATE = 'private/tools/solving-edu-task';
5
+ exports.SOLVING_EDU_TASK_CONTROLLER_PUBLIC = 'public/tools/solving-edu-task';
6
+ exports.SOLVING_EDU_TASK_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
+ };
@@ -27,3 +27,4 @@ __exportStar(require("./music"), exports);
27
27
  __exportStar(require("./image-generation"), exports);
28
28
  __exportStar(require("./marketplace-card"), exports);
29
29
  __exportStar(require("./interior-design"), exports);
30
+ __exportStar(require("./solving-edu-task"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteAllSolvingEduTaskJobsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var DeleteAllSolvingEduTaskJobsCommand;
6
+ (function (DeleteAllSolvingEduTaskJobsCommand) {
7
+ DeleteAllSolvingEduTaskJobsCommand.ResponseSchema = zod_1.z.object({
8
+ data: zod_1.z.boolean(),
9
+ });
10
+ })(DeleteAllSolvingEduTaskJobsCommand || (exports.DeleteAllSolvingEduTaskJobsCommand = DeleteAllSolvingEduTaskJobsCommand = {}));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteSolvingEduTaskJobByUUIDCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var DeleteSolvingEduTaskJobByUUIDCommand;
6
+ (function (DeleteSolvingEduTaskJobByUUIDCommand) {
7
+ DeleteSolvingEduTaskJobByUUIDCommand.RequestParamsSchema = zod_1.z.object({
8
+ uuid: zod_1.z.string().uuid(),
9
+ });
10
+ DeleteSolvingEduTaskJobByUUIDCommand.ResponseSchema = zod_1.z.object({
11
+ data: zod_1.z.boolean(),
12
+ });
13
+ })(DeleteSolvingEduTaskJobByUUIDCommand || (exports.DeleteSolvingEduTaskJobByUUIDCommand = DeleteSolvingEduTaskJobByUUIDCommand = {}));
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindSolvingEduTaskJobByUUIDCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var FindSolvingEduTaskJobByUUIDCommand;
7
+ (function (FindSolvingEduTaskJobByUUIDCommand) {
8
+ FindSolvingEduTaskJobByUUIDCommand.RequestParamsSchema = models_1.ToolJobSchema.pick({
9
+ uuid: true,
10
+ });
11
+ FindSolvingEduTaskJobByUUIDCommand.ResponseSchema = zod_1.z.object({
12
+ data: models_1.SolvingEduTaskJobSchema,
13
+ });
14
+ })(FindSolvingEduTaskJobByUUIDCommand || (exports.FindSolvingEduTaskJobByUUIDCommand = FindSolvingEduTaskJobByUUIDCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FindSolvingEduTaskJobsCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var FindSolvingEduTaskJobsCommand;
7
+ (function (FindSolvingEduTaskJobsCommand) {
8
+ FindSolvingEduTaskJobsCommand.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
+ FindSolvingEduTaskJobsCommand.ResponseSchema = zod_1.z.object({
14
+ data: zod_1.z.array(models_1.SolvingEduTaskJobSchema),
15
+ totalPages: zod_1.z.number(),
16
+ page: zod_1.z.number(),
17
+ });
18
+ })(FindSolvingEduTaskJobsCommand || (exports.FindSolvingEduTaskJobsCommand = FindSolvingEduTaskJobsCommand = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetSolvingEduTaskToolConfigCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var GetSolvingEduTaskToolConfigCommand;
7
+ (function (GetSolvingEduTaskToolConfigCommand) {
8
+ GetSolvingEduTaskToolConfigCommand.ResponseSchema = zod_1.z.object({
9
+ data: models_1.SolvingEduTaskConfigSchema,
10
+ });
11
+ })(GetSolvingEduTaskToolConfigCommand || (exports.GetSolvingEduTaskToolConfigCommand = GetSolvingEduTaskToolConfigCommand = {}));
@@ -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("./solving-edu-task.command"), exports);
18
+ __exportStar(require("./retry-solving-edu-task-job.command"), exports);
19
+ __exportStar(require("./get-solving-edu-task-tool-config.command"), exports);
20
+ __exportStar(require("./find-solving-edu-task-job-by-uuid.command"), exports);
21
+ __exportStar(require("./find-solving-edu-task-jobs.command"), exports);
22
+ __exportStar(require("./set-reaction-to-solving-edu-task-job.command"), exports);
23
+ __exportStar(require("./delete-solving-edu-task-job-by-uuid.command"), exports);
24
+ __exportStar(require("./delete-all-solving-edu-task-jobs.command"), exports);
25
+ __exportStar(require("./update-solving-edu-task-job-title.command"), exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetrySolvingEduTaskJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var RetrySolvingEduTaskJobCommand;
7
+ (function (RetrySolvingEduTaskJobCommand) {
8
+ RetrySolvingEduTaskJobCommand.RequestParamsSchema = zod_1.z.object({
9
+ uuid: zod_1.z.string().uuid(),
10
+ });
11
+ RetrySolvingEduTaskJobCommand.RequestBodySchema = zod_1.z.object({
12
+ prompt: zod_1.z.string().optional(),
13
+ modelId: zod_1.z.string().uuid().optional(),
14
+ params: zod_1.z
15
+ .object({
16
+ attachedFiles: zod_1.z.array(zod_1.z.string().uuid()),
17
+ })
18
+ .optional(),
19
+ });
20
+ RetrySolvingEduTaskJobCommand.ResponseSchema = zod_1.z.object({
21
+ data: models_1.SolvingEduTaskJobSchema,
22
+ });
23
+ })(RetrySolvingEduTaskJobCommand || (exports.RetrySolvingEduTaskJobCommand = RetrySolvingEduTaskJobCommand = {}));
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetReactionToSolvingEduTaskJobCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ const constants_1 = require("../../../constants");
7
+ var SetReactionToSolvingEduTaskJobCommand;
8
+ (function (SetReactionToSolvingEduTaskJobCommand) {
9
+ SetReactionToSolvingEduTaskJobCommand.RequestSchema = zod_1.z
10
+ .object({
11
+ reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
12
+ dislikeReason: zod_1.z.string().nullable().default(null),
13
+ })
14
+ .refine((data) => {
15
+ if (data.reaction !== constants_1.USER_REACTION.DISLIKED && data.dislikeReason) {
16
+ return false;
17
+ }
18
+ return true;
19
+ }, {
20
+ message: 'Dislike reason is not allowed when reaction is not DISLIKED',
21
+ });
22
+ SetReactionToSolvingEduTaskJobCommand.RequestParamsSchema = zod_1.z.object({
23
+ uuid: zod_1.z.string().uuid(),
24
+ });
25
+ SetReactionToSolvingEduTaskJobCommand.ResponseSchema = zod_1.z.object({
26
+ data: models_1.SolvingEduTaskJobSchema,
27
+ });
28
+ })(SetReactionToSolvingEduTaskJobCommand || (exports.SetReactionToSolvingEduTaskJobCommand = SetReactionToSolvingEduTaskJobCommand = {}));
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolvingEduTaskCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var SolvingEduTaskCommand;
7
+ (function (SolvingEduTaskCommand) {
8
+ SolvingEduTaskCommand.RequestSchema = zod_1.z
9
+ .object({
10
+ prompt: zod_1.z.string().optional(),
11
+ modelId: zod_1.z.string().uuid(),
12
+ params: zod_1.z.object({
13
+ attachedFiles: zod_1.z.array(zod_1.z.string().uuid()),
14
+ }),
15
+ })
16
+ .superRefine((data, ctx) => {
17
+ const hasPrompt = typeof data.prompt === 'string' && data.prompt.length > 0;
18
+ const hasAttachedFiles = data.params.attachedFiles.length > 0;
19
+ if (!hasAttachedFiles && !hasPrompt) {
20
+ ctx.addIssue({
21
+ code: zod_1.z.ZodIssueCode.custom,
22
+ message: 'prompt is required when no attachedFiles provided',
23
+ path: ['prompt'],
24
+ });
25
+ }
26
+ });
27
+ SolvingEduTaskCommand.ResponseSchema = zod_1.z.object({
28
+ data: models_1.SolvingEduTaskJobSchema,
29
+ });
30
+ })(SolvingEduTaskCommand || (exports.SolvingEduTaskCommand = SolvingEduTaskCommand = {}));
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateSolvingEduTaskJobTitleCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../../models");
6
+ var UpdateSolvingEduTaskJobTitleCommand;
7
+ (function (UpdateSolvingEduTaskJobTitleCommand) {
8
+ UpdateSolvingEduTaskJobTitleCommand.RequestSchema = zod_1.z.object({
9
+ title: zod_1.z.string(),
10
+ });
11
+ UpdateSolvingEduTaskJobTitleCommand.RequestParamsSchema = zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ });
14
+ UpdateSolvingEduTaskJobTitleCommand.ResponseSchema = zod_1.z.object({
15
+ data: models_1.SolvingEduTaskJobSchema,
16
+ });
17
+ })(UpdateSolvingEduTaskJobTitleCommand || (exports.UpdateSolvingEduTaskJobTitleCommand = UpdateSolvingEduTaskJobTitleCommand = {}));
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./tool-content-type.enum"), exports);
18
18
  __exportStar(require("./tool-job-status.enum"), exports);
19
- __exportStar(require("./tool-type.enum"), exports);
20
19
  __exportStar(require("./job-request-origin.enum"), exports);
@@ -28,3 +28,4 @@ __exportStar(require("./music"), exports);
28
28
  __exportStar(require("./image-generation"), exports);
29
29
  __exportStar(require("./marketplace-card"), exports);
30
30
  __exportStar(require("./interior-design"), exports);
31
+ __exportStar(require("./solving-edu-task"), exports);
@@ -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("./solving-edu-task-config.schema"), exports);
18
+ __exportStar(require("./solving-edu-task-job.schema"), exports);
19
+ __exportStar(require("./solving-edu-task-model.schema"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolvingEduTaskConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const solving_edu_task_model_schema_1 = require("./solving-edu-task-model.schema");
6
+ exports.SolvingEduTaskConfigSchema = zod_1.z.object({
7
+ models: zod_1.z.array(solving_edu_task_model_schema_1.SolvingEduTaskModelSchema),
8
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolvingEduTaskJobSchema = exports.SolvingEduTaskJobParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const common_1 = require("../common");
7
+ const constants_2 = require("../../../constants");
8
+ exports.SolvingEduTaskJobParamsSchema = zod_1.z.object({
9
+ attachedFiles: zod_1.z.array(common_1.AttachedToolFileSchema),
10
+ });
11
+ exports.SolvingEduTaskJobSchema = zod_1.z.object({
12
+ uuid: zod_1.z.string().uuid(),
13
+ prompt: zod_1.z.string(),
14
+ aiOutput: zod_1.z.string().nullable().optional(),
15
+ reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
16
+ title: zod_1.z.string(),
17
+ status: zod_1.z.nativeEnum(constants_2.TOOL_JOB_STATUS),
18
+ modelId: zod_1.z.string(),
19
+ price: zod_1.z.number(),
20
+ params: exports.SolvingEduTaskJobParamsSchema,
21
+ userId: zod_1.z.string().nullable().optional(),
22
+ createdAt: zod_1.z.date(),
23
+ updatedAt: zod_1.z.date(),
24
+ });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolvingEduTaskModelSchema = exports.SolvingEduTaskModelParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ exports.SolvingEduTaskModelParamsSchema = zod_1.z.object({
7
+ imageAttachment: zod_1.z.object({
8
+ supported: zod_1.z.boolean(),
9
+ maxImages: zod_1.z.number(),
10
+ acceptedTypes: zod_1.z.array(zod_1.z.string()),
11
+ }),
12
+ });
13
+ exports.SolvingEduTaskModelSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string(),
15
+ title: zod_1.z.string(),
16
+ description: zod_1.z.string(),
17
+ price: zod_1.z.number(),
18
+ order: zod_1.z.number(),
19
+ status: zod_1.z.nativeEnum(constants_1.TOOL_MODEL_STATUS),
20
+ maxPromptLength: zod_1.z.number(),
21
+ params: exports.SolvingEduTaskModelParamsSchema,
22
+ });
@@ -11,3 +11,4 @@ export * from './music';
11
11
  export * from './image-generation';
12
12
  export * from './marketplace-card';
13
13
  export * from './interior-design';
14
+ export * from './solving-edu-task';
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteAllSolvingEduTaskJobsCommand {
4
+ export const ResponseSchema = z.object({
5
+ data: z.boolean(),
6
+ });
7
+ export type Response = z.infer<typeof ResponseSchema>;
8
+ }
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteSolvingEduTaskJobByUUIDCommand {
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.object({
10
+ data: z.boolean(),
11
+ });
12
+ export type Response = z.infer<typeof ResponseSchema>;
13
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskJobSchema, ToolJobSchema } from '../../../models';
3
+
4
+ export namespace FindSolvingEduTaskJobByUUIDCommand {
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: SolvingEduTaskJobSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskJobSchema } from '../../../models';
3
+
4
+ export namespace FindSolvingEduTaskJobsCommand {
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(SolvingEduTaskJobSchema),
14
+ totalPages: z.number(),
15
+ page: z.number(),
16
+ });
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskConfigSchema } from '../../../models';
3
+
4
+ export namespace GetSolvingEduTaskToolConfigCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: SolvingEduTaskConfigSchema,
7
+ });
8
+ export type Response = z.infer<typeof ResponseSchema>;
9
+ }
@@ -0,0 +1,9 @@
1
+ export * from './solving-edu-task.command';
2
+ export * from './retry-solving-edu-task-job.command';
3
+ export * from './get-solving-edu-task-tool-config.command';
4
+ export * from './find-solving-edu-task-job-by-uuid.command';
5
+ export * from './find-solving-edu-task-jobs.command';
6
+ export * from './set-reaction-to-solving-edu-task-job.command';
7
+ export * from './delete-solving-edu-task-job-by-uuid.command';
8
+ export * from './delete-all-solving-edu-task-jobs.command';
9
+ export * from './update-solving-edu-task-job-title.command';
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskJobSchema } from '../../../models';
3
+
4
+ export namespace RetrySolvingEduTaskJobCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const RequestBodySchema = z.object({
11
+ prompt: z.string().optional(),
12
+ modelId: z.string().uuid().optional(),
13
+ params: z
14
+ .object({
15
+ attachedFiles: z.array(z.string().uuid()),
16
+ })
17
+ .optional(),
18
+ });
19
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
20
+
21
+ export const ResponseSchema = z.object({
22
+ data: SolvingEduTaskJobSchema,
23
+ });
24
+ export type Response = z.infer<typeof ResponseSchema>;
25
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskJobSchema } from '../../../models';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export namespace SetReactionToSolvingEduTaskJobCommand {
6
+ export const RequestSchema = z
7
+ .object({
8
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
9
+ dislikeReason: z.string().nullable().default(null),
10
+ })
11
+ .refine(
12
+ (data) => {
13
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
14
+ return false;
15
+ }
16
+ return true;
17
+ },
18
+ {
19
+ message: 'Dislike reason is not allowed when reaction is not DISLIKED',
20
+ },
21
+ );
22
+ export type Request = z.infer<typeof RequestSchema>;
23
+
24
+ export const RequestParamsSchema = z.object({
25
+ uuid: z.string().uuid(),
26
+ });
27
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
28
+
29
+ export const ResponseSchema = z.object({
30
+ data: SolvingEduTaskJobSchema,
31
+ });
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskJobSchema } from '../../../models';
3
+
4
+ export namespace SolvingEduTaskCommand {
5
+ export const RequestSchema = z
6
+ .object({
7
+ prompt: z.string().optional(),
8
+ modelId: z.string().uuid(),
9
+ params: z.object({
10
+ attachedFiles: z.array(z.string().uuid()),
11
+ }),
12
+ })
13
+ .superRefine((data, ctx) => {
14
+ const hasPrompt = typeof data.prompt === 'string' && data.prompt.length > 0;
15
+ const hasAttachedFiles = data.params.attachedFiles.length > 0;
16
+
17
+ if (!hasAttachedFiles && !hasPrompt) {
18
+ ctx.addIssue({
19
+ code: z.ZodIssueCode.custom,
20
+ message: 'prompt is required when no attachedFiles provided',
21
+ path: ['prompt'],
22
+ });
23
+ }
24
+ });
25
+ export type Request = z.infer<typeof RequestSchema>;
26
+
27
+ export const ResponseSchema = z.object({
28
+ data: SolvingEduTaskJobSchema,
29
+ });
30
+ export type Response = z.infer<typeof ResponseSchema>;
31
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateSolvingEduTaskJobTitleCommand {
5
+ export const RequestSchema = z.object({
6
+ title: z.string(),
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: SolvingEduTaskJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -1,4 +1,3 @@
1
1
  export * from './tool-content-type.enum';
2
2
  export * from './tool-job-status.enum';
3
- export * from './tool-type.enum';
4
3
  export * from './job-request-origin.enum';
@@ -12,3 +12,4 @@ export * from './music';
12
12
  export * from './image-generation';
13
13
  export * from './marketplace-card';
14
14
  export * from './interior-design';
15
+ export * from './solving-edu-task';
@@ -0,0 +1,3 @@
1
+ export * from './solving-edu-task-config.schema';
2
+ export * from './solving-edu-task-job.schema';
3
+ export * from './solving-edu-task-model.schema';
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ import { SolvingEduTaskModelSchema } from './solving-edu-task-model.schema';
3
+
4
+ export const SolvingEduTaskConfigSchema = z.object({
5
+ models: z.array(SolvingEduTaskModelSchema),
6
+ });
7
+
8
+ export type SolvingEduTaskConfig = z.infer<typeof SolvingEduTaskConfigSchema>;
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { USER_REACTION } from '../../../constants';
3
+ import { AttachedToolFileSchema } from '../common';
4
+ import { TOOL_JOB_STATUS } from '../../../constants';
5
+
6
+ export const SolvingEduTaskJobParamsSchema = z.object({
7
+ attachedFiles: z.array(AttachedToolFileSchema),
8
+ });
9
+
10
+ export type SolvingEduTaskJobParams = z.infer<typeof SolvingEduTaskJobParamsSchema>;
11
+
12
+ export const SolvingEduTaskJobSchema = z.object({
13
+ uuid: z.string().uuid(),
14
+ prompt: z.string(),
15
+ aiOutput: z.string().nullable().optional(),
16
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
17
+ title: z.string(),
18
+ status: z.nativeEnum(TOOL_JOB_STATUS),
19
+ modelId: z.string(),
20
+ price: z.number(),
21
+ params: SolvingEduTaskJobParamsSchema,
22
+ userId: z.string().nullable().optional(),
23
+ createdAt: z.date(),
24
+ updatedAt: z.date(),
25
+ });
26
+
27
+ export type SolvingEduTaskJob = z.infer<typeof SolvingEduTaskJobSchema>;
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_MODEL_STATUS } from '../../../constants';
3
+
4
+ export const SolvingEduTaskModelParamsSchema = z.object({
5
+ imageAttachment: z.object({
6
+ supported: z.boolean(),
7
+ maxImages: z.number(),
8
+ acceptedTypes: z.array(z.string()),
9
+ }),
10
+ });
11
+
12
+ export type SolvingEduTaskModelParams = z.infer<typeof SolvingEduTaskModelParamsSchema>;
13
+
14
+ export const SolvingEduTaskModelSchema = z.object({
15
+ uuid: z.string(),
16
+ title: z.string(),
17
+ description: z.string(),
18
+ price: z.number(),
19
+ order: z.number(),
20
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
21
+ maxPromptLength: z.number(),
22
+ params: SolvingEduTaskModelParamsSchema,
23
+ });
24
+
25
+ export type SolvingEduTaskModel = z.infer<typeof SolvingEduTaskModelSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.9.21",
3
+ "version": "0.9.23",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TOOL_TYPE = void 0;
4
- var TOOL_TYPE;
5
- (function (TOOL_TYPE) {
6
- TOOL_TYPE["PARAPHRASE"] = "paraphrase";
7
- TOOL_TYPE["TTS"] = "tts";
8
- TOOL_TYPE["STT"] = "stt";
9
- TOOL_TYPE["IMAGE_GENERATION"] = "image_generation";
10
- TOOL_TYPE["IMAGE_EDITOR"] = "image_editor";
11
- TOOL_TYPE["MUSIC"] = "music";
12
- TOOL_TYPE["INTERIOR_DESIGN"] = "interior_design";
13
- })(TOOL_TYPE || (exports.TOOL_TYPE = TOOL_TYPE = {}));
@@ -1,9 +0,0 @@
1
- export enum TOOL_TYPE {
2
- PARAPHRASE = 'paraphrase',
3
- TTS = 'tts',
4
- STT = 'stt',
5
- IMAGE_GENERATION = 'image_generation',
6
- IMAGE_EDITOR = 'image_editor',
7
- MUSIC = 'music',
8
- INTERIOR_DESIGN = 'interior_design',
9
- }