@purpleschool/gptbot-tools 0.0.128 → 0.0.130-stage-2

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 (129) hide show
  1. package/build/image-editor/commands/get-image-editor-price.command.js +24 -0
  2. package/build/image-editor/commands/image-editor.command.js +2 -1
  3. package/build/image-editor/commands/index.js +1 -0
  4. package/build/image-editor/commands/retry-image-editor-job.command.js +2 -1
  5. package/build/image-editor/models/image-editor-job.schema.js +1 -0
  6. package/build/image-editor/routes/image-editor.amqp.routes.js +1 -0
  7. package/build/image-generation/commands/execute-image-generation.command.js +3 -2
  8. package/build/image-generation/commands/get-image-generation-price.command.js +22 -0
  9. package/build/image-generation/commands/index.js +1 -0
  10. package/build/image-generation/commands/retry-image-generation-job.command.js +4 -3
  11. package/build/image-generation/models/image-generation-job.schema.js +1 -0
  12. package/build/image-generation/routes/image-generation.amqp.routes.js +1 -0
  13. package/build/music/commands/generate-music.command.js +3 -1
  14. package/build/music/commands/get-music-price.command.js +20 -0
  15. package/build/music/commands/index.js +1 -0
  16. package/build/music/commands/retry-music-job.command.js +3 -1
  17. package/build/music/models/music-job.schema.js +1 -0
  18. package/build/music/models/music-model.schema.js +9 -1
  19. package/build/music/models/music-track.schema.js +1 -0
  20. package/build/music/routes/music.amqp.routes.js +1 -0
  21. package/build/paraphrase/commands/get-paraphrase-price.command.js +15 -0
  22. package/build/paraphrase/commands/index.js +1 -0
  23. package/build/paraphrase/commands/paraphrase.command.js +2 -1
  24. package/build/paraphrase/commands/retry-paraphrase-job.command.js +2 -1
  25. package/build/paraphrase/models/paraphrase-job.schema.js +1 -0
  26. package/build/paraphrase/routes/paraphrase.amqp.routes.js +1 -0
  27. package/build/presentation/commands/generate-slides.command.js +2 -1
  28. package/build/presentation/commands/get-presentation-slides-generation-price.command.js +15 -0
  29. package/build/presentation/commands/index.js +1 -0
  30. package/build/presentation/models/presentation.schema.js +1 -0
  31. package/build/presentation/routes/presentation.routes.js +1 -0
  32. package/build/stt/commands/get-stt-price.command.js +16 -0
  33. package/build/stt/commands/index.js +1 -0
  34. package/build/stt/commands/retry-stt-job.command.js +2 -1
  35. package/build/stt/commands/stt.command.js +2 -1
  36. package/build/stt/models/stt-job.schema.js +1 -0
  37. package/build/stt/routes/stt.amqp.routes.js +1 -0
  38. package/build/tools/events/index.js +1 -0
  39. package/build/tools/events/tool-job-failed.event.js +14 -0
  40. package/build/tools/models/tool-job.schema.js +1 -0
  41. package/build/tools/routes/tools.aqmp.routes.js +1 -0
  42. package/build/tts/commands/get-tts-price.command.js +16 -0
  43. package/build/tts/commands/index.js +1 -0
  44. package/build/tts/commands/retry-tts-job.command.js +2 -1
  45. package/build/tts/commands/tts.command.js +2 -1
  46. package/build/tts/models/tts-job.schema.js +1 -0
  47. package/build/tts/routes/tts.amqp.routes.js +1 -0
  48. package/build/video/commands/get-video-price.command.js +17 -0
  49. package/build/video/commands/index.js +1 -0
  50. package/build/video/commands/retry-video-job.command.js +2 -1
  51. package/build/video/commands/video.command.js +2 -1
  52. package/build/video/models/video-job.schema.js +1 -0
  53. package/build/video/routes/video.amqp.routes.js +1 -0
  54. package/build/video-editor/commands/edit-video.command.js +2 -1
  55. package/build/video-editor/commands/get-video-editor-price.command.js +15 -0
  56. package/build/video-editor/commands/index.js +1 -0
  57. package/build/video-editor/commands/retry-video-editor-job.command.js +2 -1
  58. package/build/video-editor/models/video-editor-job.schema.js +1 -0
  59. package/build/video-editor/routes/video-editor.amqp.routes.js +1 -0
  60. package/build/writer/commands/generate-document-contents.command.js +2 -1
  61. package/build/writer/commands/get-writer-content-generation-price.command.js +16 -0
  62. package/build/writer/commands/index.js +1 -0
  63. package/build/writer/models/writer-document.schema.js +1 -0
  64. package/build/writer/routes/writer.routes.js +1 -0
  65. package/image-editor/commands/get-image-editor-price.command.ts +26 -0
  66. package/image-editor/commands/image-editor.command.ts +2 -1
  67. package/image-editor/commands/index.ts +1 -0
  68. package/image-editor/commands/retry-image-editor-job.command.ts +2 -1
  69. package/image-editor/models/image-editor-job.schema.ts +1 -0
  70. package/image-editor/routes/image-editor.amqp.routes.ts +1 -0
  71. package/image-generation/commands/execute-image-generation.command.ts +3 -2
  72. package/image-generation/commands/get-image-generation-price.command.ts +24 -0
  73. package/image-generation/commands/index.ts +1 -0
  74. package/image-generation/commands/retry-image-generation-job.command.ts +4 -3
  75. package/image-generation/models/image-generation-job.schema.ts +1 -0
  76. package/image-generation/routes/image-generation.amqp.routes.ts +1 -0
  77. package/music/commands/generate-music.command.ts +3 -1
  78. package/music/commands/get-music-price.command.ts +22 -0
  79. package/music/commands/index.ts +1 -0
  80. package/music/commands/retry-music-job.command.ts +3 -1
  81. package/music/models/music-job.schema.ts +1 -0
  82. package/music/models/music-model.schema.ts +14 -0
  83. package/music/models/music-track.schema.ts +1 -0
  84. package/music/routes/music.amqp.routes.ts +1 -0
  85. package/package.json +1 -1
  86. package/paraphrase/commands/get-paraphrase-price.command.ts +16 -0
  87. package/paraphrase/commands/index.ts +1 -0
  88. package/paraphrase/commands/paraphrase.command.ts +2 -1
  89. package/paraphrase/commands/retry-paraphrase-job.command.ts +2 -1
  90. package/paraphrase/models/paraphrase-job.schema.ts +1 -0
  91. package/paraphrase/routes/paraphrase.amqp.routes.ts +1 -0
  92. package/presentation/commands/generate-slides.command.ts +2 -1
  93. package/presentation/commands/get-presentation-slides-generation-price.command.ts +16 -0
  94. package/presentation/commands/index.ts +1 -0
  95. package/presentation/models/presentation.schema.ts +1 -0
  96. package/presentation/routes/presentation.routes.ts +1 -0
  97. package/stt/commands/get-stt-price.command.ts +17 -0
  98. package/stt/commands/index.ts +1 -0
  99. package/stt/commands/retry-stt-job.command.ts +2 -1
  100. package/stt/commands/stt.command.ts +2 -1
  101. package/stt/models/stt-job.schema.ts +1 -0
  102. package/stt/routes/stt.amqp.routes.ts +1 -0
  103. package/tools/events/index.ts +1 -0
  104. package/tools/events/tool-job-failed.event.ts +13 -0
  105. package/tools/models/tool-job.schema.ts +1 -0
  106. package/tools/routes/tools.aqmp.routes.ts +1 -0
  107. package/tts/commands/get-tts-price.command.ts +17 -0
  108. package/tts/commands/index.ts +1 -0
  109. package/tts/commands/retry-tts-job.command.ts +2 -1
  110. package/tts/commands/tts.command.ts +2 -1
  111. package/tts/models/tts-job.schema.ts +1 -0
  112. package/tts/routes/tts.amqp.routes.ts +1 -0
  113. package/video/commands/get-video-price.command.ts +18 -0
  114. package/video/commands/index.ts +1 -0
  115. package/video/commands/retry-video-job.command.ts +2 -1
  116. package/video/commands/video.command.ts +2 -1
  117. package/video/models/video-job.schema.ts +1 -0
  118. package/video/routes/video.amqp.routes.ts +1 -0
  119. package/video-editor/commands/edit-video.command.ts +2 -1
  120. package/video-editor/commands/get-video-editor-price.command.ts +16 -0
  121. package/video-editor/commands/index.ts +1 -0
  122. package/video-editor/commands/retry-video-editor-job.command.ts +2 -1
  123. package/video-editor/models/video-editor-job.schema.ts +1 -0
  124. package/video-editor/routes/video-editor.amqp.routes.ts +1 -0
  125. package/writer/commands/generate-document-contents.command.ts +2 -1
  126. package/writer/commands/get-writer-content-generation-price.command.ts +17 -0
  127. package/writer/commands/index.ts +1 -0
  128. package/writer/models/writer-document.schema.ts +1 -0
  129. package/writer/routes/writer.routes.ts +1 -0
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetVideoPriceCommand = 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 GetVideoPriceCommand;
8
+ (function (GetVideoPriceCommand) {
9
+ GetVideoPriceCommand.RequestSchema = zod_1.z.object({
10
+ modelId: zod_1.z.string(),
11
+ params: models_1.VideoGenerationRequestParamsSchema,
12
+ });
13
+ GetVideoPriceCommand.ResponseDataSchema = zod_1.z.object({
14
+ price: zod_1.z.number(),
15
+ });
16
+ GetVideoPriceCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(GetVideoPriceCommand.ResponseDataSchema);
17
+ })(GetVideoPriceCommand || (exports.GetVideoPriceCommand = GetVideoPriceCommand = {}));
@@ -19,6 +19,7 @@ __exportStar(require("./delete-all-video-jobs.command"), exports);
19
19
  __exportStar(require("./retry-video-job.command"), exports);
