@purpleschool/gptbot 0.14.24-stage2 → 0.14.25

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 (75) hide show
  1. package/api/controllers/http/avatar-studio.ts +1 -0
  2. package/api/controllers/http/image-recognition.ts +15 -0
  3. package/api/controllers/http/index.ts +1 -0
  4. package/api/routes.ts +36 -0
  5. package/build/api/controllers/http/avatar-studio.js +1 -0
  6. package/build/api/controllers/http/image-recognition.js +17 -0
  7. package/build/api/controllers/http/index.js +1 -0
  8. package/build/api/routes.js +24 -0
  9. package/build/commands/avatar-studio/generation-job/generate-avatar-studio-media-image.command.js +19 -0
  10. package/build/commands/avatar-studio/generation-job/generate-avatar-studio-talking-avatar.command.js +4 -2
  11. package/build/commands/avatar-studio/generation-job/index.js +1 -0
  12. package/build/commands/avatar-studio/media/create-avatar-studio-media-from-file.command.js +1 -0
  13. package/build/commands/avatar-studio/media/update-avatar-studio-media.command.js +1 -0
  14. package/build/commands/avatar-studio/scriptwriter/create-avatar-studio-scriptwriter-message.command.js +4 -0
  15. package/build/commands/avatar-studio/shared/avatar-studio-common.schema.js +13 -4
  16. package/build/commands/avatar-studio/shared/get-avatar-studio-config.query.js +1 -1
  17. package/build/commands/avatar-studio/voice/find-avatar-studio-clip-voices.query.js +4 -1
  18. package/build/commands/avatar-studio/voice/find-avatar-studio-voices.query.js +7 -1
  19. package/build/commands/avatar-studio/voice/update-avatar-studio-clip-voice.command.js +5 -2
  20. package/build/commands/tools/image-recognition/delete-all-image-recognition-jobs.command.js +8 -0
  21. package/build/commands/tools/image-recognition/delete-image-recognition-job-by-uuid.command.js +11 -0
  22. package/build/commands/tools/image-recognition/find-image-recognition-job-by-uuid.command.js +14 -0
  23. package/build/commands/tools/image-recognition/find-image-recognition-jobs.command.js +24 -0
  24. package/build/commands/tools/image-recognition/get-image-recognition-tool-config.command.js +11 -0
  25. package/build/commands/tools/image-recognition/image-recognition.command.js +19 -0
  26. package/build/commands/tools/image-recognition/index.js +26 -0
  27. package/build/commands/tools/image-recognition/retry-image-recognition-job.command.js +24 -0
  28. package/build/commands/tools/image-recognition/set-reaction-to-image-recognition-job.command.js +28 -0
  29. package/build/commands/tools/image-recognition/update-image-recognition-job-favorite.command.js +17 -0
  30. package/build/commands/tools/image-recognition/update-image-recognition-job-title.command.js +17 -0
  31. package/build/commands/tools/index.js +1 -0
  32. package/build/constants/avatar-studio/enums/avatar-studio-voice-source.enum.js +1 -0
  33. package/build/constants/cabinet/enums/statistics-request-type.enum.js +1 -0
  34. package/build/constants/file/file.constants.js +6 -0
  35. package/build/models/avatar-studio/avatar-studio.schema.js +25 -14
  36. package/build/models/tools/image-recognition/image-recognition-category.schema.js +14 -0
  37. package/build/models/tools/image-recognition/image-recognition-config.schema.js +10 -0
  38. package/build/models/tools/image-recognition/image-recognition-job.schema.js +22 -0
  39. package/build/models/tools/image-recognition/image-recognition-model.schema.js +25 -0
  40. package/build/models/tools/image-recognition/index.js +20 -0
  41. package/build/models/tools/index.js +1 -0
  42. package/commands/avatar-studio/generation-job/generate-avatar-studio-media-image.command.ts +19 -0
  43. package/commands/avatar-studio/generation-job/generate-avatar-studio-talking-avatar.command.ts +6 -4
  44. package/commands/avatar-studio/generation-job/index.ts +1 -0
  45. package/commands/avatar-studio/media/create-avatar-studio-media-from-file.command.ts +1 -0
  46. package/commands/avatar-studio/media/update-avatar-studio-media.command.ts +1 -0
  47. package/commands/avatar-studio/scriptwriter/create-avatar-studio-scriptwriter-message.command.ts +4 -0
  48. package/commands/avatar-studio/shared/avatar-studio-common.schema.ts +17 -5
  49. package/commands/avatar-studio/shared/get-avatar-studio-config.query.ts +2 -2
  50. package/commands/avatar-studio/voice/find-avatar-studio-clip-voices.query.ts +4 -1
  51. package/commands/avatar-studio/voice/find-avatar-studio-voices.query.ts +8 -0
  52. package/commands/avatar-studio/voice/update-avatar-studio-clip-voice.command.ts +6 -3
  53. package/commands/tools/image-recognition/delete-all-image-recognition-jobs.command.ts +6 -0
  54. package/commands/tools/image-recognition/delete-image-recognition-job-by-uuid.command.ts +11 -0
  55. package/commands/tools/image-recognition/find-image-recognition-job-by-uuid.command.ts +16 -0
  56. package/commands/tools/image-recognition/find-image-recognition-jobs.command.ts +24 -0
  57. package/commands/tools/image-recognition/get-image-recognition-tool-config.command.ts +10 -0
  58. package/commands/tools/image-recognition/image-recognition.command.ts +20 -0
  59. package/commands/tools/image-recognition/index.ts +10 -0
  60. package/commands/tools/image-recognition/retry-image-recognition-job.command.ts +26 -0
  61. package/commands/tools/image-recognition/set-reaction-to-image-recognition-job.command.ts +33 -0
  62. package/commands/tools/image-recognition/update-image-recognition-job-favorite.command.ts +19 -0
  63. package/commands/tools/image-recognition/update-image-recognition-job-title.command.ts +19 -0
  64. package/commands/tools/index.ts +1 -0
  65. package/constants/avatar-studio/enums/avatar-studio-voice-source.enum.ts +1 -0
  66. package/constants/cabinet/enums/statistics-request-type.enum.ts +1 -0
  67. package/constants/file/file.constants.ts +6 -0
  68. package/models/avatar-studio/avatar-studio.schema.ts +34 -4
  69. package/models/tools/image-recognition/image-recognition-category.schema.ts +14 -0
  70. package/models/tools/image-recognition/image-recognition-config.schema.ts +10 -0
  71. package/models/tools/image-recognition/image-recognition-job.schema.ts +25 -0
  72. package/models/tools/image-recognition/image-recognition-model.schema.ts +28 -0
  73. package/models/tools/image-recognition/index.ts +4 -0
  74. package/models/tools/index.ts +1 -0
  75. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AvatarStudioClipSchema = exports.AvatarStudioScriptwriterMessageSchema = exports.AvatarStudioExportJobSchema = exports.AvatarStudioGenerationJobSchema = exports.AvatarStudioGenerationJobBaseSchema = exports.AvatarStudioVoiceSchema = exports.AvatarStudioSceneSchema = exports.AvatarStudioSceneGenerationJobSchema = exports.AvatarStudioSceneVideoConfigSchema = exports.AvatarStudioSceneImageConfigSchema = exports.AvatarStudioSceneVoiceConfigSchema = exports.AvatarStudioSceneReferenceMediaSchema = exports.AvatarStudioMediaSchema = exports.AvatarStudioWordTimingSchema = exports.AvatarStudioSubtitleSettingsSchema = exports.AvatarStudioAspectRatioSchema = void 0;
