@purpleschool/gptbot 0.14.23 → 0.14.24
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.
- package/api/controllers/http/avatar-studio.ts +1 -0
- package/build/api/controllers/http/avatar-studio.js +1 -0
- package/build/commands/avatar-studio/generation-job/generate-avatar-studio-media-image.command.js +19 -0
- package/build/commands/avatar-studio/generation-job/generate-avatar-studio-talking-avatar.command.js +4 -2
- package/build/commands/avatar-studio/generation-job/index.js +1 -0
- package/build/commands/avatar-studio/media/create-avatar-studio-media-from-file.command.js +1 -0
- package/build/commands/avatar-studio/media/update-avatar-studio-media.command.js +1 -0
- package/build/commands/avatar-studio/scriptwriter/create-avatar-studio-scriptwriter-message.command.js +4 -0
- package/build/commands/avatar-studio/shared/avatar-studio-common.schema.js +13 -4
- package/build/commands/avatar-studio/shared/get-avatar-studio-config.query.js +1 -1
- package/build/commands/avatar-studio/voice/find-avatar-studio-clip-voices.query.js +4 -1
- package/build/commands/avatar-studio/voice/find-avatar-studio-voices.query.js +7 -1
- package/build/commands/avatar-studio/voice/update-avatar-studio-clip-voice.command.js +5 -2
- package/build/constants/avatar-studio/enums/avatar-studio-voice-source.enum.js +1 -0
- package/build/constants/file/file.constants.js +6 -0
- package/build/models/avatar-studio/avatar-studio.schema.js +25 -14
- package/commands/avatar-studio/generation-job/generate-avatar-studio-media-image.command.ts +19 -0
- package/commands/avatar-studio/generation-job/generate-avatar-studio-talking-avatar.command.ts +6 -4
- package/commands/avatar-studio/generation-job/index.ts +1 -0
- package/commands/avatar-studio/media/create-avatar-studio-media-from-file.command.ts +1 -0
- package/commands/avatar-studio/media/update-avatar-studio-media.command.ts +1 -0
- package/commands/avatar-studio/scriptwriter/create-avatar-studio-scriptwriter-message.command.ts +4 -0
- package/commands/avatar-studio/shared/avatar-studio-common.schema.ts +17 -5
- package/commands/avatar-studio/shared/get-avatar-studio-config.query.ts +2 -2
- package/commands/avatar-studio/voice/find-avatar-studio-clip-voices.query.ts +4 -1
- package/commands/avatar-studio/voice/find-avatar-studio-voices.query.ts +8 -0
- package/commands/avatar-studio/voice/update-avatar-studio-clip-voice.command.ts +6 -3
- package/constants/avatar-studio/enums/avatar-studio-voice-source.enum.ts +1 -0
- package/constants/file/file.constants.ts +6 -0
- package/models/avatar-studio/avatar-studio.schema.ts +34 -4
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export const AVATAR_STUDIO_ROUTES = {
|
|
|
18
18
|
GENERATE_FRAME: (clipId: string, sceneId: string) =>
|
|
19
19
|
`clips/${clipId}/scenes/${sceneId}/frame/generate`,
|
|
20
20
|
GENERATE_LIBRARY_IMAGE: (clipId: string) => `clips/${clipId}/library/images/generate`,
|
|
21
|
+
GENERATE_MEDIA_IMAGE: 'media/images/generate',
|
|
21
22
|
GENERATE_SCENE_VIDEO: (clipId: string, sceneId: string) =>
|
|
22
23
|
`clips/${clipId}/scenes/${sceneId}/video/generate`,
|
|
23
24
|
GENERATE_SCENE_VOICE: (clipId: string, sceneId: string) =>
|
|
@@ -19,6 +19,7 @@ exports.AVATAR_STUDIO_ROUTES = {
|
|
|
19
19
|
DELETE_MEDIA: (clipId, mediaId) => `clips/${clipId}/media/${mediaId}`,
|
|
20
20
|
GENERATE_FRAME: (clipId, sceneId) => `clips/${clipId}/scenes/${sceneId}/frame/generate`,
|
|
21
21
|
GENERATE_LIBRARY_IMAGE: (clipId) => `clips/${clipId}/library/images/generate`,
|
|
22
|
+
GENERATE_MEDIA_IMAGE: 'media/images/generate',
|
|
22
23
|
GENERATE_SCENE_VIDEO: (clipId, sceneId) => `clips/${clipId}/scenes/${sceneId}/video/generate`,
|
|
23
24
|
GENERATE_SCENE_VOICE: (clipId, sceneId) => `clips/${clipId}/scenes/${sceneId}/voice/generate`,
|
|
24
25
|
GENERATE_VOICE_TIMINGS: (clipId, sceneId) => `clips/${clipId}/scenes/${sceneId}/voice/timings`,
|
package/build/commands/avatar-studio/generation-job/generate-avatar-studio-media-image.command.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateAvatarStudioMediaImageCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../../models");
|
|
6
|
+
const avatar_studio_common_schema_1 = require("../shared/avatar-studio-common.schema");
|
|
7
|
+
var GenerateAvatarStudioMediaImageCommand;
|
|
8
|
+
(function (GenerateAvatarStudioMediaImageCommand) {
|
|
9
|
+
GenerateAvatarStudioMediaImageCommand.RequestSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
prompt: zod_1.z.string().trim().min(1),
|
|
12
|
+
referenceMediaIds: avatar_studio_common_schema_1.AvatarStudioUuidListSchema.optional(),
|
|
13
|
+
aspectRatio: models_1.AvatarStudioAspectRatioSchema.default('9:16'),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
GenerateAvatarStudioMediaImageCommand.ResponseSchema = zod_1.z.object({
|
|
17
|
+
data: models_1.AvatarStudioGenerationJobSchema,
|
|
18
|
+
});
|
|
19
|
+
})(GenerateAvatarStudioMediaImageCommand || (exports.GenerateAvatarStudioMediaImageCommand = GenerateAvatarStudioMediaImageCommand = {}));
|
package/build/commands/avatar-studio/generation-job/generate-avatar-studio-talking-avatar.command.js
CHANGED
|
@@ -7,10 +7,12 @@ const avatar_studio_common_schema_1 = require("../shared/avatar-studio-common.sc
|
|
|
7
7
|
var GenerateAvatarStudioTalkingAvatarCommand;
|
|
8
8
|
(function (GenerateAvatarStudioTalkingAvatarCommand) {
|
|
9
9
|
GenerateAvatarStudioTalkingAvatarCommand.ParamsSchema = avatar_studio_common_schema_1.AvatarStudioSceneIdParamsSchema;
|
|
10
|
-
GenerateAvatarStudioTalkingAvatarCommand.RequestSchema = avatar_studio_common_schema_1.
|
|
10
|
+
GenerateAvatarStudioTalkingAvatarCommand.RequestSchema = avatar_studio_common_schema_1.AvatarStudioVideoGenerationRequestBaseSchema.extend({
|
|
11
11
|
imageMediaId: zod_1.z.string().uuid().optional(),
|
|
12
12
|
audioMediaId: zod_1.z.string().uuid().optional(),
|
|
13
|
-
})
|
|
13
|
+
})
|
|
14
|
+
.strict()
|
|
15
|
+
.superRefine(models_1.validateAvatarStudioTrim);
|
|
14
16
|
GenerateAvatarStudioTalkingAvatarCommand.ResponseSchema = zod_1.z.object({
|
|
15
17
|
data: models_1.AvatarStudioGenerationJobSchema,
|
|
16
18
|
});
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./find-avatar-studio-generation-jobs.query"), exports);
|
|
18
18
|
__exportStar(require("./generate-avatar-studio-frame.command"), exports);
|
|
19
19
|
__exportStar(require("./generate-avatar-studio-library-image.command"), exports);
|
|
20
|
+
__exportStar(require("./generate-avatar-studio-media-image.command"), exports);
|
|
20
21
|
__exportStar(require("./generate-avatar-studio-scene-video.command"), exports);
|
|
21
22
|
__exportStar(require("./generate-avatar-studio-scene-voice.command"), exports);
|
|
22
23
|
__exportStar(require("./generate-avatar-studio-talking-avatar.command"), exports);
|
|
@@ -18,6 +18,7 @@ var CreateAvatarStudioMediaFromFileCommand;
|
|
|
18
18
|
.default(constants_1.AVATAR_STUDIO_MEDIA_SOURCE.UPLOAD)
|
|
19
19
|
.optional(),
|
|
20
20
|
role: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_MEDIA_ROLE),
|
|
21
|
+
title: zod_1.z.string().trim().min(1).max(255).optional(),
|
|
21
22
|
prompt: zod_1.z.string().optional(),
|
|
22
23
|
})
|
|
23
24
|
.strict();
|
|
@@ -12,6 +12,7 @@ var UpdateAvatarStudioMediaCommand;
|
|
|
12
12
|
.object({
|
|
13
13
|
sceneId: zod_1.z.string().uuid().nullable().optional(),
|
|
14
14
|
role: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_MEDIA_ROLE).optional(),
|
|
15
|
+
title: zod_1.z.string().trim().min(1).max(255).nullable().optional(),
|
|
15
16
|
prompt: zod_1.z.string().nullable().optional(),
|
|
16
17
|
})
|
|
17
18
|
.strict();
|
|
@@ -22,6 +22,8 @@ var CreateAvatarStudioScriptwriterMessageCommand;
|
|
|
22
22
|
.object({
|
|
23
23
|
voiceConfig: zod_1.z.object({
|
|
24
24
|
text: zod_1.z.string().trim().min(1),
|
|
25
|
+
trimStart: zod_1.z.number().nonnegative().nullable().optional(),
|
|
26
|
+
trimEnd: zod_1.z.number().nonnegative().nullable().optional(),
|
|
25
27
|
}),
|
|
26
28
|
imageConfig: zod_1.z.object({
|
|
27
29
|
prompt: zod_1.z.string().trim().min(1),
|
|
@@ -33,6 +35,8 @@ var CreateAvatarStudioScriptwriterMessageCommand;
|
|
|
33
35
|
videoMode: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_MODE),
|
|
34
36
|
quality: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_QUALITY),
|
|
35
37
|
sound: zod_1.z.boolean(),
|
|
38
|
+
trimStart: zod_1.z.number().nonnegative().nullable().optional(),
|
|
39
|
+
trimEnd: zod_1.z.number().nonnegative().nullable().optional(),
|
|
36
40
|
}),
|
|
37
41
|
})
|
|
38
42
|
.strict();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AvatarStudioVideoGenerationRequestSchema = exports.AvatarStudioSceneConfigPatchSchema = exports.AvatarStudioUuidListSchema = exports.AvatarStudioPagedResponseSchema = exports.AvatarStudioPaginationQuerySchema = exports.AvatarStudioExportJobIdParamsSchema = exports.AvatarStudioGenerationJobIdParamsSchema = exports.AvatarStudioMediaIdParamsSchema = exports.AvatarStudioSceneIdParamsSchema = exports.AvatarStudioClipIdParamsSchema = void 0;
|
|
3
|
+
exports.AvatarStudioVideoGenerationRequestSchema = exports.AvatarStudioVideoGenerationRequestBaseSchema = exports.AvatarStudioSceneConfigPatchSchema = exports.AvatarStudioUuidListSchema = exports.AvatarStudioPagedResponseSchema = exports.AvatarStudioPaginationQuerySchema = exports.AvatarStudioExportJobIdParamsSchema = exports.AvatarStudioGenerationJobIdParamsSchema = exports.AvatarStudioMediaIdParamsSchema = exports.AvatarStudioSceneIdParamsSchema = exports.AvatarStudioClipIdParamsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../../../constants");
|
|
6
6
|
const models_1 = require("../../../models");
|
|
@@ -32,17 +32,26 @@ exports.AvatarStudioPagedResponseSchema = AvatarStudioPagedResponseSchema;
|
|
|
32
32
|
exports.AvatarStudioUuidListSchema = zod_1.z.array(zod_1.z.string().uuid()).default([]);
|
|
33
33
|
exports.AvatarStudioSceneConfigPatchSchema = zod_1.z
|
|
34
34
|
.object({
|
|
35
|
-
voiceConfig: models_1.
|
|
35
|
+
voiceConfig: models_1.AvatarStudioSceneVoiceConfigBaseSchema.strict()
|
|
36
|
+
.partial()
|
|
37
|
+
.superRefine(models_1.validateAvatarStudioTrim)
|
|
38
|
+
.optional(),
|
|
36
39
|
imageConfig: models_1.AvatarStudioSceneImageConfigSchema.strict().partial().optional(),
|
|
37
|
-
videoConfig: models_1.
|
|
40
|
+
videoConfig: models_1.AvatarStudioSceneVideoConfigBaseSchema.strict()
|
|
41
|
+
.partial()
|
|
42
|
+
.superRefine(models_1.validateAvatarStudioTrim)
|
|
43
|
+
.optional(),
|
|
38
44
|
})
|
|
39
45
|
.strict();
|
|
40
|
-
exports.
|
|
46
|
+
exports.AvatarStudioVideoGenerationRequestBaseSchema = zod_1.z
|
|
41
47
|
.object({
|
|
42
48
|
prompt: zod_1.z.string().trim().min(1).optional(),
|
|
43
49
|
durationSeconds: zod_1.z.number().positive().optional(),
|
|
44
50
|
videoMode: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_MODE).optional(),
|
|
45
51
|
quality: zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VIDEO_QUALITY).optional(),
|
|
46
52
|
sound: zod_1.z.boolean().optional(),
|
|
53
|
+
trimStart: zod_1.z.number().nonnegative().nullable().optional(),
|
|
54
|
+
trimEnd: zod_1.z.number().nonnegative().nullable().optional(),
|
|
47
55
|
})
|
|
48
56
|
.strict();
|
|
57
|
+
exports.AvatarStudioVideoGenerationRequestSchema = exports.AvatarStudioVideoGenerationRequestBaseSchema.superRefine(models_1.validateAvatarStudioTrim);
|
|
@@ -128,7 +128,7 @@ const AvatarStudioVideoConfigSectionSchema = AvatarStudioConfigSectionBaseSchema
|
|
|
128
128
|
aspectRatio: AvatarStudioFixedFieldSchema(zod_1.z.literal('9:16')),
|
|
129
129
|
})
|
|
130
130
|
.strict(),
|
|
131
|
-
defaults: models_1.
|
|
131
|
+
defaults: models_1.AvatarStudioSceneVideoConfigBaseSchema.extend({
|
|
132
132
|
aspectRatio: zod_1.z.literal('9:16'),
|
|
133
133
|
}),
|
|
134
134
|
pricing: zod_1.z
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FindAvatarStudioClipVoicesQuery = void 0;
|
|
4
4
|
const models_1 = require("../../../models");
|
|
5
5
|
const avatar_studio_common_schema_1 = require("../shared/avatar-studio-common.schema");
|
|
6
|
+
const find_avatar_studio_voices_query_1 = require("./find-avatar-studio-voices.query");
|
|
6
7
|
var FindAvatarStudioClipVoicesQuery;
|
|
7
8
|
(function (FindAvatarStudioClipVoicesQuery) {
|
|
8
9
|
FindAvatarStudioClipVoicesQuery.ParamsSchema = avatar_studio_common_schema_1.AvatarStudioClipIdParamsSchema;
|
|
9
|
-
FindAvatarStudioClipVoicesQuery.QuerySchema = avatar_studio_common_schema_1.AvatarStudioPaginationQuerySchema
|
|
10
|
+
FindAvatarStudioClipVoicesQuery.QuerySchema = avatar_studio_common_schema_1.AvatarStudioPaginationQuerySchema.extend({
|
|
11
|
+
source: find_avatar_studio_voices_query_1.AvatarStudioVoiceSourceFilterSchema.optional(),
|
|
12
|
+
});
|
|
10
13
|
FindAvatarStudioClipVoicesQuery.ResponseSchema = (0, avatar_studio_common_schema_1.AvatarStudioPagedResponseSchema)(models_1.AvatarStudioVoiceSchema);
|
|
11
14
|
})(FindAvatarStudioClipVoicesQuery || (exports.FindAvatarStudioClipVoicesQuery = FindAvatarStudioClipVoicesQuery = {}));
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FindAvatarStudioVoicesQuery = void 0;
|
|
3
|
+
exports.FindAvatarStudioVoicesQuery = exports.AvatarStudioVoiceSourceFilterSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../../constants");
|
|
5
6
|
const models_1 = require("../../../models");
|
|
6
7
|
const avatar_studio_common_schema_1 = require("../shared/avatar-studio-common.schema");
|
|
8
|
+
exports.AvatarStudioVoiceSourceFilterSchema = zod_1.z.union([
|
|
9
|
+
zod_1.z.nativeEnum(constants_1.AVATAR_STUDIO_VOICE_SOURCE),
|
|
10
|
+
zod_1.z.literal('user'),
|
|
11
|
+
]);
|
|
7
12
|
var FindAvatarStudioVoicesQuery;
|
|
8
13
|
(function (FindAvatarStudioVoicesQuery) {
|
|
9
14
|
FindAvatarStudioVoicesQuery.QuerySchema = avatar_studio_common_schema_1.AvatarStudioPaginationQuerySchema.extend({
|
|
10
15
|
clipId: zod_1.z.string().uuid().optional(),
|
|
16
|
+
source: exports.AvatarStudioVoiceSourceFilterSchema.optional(),
|
|
11
17
|
});
|
|
12
18
|
FindAvatarStudioVoicesQuery.ResponseSchema = (0, avatar_studio_common_schema_1.AvatarStudioPagedResponseSchema)(models_1.AvatarStudioVoiceSchema);
|
|
13
19
|
})(FindAvatarStudioVoicesQuery || (exports.FindAvatarStudioVoicesQuery = FindAvatarStudioVoicesQuery = {}));
|
|
@@ -7,9 +7,12 @@ const avatar_studio_common_schema_1 = require("../shared/avatar-studio-common.sc
|
|
|
7
7
|
var UpdateAvatarStudioClipVoiceCommand;
|
|
8
8
|
(function (UpdateAvatarStudioClipVoiceCommand) {
|
|
9
9
|
UpdateAvatarStudioClipVoiceCommand.ParamsSchema = avatar_studio_common_schema_1.AvatarStudioClipIdParamsSchema;
|
|
10
|
-
UpdateAvatarStudioClipVoiceCommand.RequestSchema = zod_1.z
|
|
10
|
+
UpdateAvatarStudioClipVoiceCommand.RequestSchema = zod_1.z
|
|
11
|
+
.object({
|
|
11
12
|
voiceId: zod_1.z.string().uuid().nullable(),
|
|
12
|
-
|
|
13
|
+
applyToScenes: zod_1.z.boolean().default(false).optional(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
13
16
|
UpdateAvatarStudioClipVoiceCommand.ResponseSchema = zod_1.z.object({
|
|
14
17
|
data: models_1.AvatarStudioClipSchema,
|
|
15
18
|
});
|
|
@@ -6,4 +6,5 @@ var AVATAR_STUDIO_VOICE_SOURCE;
|
|
|
6
6
|
AVATAR_STUDIO_VOICE_SOURCE["UPLOAD"] = "upload";
|
|
7
7
|
AVATAR_STUDIO_VOICE_SOURCE["TTS"] = "tts";
|
|
8
8
|
AVATAR_STUDIO_VOICE_SOURCE["VOICE_DESIGN"] = "voice_design";
|
|
9
|
+
AVATAR_STUDIO_VOICE_SOURCE["PRESET"] = "preset";
|
|
9
10
|
})(AVATAR_STUDIO_VOICE_SOURCE || (exports.AVATAR_STUDIO_VOICE_SOURCE = AVATAR_STUDIO_VOICE_SOURCE = {}));
|
|
@@ -13,6 +13,12 @@ exports.SUPPORTED_FILES = new Map([
|
|
|
13
13
|
['image/webp', { type: enums_1.FILE_TYPE.IMAGE, size: exports.MAX_IMAGE_UPLOAD_SIZE }],
|
|
14
14
|
['audio/mp3', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
15
15
|
['audio/mpeg', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
16
|
+
['audio/webm', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
17
|
+
['audio/webm;codecs=opus', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
18
|
+
['video/webm', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
19
|
+
['audio/mp4', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
20
|
+
['audio/ogg', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
21
|
+
['audio/ogg;codecs=opus', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
16
22
|
['audio/wave', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
17
23
|
['audio/wav', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
18
24
|
['audio/x-wav', { type: enums_1.FILE_TYPE.AUDIO, size: exports.MAX_AUDIO_UPLOAD_SIZE }],
|
|
@@ -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.
|
|
51
|
-
|
|
52
|
-
|
|
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.
|
|
59
|
-
|
|
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,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
|
+
}
|
package/commands/avatar-studio/generation-job/generate-avatar-studio-talking-avatar.command.ts
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
12
|
+
export const RequestSchema = AvatarStudioVideoGenerationRequestBaseSchema.extend({
|
|
13
13
|
imageMediaId: z.string().uuid().optional(),
|
|
14
14
|
audioMediaId: z.string().uuid().optional(),
|
|
15
|
-
})
|
|
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();
|
package/commands/avatar-studio/scriptwriter/create-avatar-studio-scriptwriter-message.command.ts
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
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:
|
|
46
|
+
voiceConfig: AvatarStudioSceneVoiceConfigBaseSchema.strict()
|
|
47
|
+
.partial()
|
|
48
|
+
.superRefine(validateAvatarStudioTrim)
|
|
49
|
+
.optional(),
|
|
46
50
|
imageConfig: AvatarStudioSceneImageConfigSchema.strict().partial().optional(),
|
|
47
|
-
videoConfig:
|
|
51
|
+
videoConfig: AvatarStudioSceneVideoConfigBaseSchema.strict()
|
|
52
|
+
.partial()
|
|
53
|
+
.superRefine(validateAvatarStudioTrim)
|
|
54
|
+
.optional(),
|
|
48
55
|
})
|
|
49
56
|
.strict();
|
|
50
57
|
|
|
51
|
-
export const
|
|
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
|
-
|
|
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:
|
|
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
|
|
10
|
-
|
|
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({
|
|
@@ -18,6 +18,12 @@ export const SUPPORTED_FILES = new Map<
|
|
|
18
18
|
['image/webp', { type: FILE_TYPE.IMAGE, size: MAX_IMAGE_UPLOAD_SIZE }],
|
|
19
19
|
['audio/mp3', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
20
20
|
['audio/mpeg', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
21
|
+
['audio/webm', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
22
|
+
['audio/webm;codecs=opus', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
23
|
+
['video/webm', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
24
|
+
['audio/mp4', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
25
|
+
['audio/ogg', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
26
|
+
['audio/ogg;codecs=opus', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
21
27
|
['audio/wave', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
22
28
|
['audio/wav', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
23
29
|
['audio/x-wav', { type: FILE_TYPE.AUDIO, size: MAX_AUDIO_UPLOAD_SIZE }],
|
|
@@ -45,13 +45,14 @@ export type AvatarStudioWordTiming = z.infer<typeof AvatarStudioWordTimingSchema
|
|
|
45
45
|
|
|
46
46
|
export const AvatarStudioMediaSchema = z.object({
|
|
47
47
|
uuid: z.string().uuid(),
|
|
48
|
-
userId: z.string().uuid(),
|
|
48
|
+
userId: z.string().uuid().nullable(),
|
|
49
49
|
clipId: z.string().uuid().nullable(),
|
|
50
50
|
sceneId: z.string().uuid().nullable(),
|
|
51
51
|
fileId: z.string().uuid(),
|
|
52
52
|
kind: z.nativeEnum(AVATAR_STUDIO_MEDIA_KIND),
|
|
53
53
|
source: z.nativeEnum(AVATAR_STUDIO_MEDIA_SOURCE),
|
|
54
54
|
role: z.nativeEnum(AVATAR_STUDIO_MEDIA_ROLE),
|
|
55
|
+
title: z.string().nullable(),
|
|
55
56
|
prompt: z.string().nullable(),
|
|
56
57
|
toolJobId: z.string().uuid().nullable(),
|
|
57
58
|
durationSeconds: z.number().nullable(),
|
|
@@ -72,10 +73,32 @@ export const AvatarStudioSceneReferenceMediaSchema = z.object({
|
|
|
72
73
|
});
|
|
73
74
|
export type AvatarStudioSceneReferenceMedia = z.infer<typeof AvatarStudioSceneReferenceMediaSchema>;
|
|
74
75
|
|
|
75
|
-
export const
|
|
76
|
+
export const AvatarStudioTrimConfigFields = {
|
|
77
|
+
trimStart: z.number().nonnegative().nullable().default(null),
|
|
78
|
+
trimEnd: z.number().nonnegative().nullable().default(null),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const validateAvatarStudioTrim = (
|
|
82
|
+
{ trimStart, trimEnd }: { trimStart?: number | null; trimEnd?: number | null },
|
|
83
|
+
ctx: z.RefinementCtx,
|
|
84
|
+
): void => {
|
|
85
|
+
if (trimStart != null && trimEnd != null && trimEnd <= trimStart) {
|
|
86
|
+
ctx.addIssue({
|
|
87
|
+
code: z.ZodIssueCode.custom,
|
|
88
|
+
message: 'trimEnd must be greater than trimStart',
|
|
89
|
+
path: ['trimEnd'],
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const AvatarStudioSceneVoiceConfigBaseSchema = z.object({
|
|
76
95
|
text: z.string().default(''),
|
|
77
96
|
mediaId: z.string().uuid().nullable().default(null),
|
|
97
|
+
...AvatarStudioTrimConfigFields,
|
|
78
98
|
});
|
|
99
|
+
|
|
100
|
+
export const AvatarStudioSceneVoiceConfigSchema =
|
|
101
|
+
AvatarStudioSceneVoiceConfigBaseSchema.superRefine(validateAvatarStudioTrim);
|
|
79
102
|
export type AvatarStudioSceneVoiceConfig = z.infer<typeof AvatarStudioSceneVoiceConfigSchema>;
|
|
80
103
|
|
|
81
104
|
export const AvatarStudioSceneImageConfigSchema = z.object({
|
|
@@ -84,13 +107,17 @@ export const AvatarStudioSceneImageConfigSchema = z.object({
|
|
|
84
107
|
});
|
|
85
108
|
export type AvatarStudioSceneImageConfig = z.infer<typeof AvatarStudioSceneImageConfigSchema>;
|
|
86
109
|
|
|
87
|
-
export const
|
|
110
|
+
export const AvatarStudioSceneVideoConfigBaseSchema = z.object({
|
|
88
111
|
prompt: z.string().nullable().default(null),
|
|
89
112
|
durationSeconds: z.number().positive().default(5),
|
|
90
113
|
videoMode: z.nativeEnum(AVATAR_STUDIO_VIDEO_MODE).default(AVATAR_STUDIO_VIDEO_MODE.B_ROLL),
|
|
91
114
|
quality: z.nativeEnum(AVATAR_STUDIO_VIDEO_QUALITY).default(AVATAR_STUDIO_VIDEO_QUALITY.P720),
|
|
92
115
|
sound: z.boolean().default(false),
|
|
116
|
+
...AvatarStudioTrimConfigFields,
|
|
93
117
|
});
|
|
118
|
+
|
|
119
|
+
export const AvatarStudioSceneVideoConfigSchema =
|
|
120
|
+
AvatarStudioSceneVideoConfigBaseSchema.superRefine(validateAvatarStudioTrim);
|
|
94
121
|
export type AvatarStudioSceneVideoConfig = z.infer<typeof AvatarStudioSceneVideoConfigSchema>;
|
|
95
122
|
|
|
96
123
|
export const AvatarStudioSceneGenerationJobSchema = z.object({
|
|
@@ -141,10 +168,13 @@ export type AvatarStudioScene = z.infer<typeof AvatarStudioSceneSchema>;
|
|
|
141
168
|
|
|
142
169
|
export const AvatarStudioVoiceSchema = z.object({
|
|
143
170
|
uuid: z.string().uuid(),
|
|
144
|
-
userId: z.string().uuid(),
|
|
171
|
+
userId: z.string().uuid().nullable(),
|
|
145
172
|
clipId: z.string().uuid().nullable(),
|
|
146
173
|
title: z.string(),
|
|
147
174
|
source: z.nativeEnum(AVATAR_STUDIO_VOICE_SOURCE),
|
|
175
|
+
presetKey: z.string().nullable(),
|
|
176
|
+
gender: z.enum(['male', 'female']).nullable(),
|
|
177
|
+
sortOrder: z.number().int().nullable(),
|
|
148
178
|
sampleMediaId: z.string().uuid().nullable(),
|
|
149
179
|
sampleText: z.string().nullable(),
|
|
150
180
|
metadata: JsonObjectSchema.nullable(),
|