20
20
  __exportStar(require("./set-reaction-to-video-job.command"), exports);
21
21
  __exportStar(require("./video.command"), exports);
22
+ __exportStar(require("./get-video-price.command"), exports);
22
23
  __exportStar(require("./update-video-job-title.command"), exports);
23
24
  __exportStar(require("./video-model"), exports);
24
25
  __exportStar(require("./update-published-status-video-jobs.command"), exports);
@@ -9,12 +9,13 @@ var RetryVideoJobCommand;
9
9
  (function (RetryVideoJobCommand) {
10
10
  RetryVideoJobCommand.RequestSchema = zod_1.z.object({
11
11
  uuid: zod_1.z.string().uuid(),
12
- userBalance: zod_1.z.number(),
13
12
  userId: zod_1.z.string().uuid().nullable().optional(),
14
13
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
15
14
  prompt: zod_1.z.string().optional(),
16
15
  modelId: zod_1.z.string().uuid().optional(),
17
16
  params: models_1.VideoGenerationRequestParamsSchema.optional(),
17
+ tokenReservationId: zod_1.z.string().uuid(),
18
+ precalculatedPrice: zod_1.z.number(),
18
19
  });
19
20
  RetryVideoJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_job_schema_1.VideoJobSchema);
20
21
  })(RetryVideoJobCommand || (exports.RetryVideoJobCommand = RetryVideoJobCommand = {}));