3
+ exports.AvatarStudioClipSchema = exports.AvatarStudioScriptwriterMessageSchema = exports.AvatarStudioExportJobSchema = exports.AvatarStudioGenerationJobSchema = exports.AvatarStudioGenerationJobBaseSchema = exports.AvatarStudioVoiceSchema = exports.AvatarStudioSceneSchema = exports.AvatarStudioSceneGenerationJobSchema = exports.AvatarStudioSceneVideoConfigSchema = exports.AvatarStudioSceneVideoConfigBaseSchema = exports.AvatarStudioSceneImageConfigSchema = exports.AvatarStudioSceneVoiceConfigSchema = exports.AvatarStudioSceneVoiceConfigBaseSchema = exports.validateAvatarStudioTrim = exports.AvatarStudioTrimConfigFields = exports.AvatarStudioSceneReferenceMediaSchema = exports.AvatarStudioMediaSchema = exports.AvatarStudioWordTimingSchema = exports.AvatarStudioSubtitleSettingsSchema = exports.AvatarStudioAspectRatioSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
6
  const file_schema_1 = require("../file.schema");
@@ -24,13 +24,14 @@ exports.AvatarStudioWordTimingSchema = zod_1.z.object({
24
24
  });
25
25
  exports.AvatarStudioMediaSchema = zod_1.z.object({
26
26
  uuid: zod_1.z.string().uuid(),
27
- userId: zod_1.z.string().uuid(),
27
+ userId: zod_1.z.string().uuid().nullable(),
28
28
  clipId: zod_1.z.string().uuid().nullable(),
29
29
  sceneId: zod_1.z.string().uuid().nullable(),
30
30
  fileId: zod_1.z.string().uuid(),
31
31
  kind: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_MEDIA_KIND),
32
32
  source: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_MEDIA_SOURCE),
