@purpleschool/gptbot-tools 0.0.78 → 0.0.79-ai-proxy

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 (167) hide show
  1. package/ai-proxy/index.ts +1 -0
  2. package/ai-proxy/routes/ai-proxy.routes.ts +8 -0
  3. package/ai-proxy/routes/index.ts +1 -0
  4. package/ai-vendor/index.ts +1 -0
  5. package/ai-vendor/models/ai-vendor.schema.ts +13 -0
  6. package/ai-vendor/models/index.ts +1 -0
  7. package/build/ai-proxy/index.js +17 -0
  8. package/build/ai-proxy/routes/ai-proxy.routes.js +10 -0
  9. package/build/ai-proxy/routes/index.js +17 -0
  10. package/build/ai-vendor/index.js +17 -0
  11. package/build/ai-vendor/models/ai-vendor.schema.js +13 -0
  12. package/build/ai-vendor/models/index.js +17 -0
  13. package/build/common/errors/errors.js +158 -0
  14. package/build/common/models/attached-file.schema.js +13 -0
  15. package/build/common/models/index.js +1 -0
  16. package/build/image-editor/commands/image-editor.command.js +3 -1
  17. package/build/image-editor/commands/retry-image-editor-job.command.js +4 -0
  18. package/build/image-editor/commands/set-reaction-to-image-editor-job.command.js +12 -2
  19. package/build/image-editor/enums/image-editor-model-type.enum.js +2 -0
  20. package/build/image-editor/enums/image-editor-strategy.enum.js +4 -0
  21. package/build/image-editor/models/image-editor-config.schema.js +1 -0
  22. package/build/image-editor/models/image-editor-job.schema.js +2 -0
  23. package/build/image-editor/models/image-editor-model.schema.js +9 -1
  24. package/build/image-editor/routes/image-editor.http.routes.js +1 -0
  25. package/build/image-generation/commands/execute-image-generation.command.js +20 -0
  26. package/build/image-generation/commands/forward-image-generation-job.command.js +32 -0
  27. package/build/image-generation/commands/index.js +23 -0
  28. package/build/image-generation/commands/save-image-generation-job.command.js +17 -0
  29. package/build/image-generation/commands/set-reaction-to-image-generation-job.command.js +27 -0
  30. package/build/image-generation/commands/soft-delete-image-generation-job-by-uuid.command.js +14 -0
  31. package/build/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.js +13 -0
  32. package/build/image-generation/commands/update-image-generation-job-title.command.js +16 -0
  33. package/build/image-generation/enums/image-generation-model-strategy.enum.js +23 -0
  34. package/build/image-generation/enums/image-generation-models.enum.js +8 -0
  35. package/build/image-generation/enums/image-generation-resolution.enum.js +9 -0
  36. package/build/image-generation/enums/index.js +19 -0
  37. package/build/image-generation/index.js +21 -0
  38. package/build/image-generation/models/image-generation-config.schema.js +12 -0
  39. package/build/image-generation/models/image-generation-job.schema.js +35 -0
  40. package/build/image-generation/models/image-generation-model.schema.js +51 -0
  41. package/build/image-generation/models/image-generation-preset.schema.js +13 -0
  42. package/build/image-generation/models/index.js +20 -0
  43. package/build/image-generation/queries/find-image-generation-job-by-id.query.js +19 -0
  44. package/build/image-generation/queries/find-image-generation-jobs.query.js +28 -0
  45. package/build/image-generation/queries/get-image-generation-config.query.js +11 -0
  46. package/build/image-generation/queries/index.js +19 -0
  47. package/build/image-generation/routes/image-generation.amqp.routes.js +14 -0
  48. package/build/image-generation/routes/image-generation.http.routes.js +9 -0
  49. package/build/image-generation/routes/index.js +18 -0
  50. package/build/index.js +7 -0
  51. package/build/music/commands/retry-music-job.command.js +2 -0
  52. package/build/music/commands/set-reaction-to-music-job.command.js +12 -2
  53. package/build/music/models/music-job.schema.js +1 -0
  54. package/build/music/models/music-track.schema.js +1 -0
  55. package/build/music/routes/music.http.routes.js +1 -4
  56. package/build/paraphrase/commands/delete-all-paraphrase-jobs.command.js +13 -0
  57. package/build/paraphrase/commands/delete-paraphrase-job-by-uuid.command.js +14 -0
  58. package/build/paraphrase/commands/index.js +5 -0
  59. package/build/paraphrase/commands/retry-paraphrase-job.command.js +16 -0
  60. package/build/paraphrase/commands/set-reaction-to-paraphrase-job.command.js +27 -0
  61. package/build/paraphrase/commands/update-paraphrase-job-title.command.js +16 -0
  62. package/build/paraphrase/models/paraphrase-job.schema.js +7 -0
  63. package/build/paraphrase/queries/find-paraphrase-jobs.query.js +28 -0
  64. package/build/paraphrase/queries/index.js +1 -0
  65. package/build/paraphrase/routes/paraphrase.amqp.routes.js +6 -0
  66. package/build/presentation/commands/index.js +1 -0
  67. package/build/presentation/commands/set-reaction-to-presentation.command.js +26 -0
  68. package/build/presentation/models/pptx-export-payload.js +19 -1
  69. package/build/presentation/models/presentation.schema.js +3 -0
  70. package/build/presentation/models/slide-content.schema.js +7 -3
  71. package/build/presentation/routes/presentation.routes.js +1 -0
  72. package/build/stt/commands/set-reaction-to-stt-job.command.js +12 -2
  73. package/build/stt/models/stt-job.schema.js +2 -0
  74. package/build/tools/enums/tool-content-type.enum.js +1 -0
  75. package/build/tools/enums/tool-type.enum.js +1 -0
  76. package/build/tools/models/global-tools-config.schema.js +2 -0
  77. package/build/tools/models/tools-with-configs.schema.js +5 -0
  78. package/build/tts/commands/set-reaction-to-tts-job.command.js +12 -2
  79. package/build/tts/models/tts-job.schema.js +2 -0
  80. package/build/video/commands/retry-video-job.command.js +4 -0
  81. package/build/video/commands/set-reaction-to-video-job.command.js +12 -2
  82. package/build/video/models/video-job.schema.js +3 -0
  83. package/build/video/models/video-model.schema.js +1 -0
  84. package/build/video-editor/commands/edit-video.command.js +2 -1
  85. package/build/video-editor/commands/retry-video-editor-job.command.js +5 -0
  86. package/build/video-editor/commands/set-reaction-to-video-editor-job.command.js +12 -2
  87. package/build/video-editor/models/video-editor-job.schema.js +3 -0
  88. package/build/writer/commands/set-reaction-writer-document.command.js +11 -1
  89. package/build/writer/models/writer-document.schema.js +1 -0
  90. package/common/errors/errors.ts +158 -0
  91. package/common/models/attached-file.schema.ts +11 -0
  92. package/common/models/index.ts +1 -0
  93. package/image-editor/commands/image-editor.command.ts +3 -1
  94. package/image-editor/commands/retry-image-editor-job.command.ts +5 -1
  95. package/image-editor/commands/set-reaction-to-image-editor-job.command.ts +19 -6
  96. package/image-editor/enums/image-editor-model-type.enum.ts +2 -0
  97. package/image-editor/enums/image-editor-strategy.enum.ts +4 -0
  98. package/image-editor/models/image-editor-config.schema.ts +1 -0
  99. package/image-editor/models/image-editor-job.schema.ts +3 -1
  100. package/image-editor/models/image-editor-model.schema.ts +16 -0
  101. package/image-editor/routes/image-editor.http.routes.ts +1 -0
  102. package/image-generation/commands/execute-image-generation.command.ts +20 -0
  103. package/image-generation/commands/forward-image-generation-job.command.ts +32 -0
  104. package/image-generation/commands/index.ts +7 -0
  105. package/image-generation/commands/save-image-generation-job.command.ts +17 -0
  106. package/image-generation/commands/set-reaction-to-image-generation-job.command.ts +30 -0
  107. package/image-generation/commands/soft-delete-image-generation-job-by-uuid.command.ts +14 -0
  108. package/image-generation/commands/soft-delete-image-generation-jobs-by-criteria.command.ts +13 -0
  109. package/image-generation/commands/update-image-generation-job-title.command.ts +16 -0
  110. package/image-generation/enums/image-generation-model-strategy.enum.ts +24 -0
  111. package/image-generation/enums/image-generation-models.enum.ts +4 -0
  112. package/image-generation/enums/image-generation-resolution.enum.ts +5 -0
  113. package/image-generation/enums/index.ts +3 -0
  114. package/image-generation/index.ts +5 -0
  115. package/image-generation/models/image-generation-config.schema.ts +11 -0
  116. package/image-generation/models/image-generation-job.schema.ts +37 -0
  117. package/image-generation/models/image-generation-model.schema.ts +64 -0
  118. package/image-generation/models/image-generation-preset.schema.ts +13 -0
  119. package/image-generation/models/index.ts +4 -0
  120. package/image-generation/queries/find-image-generation-job-by-id.query.ts +19 -0
  121. package/image-generation/queries/find-image-generation-jobs.query.ts +33 -0
  122. package/image-generation/queries/get-image-generation-config.query.ts +11 -0
  123. package/image-generation/queries/index.ts +3 -0
  124. package/image-generation/routes/image-generation.amqp.routes.ts +11 -0
  125. package/image-generation/routes/image-generation.http.routes.ts +7 -0
  126. package/image-generation/routes/index.ts +2 -0
  127. package/index.ts +7 -0
  128. package/music/commands/retry-music-job.command.ts +3 -1
  129. package/music/commands/set-reaction-to-music-job.command.ts +19 -6
  130. package/music/models/music-job.schema.ts +1 -0
  131. package/music/models/music-track.schema.ts +1 -0
  132. package/music/routes/music.http.routes.ts +0 -4
  133. package/package.json +1 -1
  134. package/paraphrase/commands/delete-all-paraphrase-jobs.command.ts +13 -0
  135. package/paraphrase/commands/delete-paraphrase-job-by-uuid.command.ts +14 -0
  136. package/paraphrase/commands/index.ts +5 -0
  137. package/paraphrase/commands/retry-paraphrase-job.command.ts +16 -0
  138. package/paraphrase/commands/set-reaction-to-paraphrase-job.command.ts +30 -0
  139. package/paraphrase/commands/update-paraphrase-job-title.command.ts +16 -0
  140. package/paraphrase/models/paraphrase-job.schema.ts +7 -0
  141. package/paraphrase/queries/find-paraphrase-jobs.query.ts +33 -0
  142. package/paraphrase/queries/index.ts +1 -0
  143. package/paraphrase/routes/paraphrase.amqp.routes.ts +6 -0
  144. package/presentation/commands/index.ts +1 -0
  145. package/presentation/commands/set-reaction-to-presentation.command.ts +29 -0
  146. package/presentation/models/pptx-export-payload.ts +20 -0
  147. package/presentation/models/presentation.schema.ts +3 -0
  148. package/presentation/models/slide-content.schema.ts +9 -3
  149. package/presentation/routes/presentation.routes.ts +1 -0
  150. package/stt/commands/set-reaction-to-stt-job.command.ts +19 -6
  151. package/stt/models/stt-job.schema.ts +2 -0
  152. package/tools/enums/tool-content-type.enum.ts +1 -0
  153. package/tools/enums/tool-type.enum.ts +1 -0
  154. package/tools/models/global-tools-config.schema.ts +2 -0
  155. package/tools/models/tools-with-configs.schema.ts +7 -0
  156. package/tts/commands/set-reaction-to-tts-job.command.ts +19 -6
  157. package/tts/models/tts-job.schema.ts +2 -0
  158. package/video/commands/retry-video-job.command.ts +4 -0
  159. package/video/commands/set-reaction-to-video-job.command.ts +19 -6
  160. package/video/models/video-job.schema.ts +3 -0
  161. package/video/models/video-model.schema.ts +1 -0
  162. package/video-editor/commands/edit-video.command.ts +2 -1
  163. package/video-editor/commands/retry-video-editor-job.command.ts +5 -0
  164. package/video-editor/commands/set-reaction-to-video-editor-job.command.ts +19 -6
  165. package/video-editor/models/video-editor-job.schema.ts +3 -0
  166. package/writer/commands/set-reaction-writer-document.command.ts +19 -6
  167. package/writer/models/writer-document.schema.ts +1 -0
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { AttachedFileSchema, IconVariantsSchema, TOOL_MODEL_STATUS } from '../../common';
3
+ import { IMAGE_GENERATION_MODEL_STRATEGY, IMAGE_GENERATION_RESOLUTION } from '../enums';
4
+
5
+ export const ImageGenerationRequestParamsSchema = z.object({
6
+ aspectRatio: z.string(),
7
+ attachedFiles: z.array(AttachedFileSchema),
8
+ enhancePrompt: z.boolean(),
9
+ resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
10
+ });
11
+ export type ImageGenerationRequestParams = z.infer<typeof ImageGenerationRequestParamsSchema>;
12
+
13
+ export const ImageGenerationModelParamsSchema = z.object({
14
+ aspectRatio: z.record(
15
+ z.string(),
16
+ z.object({
17
+ width: z.number(),
18
+ height: z.number(),
19
+ }),
20
+ ),
21
+ quality: z.string().optional(),
22
+ resolution: z
23
+ .object({
24
+ options: z.array(z.nativeEnum(IMAGE_GENERATION_RESOLUTION)),
25
+ })
26
+ .optional(),
27
+ });
28
+ export type ImageGenerationModelParams = z.infer<typeof ImageGenerationModelParamsSchema>;
29
+
30
+ export const ImageModelPricingRuleConditionSchema = z.object({
31
+ resolution: z.string().optional(),
32
+ withoutSub: z.boolean().optional(),
33
+ });
34
+ export type ImageModelPricingRuleCondition = z.infer<typeof ImageModelPricingRuleConditionSchema>;
35
+
36
+ export const ImageModelPricingRulesSchema = z.array(
37
+ z.object({
38
+ condition: ImageModelPricingRuleConditionSchema,
39
+ value: z.number(),
40
+ }),
41
+ );
42
+ export type ImageModelPricingRules = z.infer<typeof ImageModelPricingRulesSchema>;
43
+
44
+ export const ImageGenerationModelSchema = z.object({
45
+ uuid: z.string(),
46
+ title: z.string(),
47
+ description: z.string(),
48
+ aiModel: z.string(),
49
+ price: z.number(),
50
+ order: z.number(),
51
+ params: ImageGenerationModelParamsSchema,
52
+ strategy: z.nativeEnum(IMAGE_GENERATION_MODEL_STRATEGY),
53
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
54
+ maxPromptLength: z.number(),
55
+ iconVariants: IconVariantsSchema,
56
+ supportsImageAttachment: z.boolean(),
57
+ maxAttachedImages: z.number(),
58
+ vendorId: z.string().uuid(),
59
+ pricingRules: ImageModelPricingRulesSchema,
60
+ createdAt: z.date(),
61
+ updatedAt: z.date(),
62
+ });
63
+
64
+ export type ImageGenerationModel = z.infer<typeof ImageGenerationModelSchema>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+
3
+ export const ImageGenerationPresetSchema = z.object({
4
+ uuid: z.string().uuid(),
5
+ title: z.string(),
6
+ prompt: z.string(),
7
+ sample: z.string(),
8
+ order: z.number(),
9
+ createdAt: z.date(),
10
+ updatedAt: z.date(),
11
+ });
12
+
13
+ export type ImageGenerationPreset = z.infer<typeof ImageGenerationPresetSchema>;
@@ -0,0 +1,4 @@
1
+ export * from './image-generation-job.schema';
2
+ export * from './image-generation-model.schema';
3
+ export * from './image-generation-preset.schema';
4
+ export * from './image-generation-config.schema';
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageGenerationJobSchema } from '../models';
4
+
5
+ export namespace FindImageGenerationJobByIdQuery {
6
+ export const RequestSchema = z
7
+ .object({
8
+ uuid: z.string(),
9
+ userId: z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ })
12
+ .refine((data) => data.userId || data.unregisteredUserId, {
13
+ message: 'Either userId or unregisteredUserId must be provided',
14
+ });
15
+ export type Request = z.infer<typeof RequestSchema>;
16
+
17
+ export const ResponseSchema = ICommandResponseSchema(ImageGenerationJobSchema);
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageGenerationJobSchema } from '../models';
4
+
5
+ export namespace FindImageGenerationJobsQuery {
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 Boolean(data.userId) !== Boolean(data.unregisteredUserId);
17
+ },
18
+ {
19
+ message: 'At least userId or unregisteredUserId must be present',
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(ImageGenerationJobSchema),
28
+ page: z.number(),
29
+ totalPages: z.number(),
30
+ }),
31
+ );
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ImageGenerationConfigSchema } from '../models';
4
+
5
+ export namespace GetImageGenerationConfigQuery {
6
+ export const RequestSchema = z.object({});
7
+ export type Request = z.infer<typeof RequestSchema>;
8
+
9
+ export const ResponseSchema = ICommandResponseSchema(ImageGenerationConfigSchema);
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,3 @@
1
+ export * from './get-image-generation-config.query';
2
+ export * from './find-image-generation-job-by-id.query';
3
+ export * from './find-image-generation-jobs.query';
@@ -0,0 +1,11 @@
1
+ export const IMAGE_GENERATION_AMQP_ROUTES = {
2
+ EXECUTE: 'tools.image-generation.execute.rpc',
3
+ CONFIG: 'tools.image-generation.config.rpc',
4
+ FORWARD_JOB: 'tools.image-generation.jobs.forward.rpc',
5
+ GET_JOB: 'tools.image-generation.jobs.get.rpc',
6
+ LIST_JOBS: 'tools.image-generation.jobs.list.rpc',
7
+ SET_REACTION: 'tools.image-generation.jobs.set-reaction.rpc',
8
+ UPDATE_TITLE: 'tools.image-generation.jobs.update-title.rpc',
9
+ SOFT_DELETE: 'tools.image-generation.jobs.soft-delete.rpc',
10
+ SOFT_DELETE_ALL: 'tools.image-generation.jobs.soft-delete-all.rpc',
11
+ } as const;
@@ -0,0 +1,7 @@
1
+ export const IMAGE_GENERATION_CONTROLLER = 'image-generation';
2
+
3
+ export const IMAGE_GENERATION_ROUTES = {
4
+ KIE_MIDJOURNEY_CALLBACK: 'kie/midjourney/callback',
5
+ KIE_NANO_BANANA_CALLBACK: 'kie/nano-banana/callback',
6
+ KIE_FLUX_CALLBACK: 'kie/flux/callback',
7
+ } as const;
@@ -0,0 +1,2 @@
1
+ export * from './image-generation.amqp.routes';
2
+ export * from './image-generation.http.routes';
package/index.ts CHANGED
@@ -7,8 +7,11 @@ export * from './language';
7
7
  export * from './video';
8
8
  export * from './writer';
9
9
  export * from './image-editor';
10
+ export * from './image-generation';
10
11
  export * from './video-editor';
11
12
  export * from './music';
13
+ export * from './ai-proxy';
14
+ export * from './ai-vendor';
12
15
 
13
16
  import * as common from './common';
14
17
  import * as paraphrase from './paraphrase';
@@ -20,8 +23,10 @@ import * as language from './language';
20
23
  import * as video from './video';
21
24
  import * as writer from './writer';
22
25
  import * as imageEditor from './image-editor';
26
+ import * as imageGeneration from './image-generation';
23
27
  import * as videoEditor from './video-editor';
24
28
  import * as music from './music';
29
+ import * as aiVendor from './ai-vendor';
25
30
 
26
31
  export namespace ToolService {
27
32
  export import Common = common;
@@ -34,6 +39,8 @@ export namespace ToolService {
34
39
  export import Video = video;
35
40
  export import Writer = writer;
36
41
  export import ImageEditor = imageEditor;
42
+ export import ImageGeneration = imageGeneration;
37
43
  export import VideoEditor = videoEditor;
38
44
  export import Music = music;
45
+ export import AiVendor = aiVendor;
39
46
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
- import { MusicJobSchema } from '../models/music-job.schema';
3
+ import { MusicJobParamsSchema, MusicJobSchema } from '../models/music-job.schema';
4
4
 
5
5
  export namespace RetryMusicJobCommand {
6
6
  export const RequestSchema = z.object({
@@ -8,6 +8,8 @@ export namespace RetryMusicJobCommand {
8
8
  userBalance: z.number(),
9
9
  userId: z.string().uuid().nullable().optional(),
10
10
  unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ modelId: z.string().uuid().optional(),
12
+ params: MusicJobParamsSchema.optional(),
11
13
  });
12
14
  export type Request = z.infer<typeof RequestSchema>;
13
15
 
@@ -4,12 +4,25 @@ import { MusicJobSchema } from '../models/music-job.schema';
4
4
  import { USER_REACTION } from '../../common';
5
5
 
6
6
  export namespace SetReactionToMusicJobCommand {
7
- export const RequestSchema = z.object({
8
- userId: z.string().uuid().nullable().optional(),
9
- unregisteredUserId: z.string().uuid().nullable().optional(),
10
- uuid: z.string(),
11
- reaction: z.nativeEnum(USER_REACTION).nullable(),
12
- });
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
+ );
13
26
  export type Request = z.infer<typeof RequestSchema>;
14
27
 
15
28
  export const ResponseSchema = ICommandResponseSchema(MusicJobSchema);
@@ -35,6 +35,7 @@ export const MusicJobSchema = z.object({
35
35
  uuid: z.string(),
36
36
  prompt: z.string(),
37
37
  reaction: z.nativeEnum(USER_REACTION).nullable(),
38
+ dislikeReason: z.string().nullable(),
38
39
  externalId: z.string().nullable(),
39
40
  title: z.string(),
40
41
  status: z.nativeEnum(JOB_STATUS),
@@ -6,6 +6,7 @@ export const MusicTrackSchema = z.object({
6
6
  audioId: z.string(),
7
7
  audioUrl: z.string(),
8
8
  coverUrl: z.string(),
9
+ prompt: z.string().nullable(),
9
10
  tags: z.string(),
10
11
  duration: z.number(),
11
12
 
@@ -1,5 +1 @@
1
1
  export const MUSIC_CONTROLLER = 'music';
2
-
3
- export const MUSIC_ROUTES = {
4
- KIE_SUNO_CALLBACK: '/kie/suno/callback',
5
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot-tools",
3
- "version": "0.0.78",
3
+ "version": "0.0.79-ai-proxy",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+
4
+ export namespace DeleteAllParaphraseJobsCommand {
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 DeleteParaphraseJobByUuidCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ uuid: z.string(),
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
+ }
@@ -1 +1,6 @@
1
1
  export * from './paraphrase.command';
2
+ export * from './delete-paraphrase-job-by-uuid.command';
3
+ export * from './delete-all-paraphrase-jobs.command';
4
+ export * from './set-reaction-to-paraphrase-job.command';
5
+ export * from './update-paraphrase-job-title.command';
6
+ export * from './retry-paraphrase-job.command';
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
4
+
5
+ export namespace RetryParaphraseJobCommand {
6
+ export const RequestSchema = z.object({
7
+ uuid: z.string().uuid(),
8
+ userBalance: z.number(),
9
+ userId: z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: z.string().uuid().nullable().optional(),
11
+ });
12
+ export type Request = z.infer<typeof RequestSchema>;
13
+
14
+ export const ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
4
+ import { USER_REACTION } from '../../common';
5
+
6
+ export namespace SetReactionToParaphraseJobCommand {
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(ParaphraseJobSchema);
29
+ export type Response = z.infer<typeof ResponseSchema>;
30
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
4
+
5
+ export namespace UpdateParaphraseJobTitleCommand {
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 ResponseSchema = ICommandResponseSchema(ParaphraseJobSchema);
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { JOB_STATUS } from '../../tools';
3
+ import { USER_REACTION } from '../../common';
4
+ import { PARAPHRASING_INTENSITY } from '../enums';
3
5
 
4
6
  export const ParaphraseJobSchema = z.object({
5
7
  uuid: z.string(),
@@ -10,8 +12,13 @@ export const ParaphraseJobSchema = z.object({
10
12
  aiTokenUsage: z.number().nullable(),
11
13
  price: z.number(),
12
14
  status: z.nativeEnum(JOB_STATUS),
15
+ title: z.string(),
16
+ error: z.string().nullable(),
17
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
18
+ dislikeReason: z.string().nullable(),
13
19
  typeId: z.string(),
14
20
  styleId: z.string(),
21
+ intensity: z.nativeEnum(PARAPHRASING_INTENSITY),
15
22
  createdAt: z.date(),
16
23
  updatedAt: z.date(),
17
24
  completedAt: z.date().nullable(),
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { ParaphraseJobSchema } from '../models/paraphrase-job.schema';
4
+
5
+ export namespace FindParaphraseJobsQuery {
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 Boolean(data.userId) !== Boolean(data.unregisteredUserId);
17
+ },
18
+ {
19
+ message: 'At least userId or unregisteredUserId must be present',
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(ParaphraseJobSchema),
28
+ page: z.number(),
29
+ totalPages: z.number(),
30
+ }),
31
+ );
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './find-paraphrase-job-by-uuid.query';
2
2
  export * from './get-paraphrase-tool-config.query';
3
+ export * from './find-paraphrase-jobs.query';
@@ -2,4 +2,10 @@ export const PARAPHRASE_AMQP_ROUTES = {
2
2
  EXECUTE: 'tools.paraphrase.execute.rpc',
3
3
  CONFIG: 'tools.paraphrase.config.rpc',
4
4
  GET_JOB: 'tools.paraphrase.jobs.get.rpc',
5
+ LIST_JOBS: 'tools.paraphrase.jobs.list.rpc',
6
+ SET_REACTION: 'tools.paraphrase.jobs.set-reaction.rpc',
7
+ UPDATE_TITLE: 'tools.paraphrase.jobs.update-title.rpc',
8
+ SOFT_DELETE: 'tools.paraphrase.jobs.soft-delete.rpc',
9
+ SOFT_DELETE_ALL: 'tools.paraphrase.jobs.soft-delete-all.rpc',
10
+ RETRY: 'tools.paraphrase.jobs.retry.rpc',
5
11
  } as const;
@@ -16,3 +16,4 @@ export * from './update-slide-image-slot.command';
16
16
  export * from './update-slide.command';
17
17
  export * from './presentation-paraphrase.command';
18
18
  export * from './presentation-generate-report.command';
19
+ export * from './set-reaction-to-presentation.command';
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema, USER_REACTION } from '../../common';
3
+ import { PresentationSchema } from '../models';
4
+
5
+ export namespace SetReactionToPresentationCommand {
6
+ export const RequestSchema = z
7
+ .object({
8
+ userId: z.string().uuid().nullable().optional(),
9
+ unregisteredUserId: z.string().uuid().nullable().optional(),
10
+ uuid: z.string().uuid(),
11
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
12
+ dislikeReason: z.string().nullable().default(null),
13
+ })
14
+ .refine(
15
+ (data) => {
16
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
17
+ return false;
18
+ }
19
+ return true;
20
+ },
21
+ {
22
+ message: 'Dislike reason is not allowed when reaction is not disliked',
23
+ },
24
+ );
25
+ export type Request = z.infer<typeof RequestSchema>;
26
+
27
+ export const ResponseSchema = ICommandResponseSchema(PresentationSchema);
28
+ export type Response = z.infer<typeof ResponseSchema>;
29
+ }
@@ -5,6 +5,7 @@ export enum PPTX_SHAPE_TYPE {
5
5
  PICTURE_BOX = 'picture_box',
6
6
  CUSTOM_SHAPE = 'custom_shape',
7
7
  TABLE = 'table',
8
+ CHEVRON = 'chevron',
8
9
  }
9
10
 
10
11
  export enum PPTX_H_ALIGN {
@@ -47,6 +48,13 @@ export enum PPTX_CUSTOM_SHAPE_TYPE {
47
48
  ROUND_RECT = 'roundRect',
48
49
  }
49
50
 
51
+ export enum PPTX_CHEVRON_DIRECTION {
52
+ RIGHT = 'right',
53
+ LEFT = 'left',
54
+ UP = 'up',
55
+ DOWN = 'down',
56
+ }
57
+
50
58
  export const PPTXShadowSchema = z.object({
51
59
  type: z.nativeEnum(PPTX_SHADOW_TYPE),
52
60
  opacity: z.number().min(0).max(100).optional().describe('percents, range 0-100'),
@@ -182,6 +190,17 @@ export const PPTXTableShapeSchema = z.object({
182
190
  });
183
191
  export type PPTXTableShape = z.infer<typeof PPTXTableShapeSchema>;
184
192
 
193
+ // Chevron
194
+ export const PPTXChevronShapeSchema = z.object({
195
+ type: z.literal(PPTX_SHAPE_TYPE.CHEVRON),
196
+ direction: z.nativeEnum(PPTX_CHEVRON_DIRECTION).default(PPTX_CHEVRON_DIRECTION.RIGHT),
197
+ position: PPTXPositionSchema,
198
+ fill: PPTXFillSchema.optional(),
199
+ align: z.nativeEnum(PPTX_H_ALIGN).optional().default(PPTX_H_ALIGN.CENTER),
200
+ valign: z.nativeEnum(PPTX_V_ALIGN).optional().default(PPTX_V_ALIGN.MIDDLE),
201
+ });
202
+ export type PPTXChevronShape = z.infer<typeof PPTXChevronShapeSchema>;
203
+
185
204
  // Overview
186
205
 
187
206
  export const PPTXShapeSchema = z.discriminatedUnion('type', [
@@ -189,6 +208,7 @@ export const PPTXShapeSchema = z.discriminatedUnion('type', [
189
208
  PPTXPictureBoxSchema,
190
209
  PPTXCustomShapeSchema,
191
210
  PPTXTableShapeSchema,
211
+ PPTXChevronShapeSchema,
192
212
  ]);
193
213
  export type PPTXShape = z.infer<typeof PPTXShapeSchema>;
194
214
 
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { PRESENTATION_STAGE } from '../enums';
3
3
  import { SlideOutlineSchema } from './slide-outline.schema';
4
4
  import { SlideSchema } from './slide.schema';
5
+ import { USER_REACTION } from '../../common';
5
6
 
6
7
  export const PresentationSchema = z.object({
7
8
  uuid: z.string().uuid(),
@@ -12,6 +13,8 @@ export const PresentationSchema = z.object({
12
13
  languageId: z.string(),
13
14
  templateId: z.string(),
14
15
  downloadUrl: z.string().nullable(),
16
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
17
+ dislikeReason: z.string().nullable(),
15
18
  userId: z.string().uuid().nullable().optional(),
16
19
  unregisteredUserId: z.string().uuid().nullable().optional(),
17
20
  slideCount: z.number(),
@@ -342,7 +342,13 @@ export const TimelineSlideDataSchema = z.object({
342
342
  )
343
343
  .min(2)
344
344
  .max(50),
345
- title: z.string().describe('Event title in 2-4 words').min(5).max(80),
345
+ title: z
346
+ .string()
347
+ .describe(
348
+ 'Event title. Prefer 2 words, max 3 words. Keep it short and punchy.',
349
+ )
350
+ .min(5)
351
+ .max(60),
346
352
  description: z
347
353
  .string()
348
354
  .describe('Brief description of the event or milestone')
@@ -350,8 +356,8 @@ export const TimelineSlideDataSchema = z.object({
350
356
  .max(150),
351
357
  }),
352
358
  )
353
- .length(5)
354
- .describe('Timeline must contain exactly 5 chronological events'),
359
+ .length(4)
360
+ .describe('Timeline must contain exactly 4 chronological events'),
355
361
  }),
356
362
  version: z.literal(1),
357
363
  }) satisfies z.ZodType<ITimelineSlideDataStructure>;
@@ -18,6 +18,7 @@ export const PRESENTATION_AMQP_ROUTES = {
18
18
  UPDATE_SLIDE: 'tools.presentation.update-slide.rpc',
19
19
  PARAPHRASE: 'tools.presentation.actions.paraphrase.rpc',
20
20
  GENERATE_REPORT: 'tools.presentation.actions.generate-report.rpc',
21
+ SET_REACTION: 'tools.presentation.set-reaction.rpc',
21
22
  } as const;
22
23
 
23
24
  export const PRESENTATION_SLIDE_OUTLINE_AMQP_ROUTES = {
@@ -4,12 +4,25 @@ import { USER_REACTION } from '../../common';
4
4
  import { STTJobSchema } from '../models';
5
5
 
6
6
  export namespace SetReactionToSTTJobCommand {
7
- export const RequestSchema = z.object({
8
- userId: z.string().uuid().nullable().optional(),
9
- unregisteredUserId: z.string().uuid().nullable().optional(),
10
- uuid: z.string(),
11
- reaction: z.nativeEnum(USER_REACTION).nullable(),
12
- });
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
+ );
13
26
  export type Request = z.infer<typeof RequestSchema>;
14
27
 
15
28
  export const ResponseSchema = ICommandResponseSchema(STTJobSchema);