@@ -11,9 +11,10 @@ var VideoCommand;
11
11
  userId: zod_1.z.string().uuid().nullable().optional(),
12
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
13
  prompt: zod_1.z.string(),
14
- userBalance: zod_1.z.number(),
15
14
  modelId: zod_1.z.string(),
16
15
  params: models_1.VideoGenerationRequestParamsSchema,
16
+ tokenReservationId: zod_1.z.string().uuid(),
17
+ precalculatedPrice: zod_1.z.number(),
17
18
  });
18
19
  VideoCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_job_schema_1.VideoJobSchema);
19
20
  })(VideoCommand || (exports.VideoCommand = VideoCommand = {}));
@@ -33,6 +33,7 @@ exports.VideoJobSchema = zod_1.z.object({
33
33
  attempts: zod_1.z.array(zod_1.z.any()),
34
34
  userId: zod_1.z.string().nullable().optional(),
35
35
  unregisteredUserId: zod_1.z.string().nullable().optional(),
36
+ tokenReservationId: zod_1.z.string().nullable().optional(),
36
37
  isDeleted: zod_1.z.boolean(),
37
38
  createdAt: zod_1.z.date(),
38
39
  completedAt: zod_1.z.date().nullable().optional(),
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIDEO_AMQP_ROUTES = void 0;
4
4
  exports.VIDEO_AMQP_ROUTES = {
5
5
  EXECUTE: 'tools.video.execute.rpc',
6
+ GET_PRICE: 'tools.video.get-price.rpc',
6
7
  CONFIG: 'tools.video.config.rpc',
7
8
  GET_JOB: 'tools.video.jobs.get.rpc',
8
9
  LIST_JOBS: 'tools.video.jobs.list.rpc',
@@ -13,8 +13,9 @@ var EditVideoCommand;
13
13
  inputVideoId: zod_1.z.string().uuid(),
14
14
  inputVideoUrl: zod_1.z.string(),
15
15
  duration: zod_1.z.number(),
16
- userBalance: zod_1.z.number(),
17
16
  modelId: zod_1.z.string().uuid(),
17
+ tokenReservationId: zod_1.z.string().uuid(),
18
+ precalculatedPrice: zod_1.z.number(),
18
19
  });
19
20
  EditVideoCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(models_1.VideoEditorJobSchema);
20
21
  })(EditVideoCommand || (exports.EditVideoCommand = EditVideoCommand = {}));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetVideoEditorPriceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const command_response_schema_1 = require("../../common/models/command-response.schema");