33
33
  role: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_MEDIA_ROLE),
34
+ title: zod_1.z.string().nullable(),
34
35
  prompt: zod_1.z.string().nullable(),
35
36
  toolJobId: zod_1.z.string().uuid().nullable(),
36
37
  durationSeconds: zod_1.z.number().nullable(),
@@ -47,21 +48,28 @@ exports.AvatarStudioSceneReferenceMediaSchema = zod_1.z.object({
47
48
  media: exports.AvatarStudioMediaSchema.optional(),
48
49
  createdAt: zod_1.z.date(),
49
50
  });
50
- exports.AvatarStudioSceneVoiceConfigSchema = zod_1.z.object({
51
- text: zod_1.z.string().default(''),
52
- mediaId: zod_1.z.string().uuid().nullable().default(null),
53
- });
51
+ exports.AvatarStudioTrimConfigFields = {
52
+ trimStart: zod_1.z.number().nonnegative().nullable().default(null),
53
+ trimEnd: zod_1.z.number().nonnegative().nullable().default(null),
54
+ };
55
+ const validateAvatarStudioTrim = ({ trimStart, trimEnd }, ctx) => {
56
+ if (trimStart != null && trimEnd != null && trimEnd <= trimStart) {
57
+ ctx.addIssue({
58
+ code: zod_1.z.ZodIssueCode.custom,
59
+ message: 'trimEnd must be greater than trimStart',
60
+ path: ['trimEnd'],
61
+ });
62
+ }
63
+ };
64
+ exports.validateAvatarStudioTrim = validateAvatarStudioTrim;
65
+ exports.AvatarStudioSceneVoiceConfigBaseSchema = zod_1.z.object(Object.assign({ text: zod_1.z.string().default(''), mediaId: zod_1.z.string().uuid().nullable().default(null) }, exports.AvatarStudioTrimConfigFields));
66
+ exports.AvatarStudioSceneVoiceConfigSchema = exports.AvatarStudioSceneVoiceConfigBaseSchema.superRefine(exports.validateAvatarStudioTrim);
54
67
  exports.AvatarStudioSceneImageConfigSchema = zod_1.z.object({
55
68
  prompt: zod_1.z.string().nullable().default(null),
56
69
  style: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_IMAGE_STYLE).default(constants_1.AVATAR_STUDIO_IMAGE_STYLE.UGC),
57
70
  });
