mulmocast 1.2.61 → 1.2.63
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/lib/actions/images.js +4 -4
- package/lib/agents/movie_genai_agent.js +10 -2
- package/lib/agents/movie_replicate_agent.js +7 -16
- package/lib/types/schema.d.ts +243 -1
- package/lib/types/schema.js +20 -18
- package/lib/types/type.d.ts +3 -1
- package/lib/utils/error_cause.d.ts +2 -0
- package/lib/utils/error_cause.js +2 -0
- package/lib/utils/provider2agent.d.ts +10 -0
- package/lib/utils/provider2agent.js +18 -0
- package/package.json +1 -1
package/lib/actions/images.js
CHANGED
|
@@ -444,12 +444,12 @@ export const images = async (context, args) => {
|
|
|
444
444
|
MulmoStudioContextMethods.setSessionState(context, "image", false, false);
|
|
445
445
|
if (error instanceof AuthenticationError) {
|
|
446
446
|
throw new Error("Failed to generate image: 401 Incorrect API key provided with OpenAI", {
|
|
447
|
-
cause: agentIncorrectAPIKeyError("
|
|
447
|
+
cause: agentIncorrectAPIKeyError("openAIAgent", imageAction, imageFileTarget),
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
if (error instanceof RateLimitError) {
|
|
451
451
|
throw new Error("You exceeded your current quota", {
|
|
452
|
-
cause: agentAPIRateLimitError("
|
|
452
|
+
cause: agentAPIRateLimitError("openAIAgent", imageAction, imageFileTarget),
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
throw error;
|
|
@@ -484,12 +484,12 @@ export const generateBeatImage = async (inputs) => {
|
|
|
484
484
|
catch (error) {
|
|
485
485
|
if (error instanceof AuthenticationError) {
|
|
486
486
|
throw new Error("Failed to generate image: 401 Incorrect API key provided with OpenAI", {
|
|
487
|
-
cause: agentIncorrectAPIKeyError("
|
|
487
|
+
cause: agentIncorrectAPIKeyError("openAIAgent", imageAction, imageFileTarget),
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
if (error instanceof RateLimitError) {
|
|
491
491
|
throw new Error("You exceeded your current quota", {
|
|
492
|
-
cause: agentAPIRateLimitError("
|
|
492
|
+
cause: agentAPIRateLimitError("openAIAgent", imageAction, imageFileTarget),
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
throw error;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
2
|
import { GraphAILogger, sleep } from "graphai";
|
|
3
|
-
import { apiKeyMissingError, agentGenerationError, agentInvalidResponseError, imageAction, movieFileTarget, hasCause } from "../utils/error_cause.js";
|
|
3
|
+
import { apiKeyMissingError, agentGenerationError, agentInvalidResponseError, imageAction, movieFileTarget, videoDurationTarget, hasCause, } from "../utils/error_cause.js";
|
|
4
4
|
import { GoogleGenAI, PersonGeneration } from "@google/genai";
|
|
5
|
+
import { getModelDuration } from "../utils/provider2agent.js";
|
|
5
6
|
export const getAspectRatio = (canvasSize) => {
|
|
6
7
|
if (canvasSize.width > canvasSize.height) {
|
|
7
8
|
return "16:9";
|
|
@@ -17,7 +18,7 @@ export const movieGenAIAgent = async ({ namedInputs, params, config, }) => {
|
|
|
17
18
|
const { prompt, imagePath, movieFile } = namedInputs;
|
|
18
19
|
const aspectRatio = getAspectRatio(params.canvasSize);
|
|
19
20
|
const model = params.model ?? "veo-2.0-generate-001"; // "veo-3.0-generate-preview";
|
|
20
|
-
const duration = params.duration ?? 8;
|
|
21
|
+
// const duration = params.duration ?? 8;
|
|
21
22
|
const apiKey = config?.apiKey;
|
|
22
23
|
if (!apiKey) {
|
|
23
24
|
throw new Error("Google GenAI API key is required (GEMINI_API_KEY)", {
|
|
@@ -25,6 +26,13 @@ export const movieGenAIAgent = async ({ namedInputs, params, config, }) => {
|
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
try {
|
|
29
|
+
const requestedDuration = params.duration ?? 8;
|
|
30
|
+
const duration = getModelDuration("google", model, requestedDuration);
|
|
31
|
+
if (duration === undefined) {
|
|
32
|
+
throw new Error(`Duration ${requestedDuration} is not supported for model ${model}.`, {
|
|
33
|
+
cause: agentGenerationError("movieGenAIAgent", imageAction, videoDurationTarget),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
28
36
|
const ai = new GoogleGenAI({ apiKey });
|
|
29
37
|
const payload = {
|
|
30
38
|
model,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
2
|
import { GraphAILogger } from "graphai";
|
|
3
3
|
import Replicate from "replicate";
|
|
4
|
-
import { apiKeyMissingError, agentGenerationError, agentInvalidResponseError, imageAction, movieFileTarget } from "../utils/error_cause.js";
|
|
5
|
-
import { provider2MovieAgent } from "../utils/provider2agent.js";
|
|
4
|
+
import { apiKeyMissingError, agentGenerationError, agentInvalidResponseError, imageAction, movieFileTarget, videoDurationTarget, unsupportedModelTarget, } from "../utils/error_cause.js";
|
|
5
|
+
import { provider2MovieAgent, getModelDuration } from "../utils/provider2agent.js";
|
|
6
6
|
async function generateMovie(model, apiKey, prompt, imagePath, aspectRatio, duration) {
|
|
7
7
|
const replicate = new Replicate({
|
|
8
8
|
auth: apiKey,
|
|
@@ -30,7 +30,7 @@ async function generateMovie(model, apiKey, prompt, imagePath, aspectRatio, dura
|
|
|
30
30
|
}
|
|
31
31
|
else if (start_image === undefined) {
|
|
32
32
|
throw new Error(`Model ${model} does not support image-to-video generation`, {
|
|
33
|
-
cause: agentGenerationError("movieReplicateAgent", imageAction,
|
|
33
|
+
cause: agentGenerationError("movieReplicateAgent", imageAction, unsupportedModelTarget),
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
@@ -77,22 +77,13 @@ export const movieReplicateAgent = async ({ namedInputs, params, config, }) => {
|
|
|
77
77
|
const model = params.model ?? provider2MovieAgent.replicate.defaultModel;
|
|
78
78
|
if (!provider2MovieAgent.replicate.modelParams[model]) {
|
|
79
79
|
throw new Error(`Model ${model} is not supported`, {
|
|
80
|
-
cause: agentGenerationError("movieReplicateAgent", imageAction,
|
|
80
|
+
cause: agentGenerationError("movieReplicateAgent", imageAction, unsupportedModelTarget),
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
const duration = (
|
|
84
|
-
|
|
85
|
-
if (params.duration) {
|
|
86
|
-
const largerDurations = durations.filter((d) => d >= params.duration);
|
|
87
|
-
return largerDurations.length > 0 ? largerDurations[0] : durations[durations.length - 1];
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
return durations[0];
|
|
91
|
-
}
|
|
92
|
-
})();
|
|
93
|
-
if (!provider2MovieAgent.replicate.modelParams[model].durations.includes(duration)) {
|
|
83
|
+
const duration = getModelDuration("replicate", model, params.duration);
|
|
84
|
+
if (duration === undefined || !provider2MovieAgent.replicate.modelParams[model].durations.includes(duration)) {
|
|
94
85
|
throw new Error(`Duration ${duration} is not supported for model ${model}. Supported durations: ${provider2MovieAgent.replicate.modelParams[model].durations.join(", ")}`, {
|
|
95
|
-
cause: agentGenerationError("movieReplicateAgent", imageAction,
|
|
86
|
+
cause: agentGenerationError("movieReplicateAgent", imageAction, videoDurationTarget),
|
|
96
87
|
});
|
|
97
88
|
}
|
|
98
89
|
const apiKey = config?.apiKey;
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export declare const speechOptionsSchema: z.ZodObject<{
|
|
|
54
54
|
speed?: number | undefined;
|
|
55
55
|
instruction?: string | undefined;
|
|
56
56
|
}>;
|
|
57
|
+
export declare const defaultSpeaker = "Presenter";
|
|
57
58
|
export declare const text2SpeechProviderSchema: z.ZodDefault<z.ZodEnum<[string, ...string[]]>>;
|
|
58
59
|
export declare const speakerDataSchema: z.ZodObject<{
|
|
59
60
|
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -92,6 +93,103 @@ export declare const speakerDataSchema: z.ZodObject<{
|
|
|
92
93
|
provider?: string | undefined;
|
|
93
94
|
model?: string | undefined;
|
|
94
95
|
}>;
|
|
96
|
+
export declare const speakerSchema: z.ZodObject<{
|
|
97
|
+
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
98
|
+
voiceId: z.ZodString;
|
|
99
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
+
speechOptions: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "strict", z.ZodTypeAny, {
|
|
104
|
+
speed?: number | undefined;
|
|
105
|
+
instruction?: string | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
speed?: number | undefined;
|
|
108
|
+
instruction?: string | undefined;
|
|
109
|
+
}>>;
|
|
110
|
+
provider: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
|
|
111
|
+
model: z.ZodOptional<z.ZodString>;
|
|
112
|
+
} & {
|
|
113
|
+
lang: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
114
|
+
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
115
|
+
voiceId: z.ZodString;
|
|
116
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
+
speechOptions: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
120
|
+
}, "strict", z.ZodTypeAny, {
|
|
121
|
+
speed?: number | undefined;
|
|
122
|
+
instruction?: string | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
speed?: number | undefined;
|
|
125
|
+
instruction?: string | undefined;
|
|
126
|
+
}>>;
|
|
127
|
+
provider: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
|
|
128
|
+
model: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, "strict", z.ZodTypeAny, {
|
|
130
|
+
voiceId: string;
|
|
131
|
+
displayName?: Record<string, string> | undefined;
|
|
132
|
+
isDefault?: boolean | undefined;
|
|
133
|
+
speechOptions?: {
|
|
134
|
+
speed?: number | undefined;
|
|
135
|
+
instruction?: string | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
provider?: string | undefined;
|
|
138
|
+
model?: string | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
voiceId: string;
|
|
141
|
+
displayName?: Record<string, string> | undefined;
|
|
142
|
+
isDefault?: boolean | undefined;
|
|
143
|
+
speechOptions?: {
|
|
144
|
+
speed?: number | undefined;
|
|
145
|
+
instruction?: string | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
provider?: string | undefined;
|
|
148
|
+
model?: string | undefined;
|
|
149
|
+
}>>>;
|
|
150
|
+
}, "strict", z.ZodTypeAny, {
|
|
151
|
+
voiceId: string;
|
|
152
|
+
lang?: Record<string, {
|
|
153
|
+
voiceId: string;
|
|
154
|
+
displayName?: Record<string, string> | undefined;
|
|
155
|
+
isDefault?: boolean | undefined;
|
|
156
|
+
speechOptions?: {
|
|
157
|
+
speed?: number | undefined;
|
|
158
|
+
instruction?: string | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
provider?: string | undefined;
|
|
161
|
+
model?: string | undefined;
|
|
162
|
+
}> | undefined;
|
|
163
|
+
displayName?: Record<string, string> | undefined;
|
|
164
|
+
isDefault?: boolean | undefined;
|
|
165
|
+
speechOptions?: {
|
|
166
|
+
speed?: number | undefined;
|
|
167
|
+
instruction?: string | undefined;
|
|
168
|
+
} | undefined;
|
|
169
|
+
provider?: string | undefined;
|
|
170
|
+
model?: string | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
voiceId: string;
|
|
173
|
+
lang?: Record<string, {
|
|
174
|
+
voiceId: string;
|
|
175
|
+
displayName?: Record<string, string> | undefined;
|
|
176
|
+
isDefault?: boolean | undefined;
|
|
177
|
+
speechOptions?: {
|
|
178
|
+
speed?: number | undefined;
|
|
179
|
+
instruction?: string | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
provider?: string | undefined;
|
|
182
|
+
model?: string | undefined;
|
|
183
|
+
}> | undefined;
|
|
184
|
+
displayName?: Record<string, string> | undefined;
|
|
185
|
+
isDefault?: boolean | undefined;
|
|
186
|
+
speechOptions?: {
|
|
187
|
+
speed?: number | undefined;
|
|
188
|
+
instruction?: string | undefined;
|
|
189
|
+
} | undefined;
|
|
190
|
+
provider?: string | undefined;
|
|
191
|
+
model?: string | undefined;
|
|
192
|
+
}>;
|
|
95
193
|
export declare const speakerDictionarySchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
96
194
|
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
97
195
|
voiceId: z.ZodString;
|
|
@@ -189,6 +287,151 @@ export declare const speakerDictionarySchema: z.ZodRecord<z.ZodString, z.ZodObje
|
|
|
189
287
|
provider?: string | undefined;
|
|
190
288
|
model?: string | undefined;
|
|
191
289
|
}>>;
|
|
290
|
+
export declare const mulmoSpeechParamsSchema: z.ZodDefault<z.ZodObject<{
|
|
291
|
+
speakers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
292
|
+
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
293
|
+
voiceId: z.ZodString;
|
|
294
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
+
speechOptions: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
297
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
298
|
+
}, "strict", z.ZodTypeAny, {
|
|
299
|
+
speed?: number | undefined;
|
|
300
|
+
instruction?: string | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
speed?: number | undefined;
|
|
303
|
+
instruction?: string | undefined;
|
|
304
|
+
}>>;
|
|
305
|
+
provider: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
|
|
306
|
+
model: z.ZodOptional<z.ZodString>;
|
|
307
|
+
} & {
|
|
308
|
+
lang: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
309
|
+
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
310
|
+
voiceId: z.ZodString;
|
|
311
|
+
isDefault: z.ZodOptional<z.ZodBoolean>;
|
|
312
|
+
speechOptions: z.ZodOptional<z.ZodObject<{
|
|
313
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
314
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
315
|
+
}, "strict", z.ZodTypeAny, {
|
|
316
|
+
speed?: number | undefined;
|
|
317
|
+
instruction?: string | undefined;
|
|
318
|
+
}, {
|
|
319
|
+
speed?: number | undefined;
|
|
320
|
+
instruction?: string | undefined;
|
|
321
|
+
}>>;
|
|
322
|
+
provider: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
|
|
323
|
+
model: z.ZodOptional<z.ZodString>;
|
|
324
|
+
}, "strict", z.ZodTypeAny, {
|
|
325
|
+
voiceId: string;
|
|
326
|
+
displayName?: Record<string, string> | undefined;
|
|
327
|
+
isDefault?: boolean | undefined;
|
|
328
|
+
speechOptions?: {
|
|
329
|
+
speed?: number | undefined;
|
|
330
|
+
instruction?: string | undefined;
|
|
331
|
+
} | undefined;
|
|
332
|
+
provider?: string | undefined;
|
|
333
|
+
model?: string | undefined;
|
|
334
|
+
}, {
|
|
335
|
+
voiceId: string;
|
|
336
|
+
displayName?: Record<string, string> | undefined;
|
|
337
|
+
isDefault?: boolean | undefined;
|
|
338
|
+
speechOptions?: {
|
|
339
|
+
speed?: number | undefined;
|
|
340
|
+
instruction?: string | undefined;
|
|
341
|
+
} | undefined;
|
|
342
|
+
provider?: string | undefined;
|
|
343
|
+
model?: string | undefined;
|
|
344
|
+
}>>>;
|
|
345
|
+
}, "strict", z.ZodTypeAny, {
|
|
346
|
+
voiceId: string;
|
|
347
|
+
lang?: Record<string, {
|
|
348
|
+
voiceId: string;
|
|
349
|
+
displayName?: Record<string, string> | undefined;
|
|
350
|
+
isDefault?: boolean | undefined;
|
|
351
|
+
speechOptions?: {
|
|
352
|
+
speed?: number | undefined;
|
|
353
|
+
instruction?: string | undefined;
|
|
354
|
+
} | undefined;
|
|
355
|
+
provider?: string | undefined;
|
|
356
|
+
model?: string | undefined;
|
|
357
|
+
}> | undefined;
|
|
358
|
+
displayName?: Record<string, string> | undefined;
|
|
359
|
+
isDefault?: boolean | undefined;
|
|
360
|
+
speechOptions?: {
|
|
361
|
+
speed?: number | undefined;
|
|
362
|
+
instruction?: string | undefined;
|
|
363
|
+
} | undefined;
|
|
364
|
+
provider?: string | undefined;
|
|
365
|
+
model?: string | undefined;
|
|
366
|
+
}, {
|
|
367
|
+
voiceId: string;
|
|
368
|
+
lang?: Record<string, {
|
|
369
|
+
voiceId: string;
|
|
370
|
+
displayName?: Record<string, string> | undefined;
|
|
371
|
+
isDefault?: boolean | undefined;
|
|
372
|
+
speechOptions?: {
|
|
373
|
+
speed?: number | undefined;
|
|
374
|
+
instruction?: string | undefined;
|
|
375
|
+
} | undefined;
|
|
376
|
+
provider?: string | undefined;
|
|
377
|
+
model?: string | undefined;
|
|
378
|
+
}> | undefined;
|
|
379
|
+
displayName?: Record<string, string> | undefined;
|
|
380
|
+
isDefault?: boolean | undefined;
|
|
381
|
+
speechOptions?: {
|
|
382
|
+
speed?: number | undefined;
|
|
383
|
+
instruction?: string | undefined;
|
|
384
|
+
} | undefined;
|
|
385
|
+
provider?: string | undefined;
|
|
386
|
+
model?: string | undefined;
|
|
387
|
+
}>>;
|
|
388
|
+
}, "strip", z.ZodTypeAny, {
|
|
389
|
+
speakers: Record<string, {
|
|
390
|
+
voiceId: string;
|
|
391
|
+
lang?: Record<string, {
|
|
392
|
+
voiceId: string;
|
|
393
|
+
displayName?: Record<string, string> | undefined;
|
|
394
|
+
isDefault?: boolean | undefined;
|
|
395
|
+
speechOptions?: {
|
|
396
|
+
speed?: number | undefined;
|
|
397
|
+
instruction?: string | undefined;
|
|
398
|
+
} | undefined;
|
|
399
|
+
provider?: string | undefined;
|
|
400
|
+
model?: string | undefined;
|
|
401
|
+
}> | undefined;
|
|
402
|
+
displayName?: Record<string, string> | undefined;
|
|
403
|
+
isDefault?: boolean | undefined;
|
|
404
|
+
speechOptions?: {
|
|
405
|
+
speed?: number | undefined;
|
|
406
|
+
instruction?: string | undefined;
|
|
407
|
+
} | undefined;
|
|
408
|
+
provider?: string | undefined;
|
|
409
|
+
model?: string | undefined;
|
|
410
|
+
}>;
|
|
411
|
+
}, {
|
|
412
|
+
speakers: Record<string, {
|
|
413
|
+
voiceId: string;
|
|
414
|
+
lang?: Record<string, {
|
|
415
|
+
voiceId: string;
|
|
416
|
+
displayName?: Record<string, string> | undefined;
|
|
417
|
+
isDefault?: boolean | undefined;
|
|
418
|
+
speechOptions?: {
|
|
419
|
+
speed?: number | undefined;
|
|
420
|
+
instruction?: string | undefined;
|
|
421
|
+
} | undefined;
|
|
422
|
+
provider?: string | undefined;
|
|
423
|
+
model?: string | undefined;
|
|
424
|
+
}> | undefined;
|
|
425
|
+
displayName?: Record<string, string> | undefined;
|
|
426
|
+
isDefault?: boolean | undefined;
|
|
427
|
+
speechOptions?: {
|
|
428
|
+
speed?: number | undefined;
|
|
429
|
+
instruction?: string | undefined;
|
|
430
|
+
} | undefined;
|
|
431
|
+
provider?: string | undefined;
|
|
432
|
+
model?: string | undefined;
|
|
433
|
+
}>;
|
|
434
|
+
}>>;
|
|
192
435
|
export declare const mediaSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
193
436
|
kind: z.ZodLiteral<"url">;
|
|
194
437
|
url: z.ZodString;
|
|
@@ -2410,7 +2653,6 @@ export declare const mulmoMovieParamsSchema: z.ZodObject<{
|
|
|
2410
2653
|
duration?: number | undefined;
|
|
2411
2654
|
} | undefined;
|
|
2412
2655
|
}>;
|
|
2413
|
-
export declare const defaultSpeaker = "Presenter";
|
|
2414
2656
|
export declare const mulmoPresentationStyleSchema: z.ZodObject<{
|
|
2415
2657
|
$mulmocast: z.ZodObject<{
|
|
2416
2658
|
version: z.ZodLiteral<"1.1">;
|
package/lib/types/schema.js
CHANGED
|
@@ -23,6 +23,7 @@ export const speechOptionsSchema = z
|
|
|
23
23
|
})
|
|
24
24
|
.strict();
|
|
25
25
|
const speakerIdSchema = z.string();
|
|
26
|
+
export const defaultSpeaker = "Presenter";
|
|
26
27
|
export const text2SpeechProviderSchema = z.enum(Object.keys(provider2TTSAgent)).default(defaultProviders.tts);
|
|
27
28
|
export const speakerDataSchema = z
|
|
28
29
|
.object({
|
|
@@ -34,9 +35,25 @@ export const speakerDataSchema = z
|
|
|
34
35
|
model: z.string().optional().describe("TTS model to use for this speaker"),
|
|
35
36
|
})
|
|
36
37
|
.strict();
|
|
37
|
-
export const
|
|
38
|
+
export const speakerSchema = speakerDataSchema.extend({
|
|
38
39
|
lang: z.record(langSchema, speakerDataSchema).optional(),
|
|
39
|
-
})
|
|
40
|
+
});
|
|
41
|
+
export const speakerDictionarySchema = z.record(speakerIdSchema, speakerSchema);
|
|
42
|
+
export const mulmoSpeechParamsSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
speakers: speakerDictionarySchema,
|
|
45
|
+
})
|
|
46
|
+
.default({
|
|
47
|
+
speakers: {
|
|
48
|
+
[defaultSpeaker]: {
|
|
49
|
+
provider: defaultProviders.tts,
|
|
50
|
+
voiceId: "shimmer",
|
|
51
|
+
displayName: {
|
|
52
|
+
en: defaultSpeaker,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
40
57
|
export const mediaSourceSchema = z.discriminatedUnion("kind", [
|
|
41
58
|
z.object({ kind: z.literal("url"), url: URLStringSchema }).strict(), // https://example.com/foo.pdf
|
|
42
59
|
z.object({ kind: z.literal("base64"), data: z.string().min(1) }).strict(), // base64
|
|
@@ -335,25 +352,10 @@ export const mulmoMovieParamsSchema = z
|
|
|
335
352
|
fillOption: mulmoFillOptionSchema.optional(), // for movie.ts
|
|
336
353
|
})
|
|
337
354
|
.strict();
|
|
338
|
-
export const defaultSpeaker = "Presenter";
|
|
339
355
|
export const mulmoPresentationStyleSchema = z.object({
|
|
340
356
|
$mulmocast: mulmoCastCreditSchema,
|
|
341
357
|
canvasSize: mulmoCanvasDimensionSchema, // has default value
|
|
342
|
-
speechParams:
|
|
343
|
-
.object({
|
|
344
|
-
speakers: speakerDictionarySchema,
|
|
345
|
-
})
|
|
346
|
-
.default({
|
|
347
|
-
speakers: {
|
|
348
|
-
[defaultSpeaker]: {
|
|
349
|
-
provider: defaultProviders.tts,
|
|
350
|
-
voiceId: "shimmer",
|
|
351
|
-
displayName: {
|
|
352
|
-
en: defaultSpeaker,
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
}),
|
|
358
|
+
speechParams: mulmoSpeechParamsSchema,
|
|
357
359
|
imageParams: mulmoImageParamsSchema.optional().default({
|
|
358
360
|
provider: defaultProviders.text2image,
|
|
359
361
|
images: {},
|
package/lib/types/type.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type CallbackFunction } from "graphai";
|
|
2
|
-
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualArraySchema, mulmoStudioMultiLingualDataSchema, mulmoStudioMultiLingualFileSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoImageParamsImagesValueSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoMovieParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoPromptTemplateSchema, mulmoPromptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mediaSourceMermaidSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema } from "./schema.js";
|
|
2
|
+
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualArraySchema, mulmoStudioMultiLingualDataSchema, mulmoStudioMultiLingualFileSchema, speakerDictionarySchema, speakerSchema, mulmoSpeechParamsSchema, mulmoImageParamsSchema, mulmoImageParamsImagesValueSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoMovieParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoPromptTemplateSchema, mulmoPromptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mediaSourceMermaidSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema } from "./schema.js";
|
|
3
3
|
import { pdf_modes, pdf_sizes, storyToScriptGenerateMode } from "../utils/const.js";
|
|
4
4
|
import type { LLM } from "../utils/provider2agent.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
export type LANG = z.infer<typeof langSchema>;
|
|
7
7
|
export type MulmoBeat = z.infer<typeof mulmoBeatSchema>;
|
|
8
|
+
export type MulmoSpeechParams = z.infer<typeof mulmoSpeechParamsSchema>;
|
|
9
|
+
export type Speaker = z.infer<typeof speakerSchema>;
|
|
8
10
|
export type SpeakerDictonary = z.infer<typeof speakerDictionarySchema>;
|
|
9
11
|
export type SpeechOptions = z.infer<typeof speechOptionsSchema>;
|
|
10
12
|
export type SpeakerData = z.infer<typeof speakerDataSchema>;
|
|
@@ -62,6 +62,8 @@ export declare const translateAction = "translate";
|
|
|
62
62
|
export declare const audioFileTarget = "audioFile";
|
|
63
63
|
export declare const imageFileTarget = "imageFile";
|
|
64
64
|
export declare const movieFileTarget = "movieFile";
|
|
65
|
+
export declare const videoDurationTarget = "videoDuration";
|
|
66
|
+
export declare const unsupportedModelTarget = "unsupportedModel";
|
|
65
67
|
export declare const multiLingualFileTarget = "multiLingualFile";
|
|
66
68
|
export declare const videoSourceTarget = "videoSource";
|
|
67
69
|
export declare const audioSourceTarget = "audioSource";
|
package/lib/utils/error_cause.js
CHANGED
|
@@ -65,6 +65,8 @@ export const translateAction = "translate";
|
|
|
65
65
|
export const audioFileTarget = "audioFile";
|
|
66
66
|
export const imageFileTarget = "imageFile";
|
|
67
67
|
export const movieFileTarget = "movieFile";
|
|
68
|
+
export const videoDurationTarget = "videoDuration";
|
|
69
|
+
export const unsupportedModelTarget = "unsupportedModel";
|
|
68
70
|
export const multiLingualFileTarget = "multiLingualFile";
|
|
69
71
|
export const videoSourceTarget = "videoSource";
|
|
70
72
|
export const audioSourceTarget = "audioSource";
|
|
@@ -75,12 +75,21 @@ export declare const provider2MovieAgent: {
|
|
|
75
75
|
defaultModel: string;
|
|
76
76
|
models: string[];
|
|
77
77
|
keyName: string;
|
|
78
|
+
modelParams: {
|
|
79
|
+
"veo-3.0-generate-preview": {
|
|
80
|
+
durations: number[];
|
|
81
|
+
};
|
|
82
|
+
"veo-2.0-generate-001": {
|
|
83
|
+
durations: number[];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
78
86
|
};
|
|
79
87
|
mock: {
|
|
80
88
|
agentName: string;
|
|
81
89
|
defaultModel: string;
|
|
82
90
|
models: string[];
|
|
83
91
|
keyName: string;
|
|
92
|
+
modelParams: {};
|
|
84
93
|
};
|
|
85
94
|
};
|
|
86
95
|
export declare const provider2SoundEffectAgent: {
|
|
@@ -156,3 +165,4 @@ export declare const defaultProviders: {
|
|
|
156
165
|
export declare const llm: (keyof typeof provider2LLMAgent)[];
|
|
157
166
|
export type LLM = keyof typeof provider2LLMAgent;
|
|
158
167
|
export declare const htmlLLMProvider: string[];
|
|
168
|
+
export declare const getModelDuration: (provider: keyof typeof provider2MovieAgent, model: string, movieDuration?: number) => number | undefined;
|
|
@@ -161,12 +161,21 @@ export const provider2MovieAgent = {
|
|
|
161
161
|
defaultModel: "veo-2.0-generate-001",
|
|
162
162
|
models: ["veo-2.0-generate-001", "veo-3.0-generate-preview"],
|
|
163
163
|
keyName: "GEMINI_API_KEY",
|
|
164
|
+
modelParams: {
|
|
165
|
+
"veo-3.0-generate-preview": {
|
|
166
|
+
durations: [4, 6, 8],
|
|
167
|
+
},
|
|
168
|
+
"veo-2.0-generate-001": {
|
|
169
|
+
durations: [5, 6, 7, 8],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
164
172
|
},
|
|
165
173
|
mock: {
|
|
166
174
|
agentName: "mediaMockAgent",
|
|
167
175
|
defaultModel: "mock-model",
|
|
168
176
|
models: ["mock-model"],
|
|
169
177
|
keyName: "",
|
|
178
|
+
modelParams: {},
|
|
170
179
|
},
|
|
171
180
|
};
|
|
172
181
|
export const provider2SoundEffectAgent = {
|
|
@@ -282,3 +291,12 @@ export const defaultProviders = {
|
|
|
282
291
|
};
|
|
283
292
|
export const llm = Object.keys(provider2LLMAgent);
|
|
284
293
|
export const htmlLLMProvider = ["openai", "anthropic", "mock"];
|
|
294
|
+
export const getModelDuration = (provider, model, movieDuration) => {
|
|
295
|
+
const modelParams = provider2MovieAgent[provider]?.modelParams;
|
|
296
|
+
const { durations } = modelParams[model];
|
|
297
|
+
if (durations && movieDuration) {
|
|
298
|
+
const largerDurations = durations.filter((d) => d >= movieDuration);
|
|
299
|
+
return largerDurations.length > 0 ? largerDurations[0] : durations[durations.length - 1];
|
|
300
|
+
}
|
|
301
|
+
return durations?.[0];
|
|
302
|
+
};
|