6
+ var GetVideoEditorPriceCommand;
7
+ (function (GetVideoEditorPriceCommand) {
8
+ GetVideoEditorPriceCommand.RequestSchema = zod_1.z.object({
9
+ modelId: zod_1.z.string(),
10
+ });
11
+ GetVideoEditorPriceCommand.ResponseDataSchema = zod_1.z.object({
12
+ price: zod_1.z.number(),
13
+ });
14
+ GetVideoEditorPriceCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(GetVideoEditorPriceCommand.ResponseDataSchema);
15
+ })(GetVideoEditorPriceCommand || (exports.GetVideoEditorPriceCommand = GetVideoEditorPriceCommand = {}));
@@ -21,4 +21,5 @@ __exportStar(require("./set-reaction-to-video-editor-job.command"), exports);
21
21
  __exportStar(require("./update-video-editor-job-title.command"), exports);
22
22
  __exportStar(require("./update-published-status-video-editor-jobs.command"), exports);
23
23
  __exportStar(require("./edit-video.command"), exports);
24
+ __exportStar(require("./get-video-editor-price.command"), exports);
24
25
  __exportStar(require("./video-editor-model"), exports);
@@ -8,7 +8,6 @@ var RetryVideoEditorJobCommand;
8
8
  (function (RetryVideoEditorJobCommand) {
9
9
  RetryVideoEditorJobCommand.RequestSchema = zod_1.z.object({
10
10
  uuid: zod_1.z.string().uuid(),
11
- userBalance: zod_1.z.number(),
12
11
  userId: zod_1.z.string().uuid().nullable().optional(),
13
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
14
13
  prompt: zod_1.z.string().optional(),
@@ -16,6 +15,8 @@ var RetryVideoEditorJobCommand;
16
15
  inputVideoUrl: zod_1.z.string().optional(),
17
16
  duration: zod_1.z.number().optional(),
18
17
  modelId: zod_1.z.string().uuid().optional(),
18
+ tokenReservationId: zod_1.z.string().uuid(),
19
+ precalculatedPrice: zod_1.z.number(),
19
20
  });
20
21
  RetryVideoEditorJobCommand.ResponseSchema = (0, command_response_schema_1.ICommandResponseSchema)(video_editor_job_schema_1.VideoEditorJobSchema);
21
22
  })(RetryVideoEditorJobCommand || (exports.RetryVideoEditorJobCommand = RetryVideoEditorJobCommand = {}));