58
- exports.AvatarStudioSceneVideoConfigSchema = zod_1.z.object({
59
- prompt: zod_1.z.string().nullable().default(null),
60
- durationSeconds: zod_1.z.number().positive().default(5),
61
- videoMode: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_MODE).default(constants_1.AVATAR_STUDIO_VIDEO_MODE.B_ROLL),
62
- quality: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_QUALITY).default(constants_1.AVATAR_STUDIO_VIDEO_QUALITY.P720),
63
- sound: zod_1.z.boolean().default(false),
64
- });
71
+ exports.AvatarStudioSceneVideoConfigBaseSchema = zod_1.z.object(Object.assign({ prompt: zod_1.z.string().nullable().default(null), durationSeconds: zod_1.z.number().positive().default(5), videoMode: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_MODE).default(constants_1.AVATAR_STUDIO_VIDEO_MODE.B_ROLL), quality: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_QUALITY).default(constants_1.AVATAR_STUDIO_VIDEO_QUALITY.P720), sound: zod_1.z.boolean().default(false) }, exports.AvatarStudioTrimConfigFields));
72
+ exports.AvatarStudioSceneVideoConfigSchema = exports.AvatarStudioSceneVideoConfigBaseSchema.superRefine(exports.validateAvatarStudioTrim);
65
73
  exports.AvatarStudioSceneGenerationJobSchema = zod_1.z.object({
66
74
  jobId: zod_1.z.string().uuid(),
67
75
  type: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_JOB_TYPE),
@@ -106,10 +114,13 @@ exports.AvatarStudioSceneSchema = zod_1.z.object({
106
114
  });
107
115
  exports.AvatarStudioVoiceSchema = zod_1.z.object({
108
116
  uuid: zod_1.z.string().uuid(),
109
- userId: zod_1.z.string().uuid(),
117
+ userId: zod_1.z.string().uuid().nullable(),
110
118
  clipId: zod_1.z.string().uuid().nullable(),
111
119
  title: zod_1.z.string(),
112
120
  source: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VOICE_SOURCE),
121
+ presetKey: zod_1.z.string().nullable(),
122
+ gender: zod_1.z.enum(['male', 'female']).nullable(),
123
+ sortOrder: zod_1.z.number().int().nullable(),
113
124
  sampleMediaId: zod_1.z.string().uuid().nullable(),
114
125
  sampleText: zod_1.z.string().nullable(),
115
126
  metadata: json_value_schema_1.JsonObjectSchema.nullable(),
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageRecognitionCategorySchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ImageRecognitionCategorySchema = zod_1.z.object({
6
+ uuid: zod_1.z.string(),
7
+ parentId: zod_1.z.string().nullable(),
8
+ title: zod_1.z.string(),
9
+ systemPrompt: zod_1.z.string(),
10
+ order: zod_1.z.number(),
11
+ status: zod_1.z.string(),
12
+ createdAt: zod_1.z.date(),
13
+ updatedAt: zod_1.z.date(),
14
+ });
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageRecognitionConfigSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const image_recognition_model_schema_1 = require("./image-recognition-model.schema");
6
+ const image_recognition_category_schema_1 = require("./image-recognition-category.schema");
7
+ exports.ImageRecognitionConfigSchema = zod_1.z.object({
8
+ models: zod_1.z.array(image_recognition_model_schema_1.ImageRecognitionModelSchema),
9
+ categories: zod_1.z.array(image_recognition_category_schema_1.ImageRecognitionCategorySchema),
10
+ });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageRecognitionJobSchema = exports.ImageRecognitionJobParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const tool_job_schema_1 = require("../../tool-job.schema");
7
+ const common_1 = require("../common");
8
+ exports.ImageRecognitionJobParamsSchema = zod_1.z.object({
9
+ attachedFiles: zod_1.z.array(common_1.AttachedToolFileSchema),
10
+ });
11
+ exports.ImageRecognitionJobSchema = tool_job_schema_1.ToolJobSchema.extend({
12
+ title: zod_1.z.string(),
13
+ prompt: zod_1.z.string().nullable(),
14
+ categoryId: zod_1.z.string(),
15
+ aiOutput: zod_1.z.string().nullable(),
16
+ reaction: zod_1.z.nativeEnum(constants_1.USER_REACTION).nullable(),
17
+ dislikeReason: zod_1.z.string().nullable(),
18
+ modelId: zod_1.z.string(),
19
+ price: zod_1.z.number(),
20
+ params: exports.ImageRecognitionJobParamsSchema,
21
+ completedAt: zod_1.z.date().nullable().optional(),
22
+ });
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageRecognitionModelSchema = exports.ImageRecognitionModelParamsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const icon_variants_schema_1 = require("../../icon-variants.schema");
6
+ exports.ImageRecognitionModelParamsSchema = zod_1.z.object({
7
+ imageAttachment: zod_1.z.object({
8
+ supported: zod_1.z.boolean(),
9
+ maxImages: zod_1.z.number(),
10
+ acceptedTypes: zod_1.z.array(zod_1.z.string()),
11
+ }),
12
+ });
13
+ exports.ImageRecognitionModelSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string(),
15
+ title: zod_1.z.string(),
16
+ description: zod_1.z.string(),
17
+ aiModel: zod_1.z.string(),
18
+ price: zod_1.z.number(),
19
+ order: zod_1.z.number(),
20
+ status: zod_1.z.string(),
21
+ icons: icon_variants_schema_1.IconVariantsSchema,
22
+ params: exports.ImageRecognitionModelParamsSchema,
23
+ createdAt: zod_1.z.date(),
24
+ updatedAt: zod_1.z.date(),
25
+ });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./image-recognition-category.schema"), exports);
18
+ __exportStar(require("./image-recognition-config.schema"), exports);
19
+ __exportStar(require("./image-recognition-job.schema"), exports);
20
+ __exportStar(require("./image-recognition-model.schema"), exports);
@@ -23,6 +23,7 @@ __exportStar(require("./tts"), exports);
23
23
  __exportStar(require("./video"), exports);
24
24
  __exportStar(require("./writer"), exports);
25
25
  __exportStar(require("./image-editor"), exports);
26
+ __exportStar(require("./image-recognition"), exports);
26
27
  __exportStar(require("./video-editor"), exports);
27
28
  __exportStar(require("./music"), exports);
