@purpleschool/gptbot-tools 0.0.55 → 0.0.56-presentation

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 (186) hide show
  1. package/build/common/errors/errors.js +399 -2
  2. package/build/index.js +6 -0
  3. package/build/music/commands/convert-to-wav.command.js +15 -0
  4. package/build/music/commands/delete-all-music-jobs.command.js +13 -0
  5. package/build/music/commands/delete-music-job-by-uuid.command.js +14 -0
  6. package/build/music/commands/generate-lyrics.command.js +18 -0
  7. package/build/music/commands/generate-music.command.js +18 -0
  8. package/build/music/commands/index.js +24 -0
  9. package/build/music/commands/retry-music-job.command.js +16 -0
  10. package/build/music/commands/set-reaction-to-music-job.command.js +17 -0
  11. package/build/music/commands/update-music-job-title.command.js +16 -0
  12. package/build/music/enums/index.js +22 -0
  13. package/build/music/enums/music-action-type.enum.js +7 -0
  14. package/build/music/enums/music-pricing-rule-type.enum.js +7 -0
  15. package/build/music/enums/music-strategy.enum.js +7 -0
  16. package/build/music/enums/music-vocal-gender.enum.js +8 -0
  17. package/build/music/enums/suno-mode-type.enum.js +10 -0
  18. package/build/music/enums/suno-model-type.enum.js +10 -0
  19. package/build/music/index.js +22 -0
  20. package/build/music/models/index.js +20 -0
  21. package/build/music/models/music-config.schema.js +8 -0
  22. package/build/music/models/music-job.schema.js +54 -0
  23. package/build/music/models/music-model.schema.js +35 -0
  24. package/build/music/models/music-track.schema.js +17 -0
  25. package/build/music/queries/find-music-job-by-id.query.js +10 -0
  26. package/build/music/queries/find-music-jobs.query.js +28 -0
  27. package/build/music/queries/get-music-config.query.js +9 -0
  28. package/build/music/queries/index.js +19 -0
  29. package/build/music/routes/index.js +17 -0
  30. package/build/music/routes/music.amqp.routes.js +16 -0
  31. package/build/music/utils/calculate-music-generation-price.util.js +7 -0
  32. package/build/music/utils/index.js +17 -0
  33. package/build/presentation/commands/build-blank-slide.command.js +15 -0
  34. package/build/presentation/commands/generate-and-insert-slide.command.js +22 -0
  35. package/build/presentation/commands/index.js +7 -0
  36. package/build/presentation/commands/presentation-generate-report.command.js +18 -0
  37. package/build/presentation/commands/presentation-paraphrase.command.js +19 -0
  38. package/build/presentation/commands/update-presentation-slides.command.js +16 -0
  39. package/build/presentation/commands/update-slide-image-slot.command.js +34 -0
  40. package/build/presentation/commands/update-slide.command.js +17 -0
  41. package/build/presentation/enums/index.js +4 -0
  42. package/build/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
  43. package/build/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
  44. package/build/presentation/enums/presentation-ai-action-type.enum.js +8 -0
  45. package/build/presentation/enums/slide-image-slot-action.enum.js +8 -0
  46. package/build/presentation/index.js +1 -0
  47. package/build/presentation/models/index.js +1 -0
  48. package/build/presentation/models/presentation-ai-action.schema.js +27 -0
  49. package/build/presentation/models/presentation-config.schema.js +3 -0
  50. package/build/presentation/models/presentation.schema.js +4 -1
  51. package/build/presentation/models/slide-content-edit.schema.js +135 -0
  52. package/build/presentation/models/slide-content.schema.js +5 -1
  53. package/build/presentation/models/slide.schema.js +39 -1
  54. package/build/presentation/routes/presentation.routes.js +7 -0
  55. package/build/presentation/utils/calculate-presentation-ai-action-price.util.js +16 -0
  56. package/build/presentation/utils/index.js +17 -0
  57. package/build/tools/enums/tool-type.enum.js +4 -0
  58. package/build/video/enums/video-strategy.enum.js +2 -0
  59. package/build/video/routes/video.http.routes.js +1 -0
  60. package/build/video-editor/commands/delete-all-video-editor-jobs.command.js +13 -0
  61. package/build/video-editor/commands/delete-video-editor-job-by-uuid.command.js +14 -0
  62. package/build/video-editor/commands/edit-video.command.js +19 -0
  63. package/build/video-editor/commands/index.js +22 -0
  64. package/build/video-editor/commands/retry-video-editor-job.command.js +16 -0
  65. package/build/video-editor/commands/set-reaction-to-video-editor-job.command.js +17 -0
  66. package/build/video-editor/commands/update-video-editor-job-title.command.js +16 -0
  67. package/build/video-editor/enums/index.js +17 -0
  68. package/build/video-editor/enums/video-editor-model-strategy.enum.js +10 -0
  69. package/build/video-editor/index.js +22 -0
  70. package/build/video-editor/models/index.js +19 -0
  71. package/build/video-editor/models/video-editor-config.schema.js +11 -0
  72. package/build/video-editor/models/video-editor-job.schema.js +27 -0
  73. package/build/video-editor/models/video-editor-model.schema.js +24 -0
  74. package/build/video-editor/queries/find-video-editor-job-by-id.query.js +19 -0
  75. package/build/video-editor/queries/find-video-editor-jobs.query.js +28 -0
  76. package/build/video-editor/queries/get-video-editor-config.query.js +11 -0
  77. package/build/video-editor/queries/index.js +19 -0
  78. package/build/video-editor/routes/index.js +18 -0
  79. package/build/video-editor/routes/video-editor.amqp.routes.js +14 -0
  80. package/build/video-editor/routes/video-editor.http.routes.js +8 -0
  81. package/build/video-editor/utils/calculate-video-editing-price.js +10 -0
  82. package/build/video-editor/utils/index.js +17 -0
  83. package/build/writer/commands/generate-document-contents.command.js +1 -0
  84. package/build/writer/enums/index.js +1 -0
  85. package/build/writer/enums/writer-content-generation-strategy.enum.js +8 -0
  86. package/build/writer/index.js +1 -0
  87. package/build/writer/models/index.js +1 -0
  88. package/build/writer/models/writer-config.schema.js +2 -0
  89. package/build/writer/models/writer-document-type.schema.js +1 -0
  90. package/build/writer/models/writer-document.schema.js +1 -0
  91. package/build/writer/models/writer-model.schema.js +21 -0
  92. package/build/writer/utils/calculate-writer-content-generation-price.util.js +2 -2
  93. package/common/errors/errors.ts +408 -3
  94. package/index.ts +6 -0
  95. package/music/commands/convert-to-wav.command.ts +15 -0
  96. package/music/commands/delete-all-music-jobs.command.ts +13 -0
  97. package/music/commands/delete-music-job-by-uuid.command.ts +14 -0
  98. package/music/commands/generate-lyrics.command.ts +20 -0
  99. package/music/commands/generate-music.command.ts +18 -0
  100. package/music/commands/index.ts +8 -0
  101. package/music/commands/retry-music-job.command.ts +16 -0
  102. package/music/commands/set-reaction-to-music-job.command.ts +17 -0
  103. package/music/commands/update-music-job-title.command.ts +16 -0
  104. package/music/enums/index.ts +6 -0
  105. package/music/enums/music-action-type.enum.ts +3 -0
  106. package/music/enums/music-pricing-rule-type.enum.ts +3 -0
  107. package/music/enums/music-strategy.enum.ts +3 -0
  108. package/music/enums/music-vocal-gender.enum.ts +4 -0
  109. package/music/enums/suno-mode-type.enum.ts +6 -0
  110. package/music/enums/suno-model-type.enum.ts +6 -0
  111. package/music/index.ts +6 -0
  112. package/music/models/index.ts +4 -0
  113. package/music/models/music-config.schema.ts +8 -0
  114. package/music/models/music-job.schema.ts +57 -0
  115. package/music/models/music-model.schema.ts +40 -0
  116. package/music/models/music-track.schema.ts +19 -0
  117. package/music/queries/find-music-job-by-id.query.ts +11 -0
  118. package/music/queries/find-music-jobs.query.ts +33 -0
  119. package/music/queries/get-music-config.query.ts +8 -0
  120. package/music/queries/index.ts +3 -0
  121. package/music/routes/index.ts +1 -0
  122. package/music/routes/music.amqp.routes.ts +13 -0
  123. package/music/utils/calculate-music-generation-price.util.ts +5 -0
  124. package/music/utils/index.ts +1 -0
  125. package/package.json +1 -1
  126. package/presentation/commands/build-blank-slide.command.ts +15 -0
  127. package/presentation/commands/generate-and-insert-slide.command.ts +22 -0
  128. package/presentation/commands/index.ts +7 -0
  129. package/presentation/commands/presentation-generate-report.command.ts +20 -0
  130. package/presentation/commands/presentation-paraphrase.command.ts +21 -0
  131. package/presentation/commands/update-presentation-slides.command.ts +16 -0
  132. package/presentation/commands/update-slide-image-slot.command.ts +39 -0
  133. package/presentation/commands/update-slide.command.ts +17 -0
  134. package/presentation/enums/index.ts +4 -0
  135. package/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
  136. package/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
  137. package/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
  138. package/presentation/enums/slide-image-slot-action.enum.ts +4 -0
  139. package/presentation/index.ts +1 -0
  140. package/presentation/models/index.ts +1 -0
  141. package/presentation/models/presentation-ai-action.schema.ts +30 -0
  142. package/presentation/models/presentation-config.schema.ts +3 -0
  143. package/presentation/models/presentation.schema.ts +4 -1
  144. package/presentation/models/slide-content-edit.schema.ts +160 -0
  145. package/presentation/models/slide-content.schema.ts +104 -11
  146. package/presentation/models/slide-image-slot.schema.ts +1 -0
  147. package/presentation/models/slide.schema.ts +47 -0
  148. package/presentation/routes/presentation.routes.ts +7 -0
  149. package/presentation/utils/calculate-presentation-ai-action-price.util.ts +20 -0
  150. package/presentation/utils/index.ts +1 -0
  151. package/tools/enums/tool-type.enum.ts +4 -0
  152. package/video/enums/video-strategy.enum.ts +2 -0
  153. package/video/routes/video.http.routes.ts +1 -0
  154. package/video-editor/commands/delete-all-video-editor-jobs.command.ts +13 -0
  155. package/video-editor/commands/delete-video-editor-job-by-uuid.command.ts +14 -0
  156. package/video-editor/commands/edit-video.command.ts +19 -0
  157. package/video-editor/commands/index.ts +6 -0
  158. package/video-editor/commands/retry-video-editor-job.command.ts +16 -0
  159. package/video-editor/commands/set-reaction-to-video-editor-job.command.ts +17 -0
  160. package/video-editor/commands/update-video-editor-job-title.command.ts +16 -0
  161. package/video-editor/enums/index.ts +1 -0
  162. package/video-editor/enums/video-editor-model-strategy.enum.ts +6 -0
  163. package/video-editor/index.ts +6 -0
  164. package/video-editor/models/index.ts +3 -0
  165. package/video-editor/models/video-editor-config.schema.ts +7 -0
  166. package/video-editor/models/video-editor-job.schema.ts +27 -0
  167. package/video-editor/models/video-editor-model.schema.ts +23 -0
  168. package/video-editor/queries/find-video-editor-job-by-id.query.ts +19 -0
  169. package/video-editor/queries/find-video-editor-jobs.query.ts +33 -0
  170. package/video-editor/queries/get-video-editor-config.query.ts +11 -0
  171. package/video-editor/queries/index.ts +3 -0
  172. package/video-editor/routes/index.ts +2 -0
  173. package/video-editor/routes/video-editor.amqp.routes.ts +11 -0
  174. package/video-editor/routes/video-editor.http.routes.ts +6 -0
  175. package/video-editor/utils/calculate-video-editing-price.ts +12 -0
  176. package/video-editor/utils/index.ts +1 -0
  177. package/writer/commands/generate-document-contents.command.ts +1 -0
  178. package/writer/enums/index.ts +1 -0
  179. package/writer/enums/writer-content-generation-strategy.enum.ts +4 -0
  180. package/writer/index.ts +1 -0
  181. package/writer/models/index.ts +1 -0
  182. package/writer/models/writer-config.schema.ts +2 -0
  183. package/writer/models/writer-document-type.schema.ts +1 -0
  184. package/writer/models/writer-document.schema.ts +1 -0
  185. package/writer/models/writer-model.schema.ts +21 -0
  186. package/writer/utils/calculate-writer-content-generation-price.util.ts +4 -2
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { IconVariantsSchema, TOOL_MODEL_STATUS } from '../../common';
3
+ import { VIDEO_EDITOR_MODEL_STRATEGY } from '../enums';
4
+
5
+ export const VideoEditorModelSchema = z.object({
6
+ uuid: z.string(),
7
+ title: z.string(),
8
+ description: z.string(),
9
+ aiModel: z.string(),
10
+ pricePerSecond: z.number(),
11
+ order: z.number(),
12
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
13
+ icons: IconVariantsSchema,
14
+ strategy: z.nativeEnum(VIDEO_EDITOR_MODEL_STRATEGY),
15
+ maxPromptLength: z.number(),
16
+ maxInputVideoSizeBytes: z.number(),
17
+ maxInputVideoDurationInSeconds: z.number(),
18
+ supportedFormats: z.array(z.string()),
19
+ needsTranslation: z.boolean(),
20
+ createdAt: z.date(),
21
+ updatedAt: z.date(),
22
+ });
23
+ export type VideoEditorModel = z.infer<typeof VideoEditorModelSchema>;
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ICommandResponseSchema } from '../../common/models/command-response.schema';
3
+ import { VideoEditorJobSchema } from '../models/video-editor-job.schema';
4
+
5
+ export namespace FindVideoEditorJobByIdQuery {
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(VideoEditorJobSchema);
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 { VideoEditorJobSchema } from '../models/video-editor-job.schema';
4
+
5
+ export namespace FindVideoEditorJobsQuery {
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(VideoEditorJobSchema),
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 { VideoEditorConfigSchema } from '../models';
4
+
5
+ export namespace GetVideoEditorConfigQuery {
6
+ export const RequestSchema = z.object({});
7
+ export type Request = z.infer<typeof RequestSchema>;
8
+
9
+ export const ResponseSchema = ICommandResponseSchema(VideoEditorConfigSchema);
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,3 @@
1
+ export * from './find-video-editor-job-by-id.query';
2
+ export * from './find-video-editor-jobs.query';
3
+ export * from './get-video-editor-config.query';
@@ -0,0 +1,2 @@
1
+ export * from './video-editor.amqp.routes';
2
+ export * from './video-editor.http.routes';
@@ -0,0 +1,11 @@
1
+ export const VIDEO_EDITOR_AMQP_ROUTES = {
2
+ EXECUTE: 'tools.video-editor.execute.rpc',
3
+ CONFIG: 'tools.video-editor.config.rpc',
4
+ GET_JOB: 'tools.video-editor.jobs.get.rpc',
5
+ LIST_JOBS: 'tools.video-editor.jobs.list.rpc',
6
+ SET_REACTION: 'tools.video-editor.jobs.set-reaction.rpc',
7
+ UPDATE_TITLE: 'tools.video-editor.jobs.update-title.rpc',
8
+ SOFT_DELETE: 'tools.video-editor.jobs.soft-delete.rpc',
9
+ SOFT_DELETE_ALL: 'tools.video-editor.jobs.soft-delete-all.rpc',
10
+ RETRY: 'tools.video-editor.jobs.retry.rpc',
11
+ } as const;
@@ -0,0 +1,6 @@
1
+ export const VIDEO_EDITOR_CONTROLLER = 'video-editor';
2
+
3
+ export const VIDEO_EDITOR_ROUTES = {
4
+ KIE_ALEPH_CALLBACK: 'kie/aleph/callback',
5
+ KIE_LUMA_CALLBACK: 'kie/luma/callback',
6
+ };
@@ -0,0 +1,12 @@
1
+ export function calculateVideoEditingPrice({
2
+ duration,
3
+ pricePerSecond,
4
+ }: {
5
+ duration: number;
6
+ pricePerSecond: number;
7
+ }): number {
8
+ if (duration <= 0) throw new Error('Duration must be positive');
9
+ if (pricePerSecond < 0) throw new Error('Price per second cannot be negative');
10
+
11
+ return Math.ceil(duration * pricePerSecond);
12
+ }
@@ -0,0 +1 @@
1
+ export * from './calculate-video-editing-price';
@@ -8,6 +8,7 @@ export namespace GenerateWriterDocumentContentsCommand {
8
8
  userId: z.string().uuid().nullable().optional(),
9
9
  unregisteredUserId: z.string().uuid().nullable().optional(),
10
10
  userBalance: z.number(),
11
+ modelId: z.string(),
11
12
  });
12
13
  export type Request = z.infer<typeof RequestSchema>;
13
14
 
@@ -3,3 +3,4 @@ export * from './writer-ai-action-pricing-type.enum';
3
3
  export * from './writer-ai-action-type.enum';
4
4
  export * from './writer-document-section-type.enum';
5
5
  export * from './writer-document-stage.enum';
6
+ export * from './writer-content-generation-strategy.enum';
@@ -0,0 +1,4 @@
1
+ export enum WRITER_CONTENT_GENERATION_STRATEGY {
2
+ OPENAI = 'openai',
3
+ PERPLEXITY = 'perplexity',
4
+ }
package/writer/index.ts CHANGED
@@ -4,3 +4,4 @@ export * from './queries';
4
4
  export * from './enums';
5
5
  export * from './routes';
6
6
  export * from './utils';
7
+ export * from './models';
@@ -1,3 +1,4 @@
1
+ export * from './writer-model.schema';
1
2
  export * from './writer-config.schema';
2
3
  export * from './writer-ai-action.schema';
3
4
  export * from './writer-document-outline.schema';
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { WriterDocumentTypeSchema } from './writer-document-type.schema';
3
3
  import { WriterAiActionSchema } from './writer-ai-action.schema';
4
+ import { WriterModelSchema } from './writer-model.schema';
4
5
 
5
6
  export const WriterConfigSchema = z.object({
6
7
  maxPromptLength: z.number(),
7
8
  documentTypes: z.array(WriterDocumentTypeSchema),
8
9
  aiActions: z.array(WriterAiActionSchema),
10
+ models: z.array(WriterModelSchema),
9
11
  });
10
12
  export type WriterConfig = z.infer<typeof WriterConfigSchema>;
@@ -10,6 +10,7 @@ export const WriterDocumentTypeSchema = z.object({
10
10
  maxPages: z.number(),
11
11
  pageRange: z.array(z.number()),
12
12
  needsTableOfContents: z.boolean(),
13
+ needsCitations: z.boolean(),
13
14
  createdAt: z.date(),
14
15
  updatedAt: z.date(),
15
16
  });
@@ -14,6 +14,7 @@ export const WriterDocumentSchema = z.object({
14
14
  finalMd: z.string().nullable(),
15
15
  userId: z.string().nullable(),
16
16
  unregisteredUserId: z.string().nullable(),
17
+ modelId: z.string().nullable(),
17
18
  reaction: z.nativeEnum(USER_REACTION).nullable(),
18
19
  pages: z.number(),
19
20
  isDeleted: z.boolean(),
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_MODEL_STATUS } from '../../common';
3
+ import { IconVariantsSchema } from '../../common';
4
+ import { WRITER_CONTENT_GENERATION_STRATEGY } from '../enums/writer-content-generation-strategy.enum';
5
+
6
+ export const WriterModelSchema = z.object({
7
+ uuid: z.string(),
8
+ title: z.string(),
9
+ description: z.string(),
10
+ aiModel: z.string(),
11
+ pricePerPage: z.number(),
12
+ order: z.number(),
13
+ status: z.nativeEnum(TOOL_MODEL_STATUS),
14
+ icons: IconVariantsSchema,
15
+ strategy: z.nativeEnum(WRITER_CONTENT_GENERATION_STRATEGY),
16
+ maxInputLength: z.number(),
17
+ createdAt: z.date(),
18
+ updatedAt: z.date(),
19
+ });
20
+
21
+ export type WriterModel = z.infer<typeof WriterModelSchema>;
@@ -1,3 +1,5 @@
1
- export function calculateWriterContentGenerationPrice(pages: number): number {
2
- return Math.max(1, pages);
1
+ import { WriterModel } from '../models';
2
+
3
+ export function calculateWriterContentGenerationPrice(pages: number, model: WriterModel): number {
4
+ return Math.max(1, pages * model.pricePerPage);
3
5
  }