@@ -23,6 +23,7 @@ exports.VideoEditorJobSchema = zod_1.z.object({
23
23
  attempts: zod_1.z.array(zod_1.z.any()),
24
24
  userId: zod_1.z.string().nullable().optional(),
25
25
  unregisteredUserId: zod_1.z.string().nullable().optional(),
26
+ tokenReservationId: zod_1.z.string().nullable().optional(),
26
27
  isPublished: zod_1.z.boolean(),
27
28
  postId: zod_1.z.string().nullable(),
28
29
  isDeleted: zod_1.z.boolean(),
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VIDEO_EDITOR_AMQP_ROUTES = void 0;
4
4
  exports.VIDEO_EDITOR_AMQP_ROUTES = {
5
5
  EXECUTE: 'tools.video-editor.execute.rpc',
6
+ GET_PRICE: 'tools.video-editor.get-price.rpc',
6
7
  CONFIG: 'tools.video-editor.config.rpc',
7
8
  GET_JOB: 'tools.video-editor.jobs.get.rpc',
8
9
  LIST_JOBS: 'tools.video-editor.jobs.list.rpc',
@@ -10,7 +10,8 @@ var GenerateWriterDocumentContentsCommand;
10
10
  documentId: zod_1.z.string().uuid(),
11
11
  userId: zod_1.z.string().uuid().nullable().optional(),
12
12
  unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
13
- userBalance: zod_1.z.number(),
13
+ tokenReservationId: zod_1.z.string().uuid(),
14
+ precalculatedPrice: zod_1.z.number(),
14
15
  modelId: zod_1.z.string(),
15
16
  });
16
17
  GenerateWriterDocumentContentsCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(models_1.WriterDocumentSchema);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetWriterContentGenerationPriceCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../common");
6
+ var GetWriterContentGenerationPriceCommand;
7
+ (function (GetWriterContentGenerationPriceCommand) {
8
+ GetWriterContentGenerationPriceCommand.RequestSchema = zod_1.z.object({
9
+ documentId: zod_1.z.string().uuid(),
10
+ modelId: zod_1.z.string().uuid(),
11
+ });
12
+ GetWriterContentGenerationPriceCommand.ResponseDataSchema = zod_1.z.object({
13
+ price: zod_1.z.number(),
14
+ });
15
+ GetWriterContentGenerationPriceCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(GetWriterContentGenerationPriceCommand.ResponseDataSchema);
16
+ })(GetWriterContentGenerationPriceCommand || (exports.GetWriterContentGenerationPriceCommand = GetWriterContentGenerationPriceCommand = {}));
@@ -20,6 +20,7 @@ __exportStar(require("./delete-all-user-writer-documents.command"), exports);
20
20
  __exportStar(require("./update-writer-document-outline.command"), exports);
21
21
  __exportStar(require("./export-writer-document-as-docx.command"), exports);
22
22
  __exportStar(require("./generate-document-contents.command"), exports);
23
+ __exportStar(require("./get-writer-content-generation-price.command"), exports);
23
24
  __exportStar(require("./writer-paraphrase.command"), exports);
24
25
  __exportStar(require("./writer-extend-text.command"), exports);
25
26
  __exportStar(require("./writer-shorten-text.command"), exports);
@@ -23,6 +23,7 @@ exports.WriterDocumentSchema = zod_1.z.object({
23
23
  dislikeReason: zod_1.z.string().nullable(),
24
24
  pages: zod_1.z.number(),
25
25
  isDeleted: zod_1.z.boolean(),
26
+ tokenReservationId: zod_1.z.string().nullable().optional(),
26
27
  createdAt: zod_1.z.date(),
27
28
  updatedAt: zod_1.z.date(),
28
29
  completedAt: zod_1.z.date().nullable(),
@@ -11,6 +11,7 @@ exports.WRITER_AMQP_ROUTES = {
11
11
  UPDATE_DOCUMENT_OUTLINE: 'tools.writer.update-document-outline.rpc',
12
12
  UPDATE_DOCUMENT_CONTENTS: 'tools.writer.update-document-contents.rpc',
13
13
  GENERATE_DOCUMENT_CONTENTS: 'tools.writer.generate-document-contents.rpc',
14
+ GET_CONTENT_GENERATION_PRICE: 'tools.writer.content-generation.get-price.rpc',
14
15
  PARAPHRASE: 'tools.writer.actions.paraphrase.rpc',
15
16
  EXTEND_TEXT: 'tools.writer.actions.extend-text.rpc',
16
17
  SHORTEN_TEXT: 'tools.writer.actions.shorten-text.rpc',
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { AttachedFileSchema } from '../../common';
4
+
5
+ export namespace GetImageEditorPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ prompt: z.string(),
11
+ params: z.object({
12
+ attachedFiles: z.array(AttachedFileSchema),
13
+ systemPromptId: z.string().optional(),
14
+ }),
15
+ userHasActiveSubscriptionOrProduct: z.boolean(),
16
+ });
17
+ export type Request = z.infer<typeof RequestSchema>;
18
+
19
+ export const ResponseDataSchema = z.object({
20
+ price: z.number(),
21
+ });
22
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
23
+
24
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
@@ -8,13 +8,14 @@ export namespace ImageEditorCommand {
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
10
  prompt: z.string(),
11
- userBalance: z.number(),
12
11
  modelId: z.string(),
13
12
  params: z.object({
14
13
  attachedFiles: z.array(AttachedFileSchema),
15
14
  systemPromptId: z.string().optional(),
16
15
  }),
17
16
  userHasActiveSubscriptionOrProduct: z.boolean(),
17
+ tokenReservationId: z.string().uuid(),
18
+ precalculatedPrice: z.number(),
18
19
  });
19
20
  export type Request = z.infer<typeof RequestSchema>;
20
21
 
@@ -1,5 +1,6 @@
1
1
  export * from './delete-image-editor-job-by-uuid.command';
2
2
  export * from './delete-all-image-editor-jobs.command';
3
+ export * from './get-image-editor-price.command';
3
4
  export * from './retry-image-editor-job.command';
4
5
  export * from './set-reaction-to-image-editor-job.command';
5
6
  export * from './image-editor.command';
@@ -5,10 +5,11 @@ import { ImageEditorJobParamsSchema, ImageEditorJobSchema } from '../models';
5
5
  export namespace RetryImageEditorJobCommand {
6
6
  export const RequestSchema = z.object({
7
7
  uuid: z.string().uuid(),
8
- userBalance: z.number(),
9
8
  userId: z.string().uuid().nullable().optional(),
10
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
11
10
  userHasActiveSubscriptionOrProduct: z.boolean(),
11
+ tokenReservationId: z.string().uuid(),
12
+ precalculatedPrice: z.number(),
12
13
  modelId: z.string().optional(),
13
14
  prompt: z.string().optional(),
14
15
  params: ImageEditorJobParamsSchema.optional(),
@@ -29,6 +29,7 @@ export const ImageEditorJobSchema = z.object({
29
29
  isPublished: z.boolean(),
30
30
  postId: z.string().nullable(),
31
31
  isDeleted: z.boolean(),
32
+ tokenReservationId: z.string().nullable().optional(),
32
33
  createdAt: z.date(),
33
34
  completedAt: z.date().nullable().optional(),
34
35
  updatedAt: z.date(),
@@ -1,5 +1,6 @@
1
1
  export const IMAGE_EDITOR_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.image.execute.rpc',
3
+ GET_PRICE: 'tools.image.get-price.rpc',
3
4
  CONFIG: 'tools.image.config.rpc',
4
5
  GET_JOB: 'tools.image.jobs.get.rpc',
5
6
  LIST_JOBS: 'tools.image.jobs.list.rpc',
@@ -1,19 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
- import { ImageGenerationJobSchema, ImageGenerationRequestParamsSchema } from '../models';
4
3
  import { JOB_REQUEST_ORIGIN } from '../../tools';
4
+ import { ImageGenerationJobSchema, ImageGenerationRequestParamsSchema } from '../models';
5
5
 
6
6
  export namespace ExecuteImageGenerationCommand {
7
7
  export const RequestSchema = z.object({
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
10
  prompt: z.string(),
11
- userBalance: z.number(),
12
11
  modelId: z.string().uuid(),
13
12
  params: ImageGenerationRequestParamsSchema,
14
13
  presetId: z.string().uuid().nullable().optional(),
15
14
  origin: z.nativeEnum(JOB_REQUEST_ORIGIN).default(JOB_REQUEST_ORIGIN.API),
16
15
  userHasActiveSubscriptionOrProduct: z.boolean(),
16
+ tokenReservationId: z.string().uuid(),
17
+ precalculatedPrice: z.number(),
17
18
  });
18
19
  export type Request = z.infer<typeof RequestSchema>;
19
20
 
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageGenerationRequestParamsSchema } from '../models';
4
+
5
+ export namespace GetImageGenerationPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string().uuid(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ prompt: z.string(),
11
+ params: ImageGenerationRequestParamsSchema,
12
+ presetId: z.string().uuid().nullable().optional(),
13
+ userHasActiveSubscriptionOrProduct: z.boolean(),
14
+ });
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseDataSchema = z.object({
18
+ price: z.number(),
19
+ });
20
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
21
+
22
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './execute-image-generation.command';
2
2
  export * from './forward-image-generation-job.command';
3
+ export * from './get-image-generation-price.command';
3
4
  export * from './save-image-generation-job.command';
4
5
  export * from './soft-delete-image-generation-job-by-uuid.command';
5
6
  export * from './soft-delete-image-generation-jobs-by-criteria.command';
@@ -7,12 +7,13 @@ export namespace RetryImageGenerationJobCommand {
7
7
  uuid: z.string().uuid(),
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
- prompt: z.string().optional(),
11
- userBalance: z.number(),
10
+ userHasActiveSubscriptionOrProduct: z.boolean(),
11
+ tokenReservationId: z.string().uuid(),
12
+ precalculatedPrice: z.number(),
12
13
  modelId: z.string().uuid().optional(),
14
+ prompt: z.string().optional(),
13
15
  params: ImageGenerationRequestParamsSchema.optional(),
14
16
  presetId: z.string().uuid().nullable().optional(),
15
- userHasActiveSubscriptionOrProduct: z.boolean(),
16
17
  });
17
18
  export type Request = z.infer<typeof RequestSchema>;
18
19
 
@@ -32,6 +32,7 @@ export const ImageGenerationJobSchema = z.object({
32
32
  postId: z.string().nullable(),
33
33
  isDeleted: z.boolean(),
34
34
  internalError: z.string().nullable(),
35
+ tokenReservationId: z.string().nullable().optional(),
35
36
  createdAt: z.date(),
36
37
  updatedAt: z.date(),
37
38
  });
@@ -1,5 +1,6 @@
1
1
  export const IMAGE_GENERATION_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.image-generation.execute.rpc',
3
+ GET_PRICE: 'tools.image-generation.get-price.rpc',
3
4
  CONFIG: 'tools.image-generation.config.rpc',
4
5
  FORWARD_JOB: 'tools.image-generation.jobs.forward.rpc',
5
6
  GET_JOB: 'tools.image-generation.jobs.get.rpc',
@@ -7,9 +7,11 @@ export namespace GenerateMusicCommand {
7
7
  export const RequestSchema = z.object({
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
- userBalance: z.number(),
11
10
  modelId: z.string(),
12
11
  params: MusicJobParamsSchema,
12
+ tokenReservationId: z.string().uuid(),
13
+ precalculatedPrice: z.number(),
14
+ userHasActiveSubscriptionOrProduct: z.boolean(),
13
15
  });
14
16
  export type Request = z.infer<typeof RequestSchema>;
15
17
 
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { MusicJobParamsSchema } from '../models';
4
+
5
+ export namespace GetMusicPriceCommand {
6
+ export const RequestSchema = z.object({
7
+ modelId: z.string(),
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ params: MusicJobParamsSchema,
11
+ userHasActiveSubscriptionOrProduct: z.boolean(),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseDataSchema = z.object({
16
+ price: z.number(),
17
+ });
18
+ export type ResponseData = z.infer<typeof ResponseDataSchema>;
19
+
20
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
21
+ export type Response = z.infer<typeof ResponseSchema>;
22
+ }
@@ -3,6 +3,7 @@ export * from './delete-all-music-jobs.command';
3
3
  export * from './retry-music-job.command';
4
4
  export * from './set-reaction-to-music-job.command';
5
5
  export * from './generate-music.command';
6
+ export * from './get-music-price.command';
6
7
  export * from './update-music-job-title.command';
7
8
  export * from './convert-to-wav.command';
8
9
  export * from './generate-lyrics.command';
@@ -5,11 +5,13 @@ import { MusicJobParamsSchema, MusicJobSchema } from '../models/music-job.schema
5
5
  export namespace RetryMusicJobCommand {
6
6
  export const RequestSchema = z.object({
7
7
  uuid: z.string().uuid(),
8
- userBalance: z.number(),
9
8
  userId: z.string().uuid().nullable().optional(),
10
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ tokenReservationId: z.string().uuid(),
11
+ precalculatedPrice: z.number(),
11
12
  modelId: z.string().uuid().optional(),
12
13
  params: MusicJobParamsSchema.optional(),
14
+ userHasActiveSubscriptionOrProduct: z.boolean(),
13
15
  });
14
16
  export type Request = z.infer<typeof RequestSchema>;
15
17
 
@@ -48,6 +48,7 @@ export const MusicJobSchema = z.object({
48
48
  userId: z.string().nullable().optional(),
49
49
  unregisteredUserId: z.string().nullable().optional(),
50
50
  isDeleted: z.boolean(),
51
+ tokenReservationId: z.string().nullable().optional(),
51
52
  createdAt: z.date(),
52
53
  completedAt: z.date().nullable().optional(),
53
54
  updatedAt: z.date(),
@@ -20,6 +20,19 @@ export const MusicModelParamsSchema = z.object({
20
20
 
21
21
  export type MusicModelParams = z.infer<typeof MusicModelParamsSchema>;
22
22
 
23
+ export const MusicModelPricingRuleConditionSchema = z.object({
24
+ withoutSub: z.boolean().optional(),
25
+ });
26
+ export type MusicModelPricingRuleCondition = z.infer<typeof MusicModelPricingRuleConditionSchema>;
27
+
28
+ export const MusicModelPricingRulesSchema = z.array(
29
+ z.object({
30
+ condition: MusicModelPricingRuleConditionSchema,
31
+ value: z.number(),
32
+ }),
33
+ );
34
+ export type MusicModelPricingRules = z.infer<typeof MusicModelPricingRulesSchema>;
35
+
23
36
  export const MusicModelSchema = z.object({
24
37
  uuid: z.string(),
25
38
  title: z.string(),
@@ -33,6 +46,7 @@ export const MusicModelSchema = z.object({
33
46
  maxPromptLength: z.number(),
34
47
  maxLyricsLength: z.number(),
35
48
  params: MusicModelParamsSchema,
49
+ pricingRules: MusicModelPricingRulesSchema,
36
50
  createdAt: z.date(),
37
51
  updatedAt: z.date(),
38
52
  });
@@ -9,6 +9,7 @@ export const MusicTrackSchema = z.object({
9
9
  prompt: z.string().nullable(),
10
10
  tags: z.string(),
11
11
  duration: z.number(),
12
+ waveformPeaks: z.array(z.number()),
12
13
  isPublished: z.boolean().optional(),
13
14
  postId: z.string().nullable().optional(),
14
15
 
@@ -1,5 +1,6 @@
1
1
  export const MUSIC_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.music.execute.rpc',
3
+ GET_PRICE: 'tools.music.get-price.rpc',
3
4
  GENERATE_LYRICS: 'tools.music.generate-lyrics.rpc',
4
5
  CONVERT_TO_WAV: 'tools.music.convert-to-wav.rpc',
5
6
  CONFIG: 'tools.music.config.rpc',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.128",
3
+ "version": "0.0.130-stage-2",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace GetParaphrasePriceCommand {
5
+ export const RequestSchema = z.object({
6
+ typeId: z.string().uuid(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseDataSchema = z.object({
11
+ price: z.number(),
12
+ });
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -4,3 +4,4 @@ export * from './delete-all-paraphrase-jobs.command';
4
4
  export * from './set-reaction-to-paraphrase-job.command';
5
5
  export * from './update-paraphrase-job-title.command';
6
6
  export * from './retry-paraphrase-job.command';
7
+ export * from './get-paraphrase-price.command';
@@ -7,11 +7,12 @@ export namespace ParaphraseCommand {
7
7
  export const RequestSchema = z.object({
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
- userBalance: z.number(),
11
10
  prompt: z.string(),
12
11
  typeId: z.string().uuid(),
13
12
  styleId: z.string().uuid(),
14
13
  intensity: z.nativeEnum(PARAPHRASING_INTENSITY),
14
+ tokenReservationId: z.string().uuid(),
15
+ precalculatedPrice: z.number(),
15
16
  });
16
17
  export type Request = z.infer<typeof RequestSchema>;
17
18
 
@@ -5,9 +5,10 @@ import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
5
5
  export namespace RetryParaphraseJobCommand {
6
6
  export const RequestSchema = z.object({
7
7
  uuid: z.string().uuid(),
8
- userBalance: z.number(),
9
8
  userId: z.string().uuid().nullable().optional(),
10
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ tokenReservationId: z.string().uuid(),
11
+ precalculatedPrice: z.number(),
11
12
  });
12
13
  export type Request = z.infer<typeof RequestSchema>;
13
14
 
@@ -19,6 +19,7 @@ export const ParaphraseJobSchema = z.object({
19
19
  typeId: z.string(),
20
20
  styleId: z.string(),
21
21
  intensity: z.nativeEnum(PARAPHRASING_INTENSITY),
22
+ tokenReservationId: z.string().nullable().optional(),
22
23
  createdAt: z.date(),
23
24
  updatedAt: z.date(),
24
25
  completedAt: z.date().nullable(),
@@ -1,5 +1,6 @@
1
1
  export const PARAPHRASE_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.paraphrase.execute.rpc',
3
+ GET_PRICE: 'tools.paraphrase.get-price.rpc',
3
4
  CONFIG: 'tools.paraphrase.config.rpc',
4
5
  GET_JOB: 'tools.paraphrase.jobs.get.rpc',
5
6
  LIST_JOBS: 'tools.paraphrase.jobs.list.rpc',
@@ -7,7 +7,8 @@ export namespace GenerateSlidesCommand {
7
7
  uuid: z.string().uuid(),
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
- userBalance: z.number(),
10
+ tokenReservationId: z.string().uuid(),
11
+ precalculatedPrice: z.number(),
11
12
  });
12
13
  export type Request = z.infer<typeof RequestSchema>;
13
14
 
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common';
3
+
4
+ export namespace GetPresentationSlidesGenerationPriceCommand {
5
+ export const RequestSchema = z.object({
6
+ slideCount: z.number().int().min(1),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseDataSchema = z.object({
11
+ price: z.number(),
12
+ });
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(ResponseDataSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -7,6 +7,7 @@ export * from './generate-presentation-outline.command';
7
7
  export * from './generate-and-insert-slide.command';
8
8
  export * from './export-as-pptx.command';
9
9
  export * from './generate-slides.command';
10
+ export * from './get-presentation-slides-generation-price.command';
10
11
  export * from './reposition-slide-outline.command';
11
12
  export * from './update-slide-outline.command';
12
13
  export * from './update-presentation.command';
@@ -19,6 +19,7 @@ export const PresentationSchema = z.object({
19
19
  unregisteredUserId: z.string().uuid().nullable().optional(),
20
20
  slideCount: z.number(),
21
21
  isDeleted: z.boolean(),
22
+ tokenReservationId: z.string().nullable().optional(),
22
23
  lastContentUpdateAt: z.date().nullable(),
23
24
  lastPptxExportedAt: z.date().nullable(),
24
25
  createdAt: z.date(),
@@ -4,6 +4,7 @@ export const PRESENTATION_AMQP_ROUTES = {
4
4
  FIND_BY_UUID: 'tools.presentation.find-by-uuid.rpc',
5
5
  GENERATE_PRESENTATION_OUTLINE: 'tools.presentation.generate-outline.rpc',
6
6
  GENERATE_PRESENTATION_SLIDES: 'tools.presentation.generate-slides.rpc',
7
+ GET_SLIDES_GENERATION_PRICE: 'tools.presentation.slides.get-price.rpc',
7
8
  GENERATE_AND_INSERT_SLIDE: 'tools.presentation.generate-and-insert-slide.rpc',
8
9
  UPDATE_PRESENTATION_OUTLINE: 'tools.presentation.update-presentation-outline.rpc',
9
10
  LIST_PRESENTATIONS: 'tools.presentation.list-presentations.rpc',