28
29
  __exportStar(require("./image-generation"), exports);
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { AvatarStudioAspectRatioSchema, AvatarStudioGenerationJobSchema } from '../../../models';
3
+ import { AvatarStudioUuidListSchema } from '../shared/avatar-studio-common.schema';
4
+
5
+ export namespace GenerateAvatarStudioMediaImageCommand {
6
+ export const RequestSchema = z
7
+ .object({
8
+ prompt: z.string().trim().min(1),
9
+ referenceMediaIds: AvatarStudioUuidListSchema.optional(),
10
+ aspectRatio: AvatarStudioAspectRatioSchema.default('9:16'),
11
+ })
12
+ .strict();
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: AvatarStudioGenerationJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -1,18 +1,20 @@
1
1
  import { z } from 'zod';
2
- import { AvatarStudioGenerationJobSchema } from '../../../models';
2
+ import { AvatarStudioGenerationJobSchema, validateAvatarStudioTrim } from '../../../models';
3
3
  import {
4
4
  AvatarStudioSceneIdParamsSchema,
5
- AvatarStudioVideoGenerationRequestSchema,
5
+ AvatarStudioVideoGenerationRequestBaseSchema,
6
6
  } from '../shared/avatar-studio-common.schema';
7
7
 
8
8
  export namespace GenerateAvatarStudioTalkingAvatarCommand {
9
9
  export const ParamsSchema = AvatarStudioSceneIdParamsSchema;
10
10
  export type Params = z.infer<typeof ParamsSchema>;
11
11
 
12
- export const RequestSchema = AvatarStudioVideoGenerationRequestSchema.extend({
12
+ export const RequestSchema = AvatarStudioVideoGenerationRequestBaseSchema.extend({
13
13
  imageMediaId: z.string().uuid().optional(),
14
14
  audioMediaId: z.string().uuid().optional(),
15
- }).strict();
15
+ })
16
+ .strict()
17
+ .superRefine(validateAvatarStudioTrim);
16
18
  export type Request = z.infer<typeof RequestSchema>;
17
19
 
18
20
  export const ResponseSchema = z.object({
@@ -1,6 +1,7 @@
1
1
  export * from './find-avatar-studio-generation-jobs.query';
2
2
  export * from './generate-avatar-studio-frame.command';
3
3
  export * from './generate-avatar-studio-library-image.command';
4
+ export * from './generate-avatar-studio-media-image.command';
4
5
  export * from './generate-avatar-studio-scene-video.command';
5
6
  export * from './generate-avatar-studio-scene-voice.command';
6
7
  export * from './generate-avatar-studio-talking-avatar.command';
@@ -21,6 +21,7 @@ export namespace CreateAvatarStudioMediaFromFileCommand {
21
21
  .default(AVATAR_STUDIO_MEDIA_SOURCE.UPLOAD)
22
22
  .optional(),
23
23
  role: z.nativeEnum(AVATAR_STUDIO_MEDIA_ROLE),
24
+ title: z.string().trim().min(1).max(255).optional(),
24
25
  prompt: z.string().optional(),
25
26
  })
26
27
  .strict();
@@ -11,6 +11,7 @@ export namespace UpdateAvatarStudioMediaCommand {
11
11
  .object({
12
12
  sceneId: z.string().uuid().nullable().optional(),
13
13
  role: z.nativeEnum(AVATAR_STUDIO_MEDIA_ROLE).optional(),
14
+ title: z.string().trim().min(1).max(255).nullable().optional(),
14
15
  prompt: z.string().nullable().optional(),
15
16
  })
16
17
  .strict();
@@ -29,6 +29,8 @@ export namespace CreateAvatarStudioScriptwriterMessageCommand {
29
29
  .object({
30
30
  voiceConfig: z.object({
31
31
  text: z.string().trim().min(1),
32
+ trimStart: z.number().nonnegative().nullable().optional(),
33
+ trimEnd: z.number().nonnegative().nullable().optional(),
32
34
  }),
33
35
  imageConfig: z.object({
34
36
  prompt: z.string().trim().min(1),
@@ -40,6 +42,8 @@ export namespace CreateAvatarStudioScriptwriterMessageCommand {
40
42
  videoMode: z.nativeEnum(AVATAR_STUDIO_VIDEO_MODE),
41
43
  quality: z.nativeEnum(AVATAR_STUDIO_VIDEO_QUALITY),
42
44
  sound: z.boolean(),
45
+ trimStart: z.number().nonnegative().nullable().optional(),
46
+ trimEnd: z.number().nonnegative().nullable().optional(),
43
47
  }),
44
48
  })
45
49
  .strict();
@@ -2,8 +2,9 @@ import { z } from 'zod';
2
2
  import { AVATAR_STUDIO_VIDEO_MODE, AVATAR_STUDIO_VIDEO_QUALITY } from '../../../constants';
3
3
  import {
4
4
  AvatarStudioSceneImageConfigSchema,
5
- AvatarStudioSceneVideoConfigSchema,
6
- AvatarStudioSceneVoiceConfigSchema,
5
+ AvatarStudioSceneVideoConfigBaseSchema,
6
+ AvatarStudioSceneVoiceConfigBaseSchema,
7
+ validateAvatarStudioTrim,
7
8
  } from '../../../models';
8
9
 
9
10
  export const AvatarStudioClipIdParamsSchema = z.object({
@@ -42,18 +43,29 @@ export const AvatarStudioUuidListSchema = z.array(z.string().uuid()).default([])
42
43
 
43
44
  export const AvatarStudioSceneConfigPatchSchema = z
44
45
  .object({
45
- voiceConfig: AvatarStudioSceneVoiceConfigSchema.strict().partial().optional(),
46
+ voiceConfig: AvatarStudioSceneVoiceConfigBaseSchema.strict()
47
+ .partial()
48
+ .superRefine(validateAvatarStudioTrim)
49
+ .optional(),
46
50
  imageConfig: AvatarStudioSceneImageConfigSchema.strict().partial().optional(),
47
- videoConfig: AvatarStudioSceneVideoConfigSchema.strict().partial().optional(),
51
+ videoConfig: AvatarStudioSceneVideoConfigBaseSchema.strict()
52
+ .partial()
53
+ .superRefine(validateAvatarStudioTrim)
54
+ .optional(),
48
55
  })
49
56
  .strict();
50
57
 
51
- export const AvatarStudioVideoGenerationRequestSchema = z
58
+ export const AvatarStudioVideoGenerationRequestBaseSchema = z
52
59
  .object({
53
60
  prompt: z.string().trim().min(1).optional(),
54
61
  durationSeconds: z.number().positive().optional(),
55
62
  videoMode: z.nativeEnum(AVATAR_STUDIO_VIDEO_MODE).optional(),
56
63
  quality: z.nativeEnum(AVATAR_STUDIO_VIDEO_QUALITY).optional(),
57
64
  sound: z.boolean().optional(),
65
+ trimStart: z.number().nonnegative().nullable().optional(),
66
+ trimEnd: z.number().nonnegative().nullable().optional(),
58
67
  })
59
68
  .strict();
69
+
70
+ export const AvatarStudioVideoGenerationRequestSchema =
71
+ AvatarStudioVideoGenerationRequestBaseSchema.superRefine(validateAvatarStudioTrim);
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  AvatarStudioAspectRatioSchema,
11
11
  AvatarStudioSceneImageConfigSchema,
12
- AvatarStudioSceneVideoConfigSchema,
12
+ AvatarStudioSceneVideoConfigBaseSchema,
13
13
  AvatarStudioSceneVoiceConfigSchema,
14
14
  } from '../../../models';
15
15
 
@@ -154,7 +154,7 @@ const AvatarStudioVideoConfigSectionSchema = AvatarStudioConfigSectionBaseSchema
154
154
  aspectRatio: AvatarStudioFixedFieldSchema(z.literal('9:16')),
155
155
  })
156
156
  .strict(),
157
- defaults: AvatarStudioSceneVideoConfigSchema.extend({
157
+ defaults: AvatarStudioSceneVideoConfigBaseSchema.extend({
158
158
  aspectRatio: z.literal('9:16'),
159
159
  }),
160
160
  pricing: z
@@ -5,12 +5,15 @@ import {
5
5
  AvatarStudioPagedResponseSchema,
6
6
  AvatarStudioPaginationQuerySchema,
7
7
  } from '../shared/avatar-studio-common.schema';
8
+ import { AvatarStudioVoiceSourceFilterSchema } from './find-avatar-studio-voices.query';
8
9
 
9
10
  export namespace FindAvatarStudioClipVoicesQuery {
10
11
  export const ParamsSchema = AvatarStudioClipIdParamsSchema;
11
12
  export type Params = z.infer<typeof ParamsSchema>;
12
13
 
13
- export const QuerySchema = AvatarStudioPaginationQuerySchema;
14
+ export const QuerySchema = AvatarStudioPaginationQuerySchema.extend({
15
+ source: AvatarStudioVoiceSourceFilterSchema.optional(),
16
+ });
14
17
  export type Query = z.infer<typeof QuerySchema>;
15
18
 
16
19
  export const ResponseSchema = AvatarStudioPagedResponseSchema(AvatarStudioVoiceSchema);
@@ -1,13 +1,21 @@
1
1
  import { z } from 'zod';
2
+ import { AVATAR_STUDIO_VOICE_SOURCE } from '../../../constants';
2
3
  import { AvatarStudioVoiceSchema } from '../../../models';
3
4
  import {
4
5
  AvatarStudioPagedResponseSchema,
5
6
  AvatarStudioPaginationQuerySchema,
6
7
  } from '../shared/avatar-studio-common.schema';
7
8
 
9
+ export const AvatarStudioVoiceSourceFilterSchema = z.union([
10
+ z.nativeEnum(AVATAR_STUDIO_VOICE_SOURCE),
11
+ z.literal('user'),
12
+ ]);
13
+ export type AvatarStudioVoiceSourceFilter = z.infer<typeof AvatarStudioVoiceSourceFilterSchema>;
14
+
8
15
  export namespace FindAvatarStudioVoicesQuery {
9
16
  export const QuerySchema = AvatarStudioPaginationQuerySchema.extend({
10
17
  clipId: z.string().uuid().optional(),
18
+ source: AvatarStudioVoiceSourceFilterSchema.optional(),
11
19
  });
12
20
  export type Query = z.infer<typeof QuerySchema>;
13
21
 
@@ -6,9 +6,12 @@ export namespace UpdateAvatarStudioClipVoiceCommand {
6
6
  export const ParamsSchema = AvatarStudioClipIdParamsSchema;
7
7
  export type Params = z.infer<typeof ParamsSchema>;
8
8
 
9
- export const RequestSchema = z.object({
10
- voiceId: z.string().uuid().nullable(),
11
- });
9
+ export const RequestSchema = z
10
+ .object({
11
+ voiceId: z.string().uuid().nullable(),
12
+ applyToScenes: z.boolean().default(false).optional(),
13
+ })
14
+ .strict();
12
15
  export type Request = z.infer<typeof RequestSchema>;
13
16
 
14
17
  export const ResponseSchema = z.object({
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteAllImageRecognitionJobsCommand {
4
+ export const ResponseSchema = z.void();
5
+ export type Response = z.infer<typeof ResponseSchema>;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace DeleteImageRecognitionJobByUuidCommand {
4
+ export const RequestParamsSchema = z.object({
5
+ uuid: z.string().uuid(),
6
+ });
7
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
8
+
9
+ export const ResponseSchema = z.void();
10
+ export type Response = z.infer<typeof ResponseSchema>;
11
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionJobSchema, ToolJobSchema } from '../../../models';
3
+
4
+ export namespace FindImageRecognitionJobByUUIDCommand {
5
+ export const RequestParamsSchema = ToolJobSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestParamsSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ data: ImageRecognitionJobSchema,
13
+ });
14
+
15
+ export type Response = z.infer<typeof ResponseSchema>;
16
+ }
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { QueryBooleanSchema } from '../../../helpers';
3
+ import { JOB_SORT, TOOL_JOB_STATUS } from '../../../constants';
4
+ import { ImageRecognitionJobSchema } from '../../../models';
5
+
6
+ export namespace FindImageRecognitionJobsCommand {
7
+ export const RequestQuerySchema = z.object({
8
+ limit: z.coerce.number().min(1).optional(),
9
+ offset: z.coerce.number().min(0).default(0).optional(),
10
+ title: z.string().optional(),
11
+ isFavorite: QueryBooleanSchema.optional(),
12
+ createdAtSortOrder: z.nativeEnum(JOB_SORT).optional().default(JOB_SORT.DESC),
13
+ status: z.nativeEnum(TOOL_JOB_STATUS).optional(),
14
+ });
15
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
16
+
17
+ export const ResponseSchema = z.object({
18
+ data: z.array(ImageRecognitionJobSchema),
19
+ totalPages: z.number(),
20
+ total: z.number(),
21
+ page: z.number(),
22
+ });
23
+ export type Response = z.infer<typeof ResponseSchema>;
24
+ }
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionConfigSchema } from '../../../models';
3
+
4
+ export namespace GetImageRecognitionToolConfigCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: ImageRecognitionConfigSchema,
7
+ });
8
+
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionJobSchema } from '../../../models';
3
+
4
+ export namespace ImageRecognitionCommand {
5
+ export const RequestSchema = z.object({
6
+ modelId: z.string().uuid(),
7
+ categoryId: z.string().uuid(),
8
+ prompt: z.string().optional(),
9
+ params: z.object({
10
+ attachedFiles: z.array(z.string()).min(1),
11
+ }),
12
+ });
13
+ export type Request = z.infer<typeof RequestSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: ImageRecognitionJobSchema,
17
+ });
18
+
19
+ export type Response = z.infer<typeof ResponseSchema>;
20
+ }
@@ -0,0 +1,10 @@
1
+ export * from './delete-all-image-recognition-jobs.command';
2
+ export * from './delete-image-recognition-job-by-uuid.command';
3
+ export * from './find-image-recognition-job-by-uuid.command';
4
+ export * from './find-image-recognition-jobs.command';
5
+ export * from './get-image-recognition-tool-config.command';
6
+ export * from './image-recognition.command';
7
+ export * from './retry-image-recognition-job.command';
8
+ export * from './set-reaction-to-image-recognition-job.command';
9
+ export * from './update-image-recognition-job-favorite.command';
10
+ export * from './update-image-recognition-job-title.command';
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionJobSchema } from '../../../models';
3
+
4
+ export namespace RetryImageRecognitionJobCommand {
5
+ export const RequestParamsSchema = z.object({
6
+ uuid: z.string().uuid(),
7
+ });
8
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
9
+
10
+ export const RequestBodySchema = z.object({
11
+ modelId: z.string().uuid().optional(),
12
+ categoryId: z.string().uuid().optional(),
13
+ prompt: z.string().optional(),
14
+ params: z
15
+ .object({
16
+ attachedFiles: z.array(z.string()).min(1),
17
+ })
18
+ .optional(),
19
+ });
20
+ export type RequestBody = z.infer<typeof RequestBodySchema>;
21
+
22
+ export const ResponseSchema = z.object({
23
+ data: ImageRecognitionJobSchema,
24
+ });
25
+ export type Response = z.infer<typeof ResponseSchema>;
26
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionJobSchema } from '../../../models';
3
+ import { USER_REACTION } from '../../../constants';
4
+
5
+ export namespace SetReactionToImageRecognitionJobCommand {
6
+ export const RequestSchema = z
7
+ .object({
8
+ reaction: z.nativeEnum(USER_REACTION).nullable(),
9
+ dislikeReason: z.string().nullable().default(null),
10
+ })
11
+ .refine(
12
+ (data) => {
13
+ if (data.reaction !== USER_REACTION.DISLIKED && data.dislikeReason) {
14
+ return false;
15
+ }
16
+ return true;
17
+ },
18
+ {
19
+ message: 'Dislike reason is not allowed when reaction is not DISLIKED',
20
+ },
21
+ );
22
+ export type Request = z.infer<typeof RequestSchema>;
23
+
24
+ export const RequestParamsSchema = z.object({
25
+ uuid: z.string().uuid(),
26
+ });
27
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
28
+
29
+ export const ResponseSchema = z.object({
30
+ data: ImageRecognitionJobSchema,
31
+ });
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateImageRecognitionJobFavoriteCommand {
5
+ export const RequestSchema = z.object({
6
+ isFavorite: z.boolean(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: ImageRecognitionJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { ImageRecognitionJobSchema } from '../../../models';
3
+
4
+ export namespace UpdateImageRecognitionJobTitleCommand {
5
+ export const RequestSchema = z.object({
6
+ title: z.string().min(1).max(40).trim(),
7
+ });
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const RequestParamsSchema = z.object({
11
+ uuid: z.string().uuid(),
12
+ });
13
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
14
+
15
+ export const ResponseSchema = z.object({
16
+ data: ImageRecognitionJobSchema,
17
+ });
18
+ export type Response = z.infer<typeof ResponseSchema>;
19
+ }
@@ -6,6 +6,7 @@ export * from './tts';
6
6
  export * from './video';
7
7
  export * from './writer';
8
8
  export * from './image-editor';
9
+ export * from './image-recognition';
9
10
  export * from './video-editor';
10
11
  export * from './music';
11
12
  export * from './image-generation';
@@ -2,4 +2,5 @@ export enum AVATAR_STUDIO_VOICE_SOURCE {
2
2
  UPLOAD = 'upload',
3
3
  TTS = 'tts',
4
4
  VOICE_DESIGN = 'voice_design',
5
+ PRESET = 'preset',
5
6
  }
@@ -1,5 +1,6 @@
1
1
  export enum STATISTICS_REQUEST_TYPE {
2
2
  IMAGE = 'IMAGE',
3
+ IMAGE_RECOGNITION = 'IMAGE_RECOGNITION',
3
4
  VIDEO = 'VIDEO',
4
5
  PRESENTATION = 'PRESENTATION',
5
6
  TEXT = 'TEXT',