mulmocast 0.1.7 → 1.1.1
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/assets/templates/akira_comic.json +1 -1
- package/assets/templates/ani.json +3 -3
- package/assets/templates/ani_ja.json +4 -5
- package/assets/templates/characters.json +1 -1
- package/assets/templates/children_book.json +1 -1
- package/assets/templates/comic_strips.json +1 -1
- package/assets/templates/drslump_comic.json +1 -1
- package/assets/templates/ghibli_comic.json +1 -1
- package/assets/templates/ghibli_image_only.json +1 -1
- package/assets/templates/ghibli_shorts.json +2 -3
- package/assets/templates/ghost_comic.json +1 -1
- package/assets/templates/onepiece_comic.json +1 -1
- package/assets/templates/portrait_movie.json +1 -1
- package/assets/templates/realistic_movie.json +1 -1
- package/assets/templates/sensei_and_taro.json +4 -5
- package/assets/templates/shorts.json +1 -1
- package/assets/templates/trailer.json +1 -1
- package/lib/actions/audio.js +6 -7
- package/lib/actions/image_agents.d.ts +46 -76
- package/lib/actions/image_agents.js +18 -3
- package/lib/actions/images.js +65 -4
- package/lib/actions/movie.js +3 -2
- package/lib/agents/index.d.ts +3 -1
- package/lib/agents/index.js +3 -1
- package/lib/agents/lipsync_replicate_agent.d.ts +5 -0
- package/lib/agents/lipsync_replicate_agent.js +57 -0
- package/lib/agents/movie_replicate_agent.js +17 -5
- package/lib/agents/sound_effect_replicate_agent.d.ts +5 -0
- package/lib/agents/sound_effect_replicate_agent.js +59 -0
- package/lib/data/index.d.ts +2 -0
- package/lib/data/index.js +2 -0
- package/lib/data/promptTemplates.d.ts +695 -0
- package/lib/data/promptTemplates.js +957 -0
- package/lib/data/scriptTemplates.d.ts +233 -0
- package/lib/data/scriptTemplates.js +580 -0
- package/lib/index.browser.d.ts +2 -1
- package/lib/index.browser.js +2 -1
- package/lib/mcp/server.js +2 -2
- package/lib/methods/index.d.ts +1 -0
- package/lib/methods/index.js +1 -0
- package/lib/methods/mulmo_presentation_style.d.ts +18 -5
- package/lib/methods/mulmo_presentation_style.js +31 -20
- package/lib/methods/mulmo_script.d.ts +4 -0
- package/lib/methods/mulmo_script.js +31 -0
- package/lib/tools/story_to_script.js +2 -2
- package/lib/types/agent.d.ts +19 -0
- package/lib/types/schema.d.ts +628 -246
- package/lib/types/schema.js +31 -12
- package/lib/types/type.d.ts +2 -3
- package/lib/utils/assets.d.ts +18 -0
- package/lib/utils/assets.js +101 -0
- package/lib/utils/context.d.ts +40 -12
- package/lib/utils/context.js +3 -1
- package/lib/utils/file.d.ts +12 -4
- package/lib/utils/file.js +48 -24
- package/lib/utils/preprocess.d.ts +30 -11
- package/lib/utils/preprocess.js +7 -5
- package/lib/utils/provider2agent.d.ts +30 -1
- package/lib/utils/provider2agent.js +86 -0
- package/lib/utils/utils.js +6 -0
- package/package.json +8 -4
- package/scripts/templates/business.json +1 -1
- package/scripts/templates/children_book.json +1 -1
- package/scripts/templates/coding.json +1 -1
- package/scripts/templates/html.json +1 -1
- package/scripts/templates/image_prompt_only_template.json +1 -1
- package/scripts/templates/image_prompts_template.json +1 -1
- package/scripts/templates/image_refs.json +1 -1
- package/scripts/templates/movie_prompts_no_text_template.json +1 -1
- package/scripts/templates/movie_prompts_template.json +1 -1
- package/scripts/templates/presentation.json +1 -1
- package/scripts/templates/sensei_and_taro.json +1 -1
- package/scripts/templates/shorts_template.json +1 -1
- package/scripts/templates/text_only_template.json +1 -1
- package/scripts/templates/voice_over.json +1 -1
package/lib/types/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { htmlLLMProvider, provider2TTSAgent, provider2ImageAgent, provider2MovieAgent, defaultProviders } from "../utils/provider2agent.js";
|
|
2
|
+
import { htmlLLMProvider, provider2TTSAgent, provider2ImageAgent, provider2MovieAgent, defaultProviders, provider2SoundEffectAgent, } from "../utils/provider2agent.js";
|
|
3
3
|
export const langSchema = z.string();
|
|
4
4
|
const URLStringSchema = z.string().url();
|
|
5
5
|
export const localizedTextSchema = z
|
|
@@ -26,6 +26,7 @@ export const speakerDataSchema = z
|
|
|
26
26
|
.object({
|
|
27
27
|
displayName: z.record(langSchema, z.string()).optional(),
|
|
28
28
|
voiceId: z.string(),
|
|
29
|
+
isDefault: z.boolean().optional(),
|
|
29
30
|
speechOptions: speechOptionsSchema.optional(),
|
|
30
31
|
provider: text2SpeechProviderSchema.optional(),
|
|
31
32
|
model: z.string().optional().describe("TTS model to use for this speaker"),
|
|
@@ -227,10 +228,18 @@ export const htmlPromptParamsSchema = z
|
|
|
227
228
|
})
|
|
228
229
|
.strict();
|
|
229
230
|
export const text2MovieProviderSchema = z.enum(Object.keys(provider2MovieAgent)).default(defaultProviders.text2movie);
|
|
230
|
-
const
|
|
231
|
+
export const text2SoundEffectProviderSchema = z.enum(Object.keys(provider2SoundEffectAgent)).default(defaultProviders.soundEffect);
|
|
232
|
+
export const mulmoSoundEffectParamsSchema = z.object({
|
|
233
|
+
provider: text2SoundEffectProviderSchema.optional(),
|
|
234
|
+
model: z.string().optional(), // default: provider specific
|
|
235
|
+
});
|
|
236
|
+
export const mulmoLipSyncParamsSchema = z.object({
|
|
237
|
+
provider: z.string().optional(), // lip sync provider
|
|
238
|
+
model: z.string().optional(), // default: provider specific
|
|
239
|
+
});
|
|
231
240
|
export const mulmoBeatSchema = z
|
|
232
241
|
.object({
|
|
233
|
-
speaker: speakerIdSchema.
|
|
242
|
+
speaker: speakerIdSchema.optional(),
|
|
234
243
|
text: z.string().default("").describe("Text to be spoken. If empty, the audio is not generated."),
|
|
235
244
|
id: z.string().optional().describe("Unique identifier for the beat."),
|
|
236
245
|
description: z.string().optional(),
|
|
@@ -247,6 +256,8 @@ export const mulmoBeatSchema = z
|
|
|
247
256
|
speed: z.number().optional().describe("Speed of the video. 1.0 is normal speed. 0.5 is half speed. 2.0 is double speed."), // for movie.ts
|
|
248
257
|
})
|
|
249
258
|
.optional(),
|
|
259
|
+
soundEffectParams: mulmoSoundEffectParamsSchema.optional(),
|
|
260
|
+
lipSyncParams: mulmoLipSyncParamsSchema.optional(),
|
|
250
261
|
htmlImageParams: mulmoHtmlImageParamsSchema.optional(),
|
|
251
262
|
speechOptions: speechOptionsSchema.optional(),
|
|
252
263
|
textSlideParams: textSlideParamsSchema.optional(),
|
|
@@ -254,7 +265,9 @@ export const mulmoBeatSchema = z
|
|
|
254
265
|
imageNames: z.array(imageIdSchema).optional(), // list of image names to use for image generation. The default is all images in the imageParams.images.
|
|
255
266
|
imagePrompt: z.string().optional(),
|
|
256
267
|
moviePrompt: z.string().optional(),
|
|
268
|
+
soundEffectPrompt: z.string().optional(),
|
|
257
269
|
htmlPrompt: htmlPromptParamsSchema.optional(),
|
|
270
|
+
enableLipSync: z.boolean().optional().describe("Enable lip sync generation for this beat"),
|
|
258
271
|
})
|
|
259
272
|
.strict();
|
|
260
273
|
export const mulmoCanvasDimensionSchema = z
|
|
@@ -266,17 +279,10 @@ export const mulmoCanvasDimensionSchema = z
|
|
|
266
279
|
// export const voiceMapSchema = z.record(speakerIdSchema, z.string())
|
|
267
280
|
export const mulmoCastCreditSchema = z
|
|
268
281
|
.object({
|
|
269
|
-
version: z.literal("1.
|
|
282
|
+
version: z.literal("1.1"),
|
|
270
283
|
credit: z.literal("closing").optional(),
|
|
271
284
|
})
|
|
272
285
|
.strict();
|
|
273
|
-
export const mulmoSpeechParamsSchema = z
|
|
274
|
-
.object({
|
|
275
|
-
provider: text2SpeechProviderSchema, // has default value
|
|
276
|
-
speakers: speakerDictionarySchema,
|
|
277
|
-
model: z.string().optional().describe("Default TTS model to use"),
|
|
278
|
-
})
|
|
279
|
-
.strict();
|
|
280
286
|
export const text2HtmlImageProviderSchema = z.enum(htmlLLMProvider).default(defaultProviders.text2Html);
|
|
281
287
|
// NOTE: This is UI only. (until we figure out how to use it in mulmoMovieParamsSchema)
|
|
282
288
|
export const mulmoGoogleMovieModelSchema = z
|
|
@@ -304,10 +310,15 @@ export const mulmoMovieParamsSchema = z
|
|
|
304
310
|
fillOption: mulmoFillOptionSchema.optional(), // for movie.ts
|
|
305
311
|
})
|
|
306
312
|
.strict();
|
|
313
|
+
const defaultSpeaker = "Presenter";
|
|
307
314
|
export const mulmoPresentationStyleSchema = z.object({
|
|
308
315
|
$mulmocast: mulmoCastCreditSchema,
|
|
309
316
|
canvasSize: mulmoCanvasDimensionSchema, // has default value
|
|
310
|
-
speechParams:
|
|
317
|
+
speechParams: z
|
|
318
|
+
.object({
|
|
319
|
+
speakers: speakerDictionarySchema,
|
|
320
|
+
})
|
|
321
|
+
.default({
|
|
311
322
|
speakers: {
|
|
312
323
|
[defaultSpeaker]: {
|
|
313
324
|
voiceId: "shimmer",
|
|
@@ -324,6 +335,10 @@ export const mulmoPresentationStyleSchema = z.object({
|
|
|
324
335
|
movieParams: mulmoMovieParamsSchema.optional().default({
|
|
325
336
|
provider: defaultProviders.text2movie,
|
|
326
337
|
}),
|
|
338
|
+
soundEffectParams: mulmoSoundEffectParamsSchema.optional().default({
|
|
339
|
+
provider: defaultProviders.soundEffect,
|
|
340
|
+
}),
|
|
341
|
+
lipSyncParams: mulmoLipSyncParamsSchema.optional(),
|
|
327
342
|
htmlImageParams: mulmoHtmlImageParamsSchema
|
|
328
343
|
.extend({
|
|
329
344
|
provider: text2HtmlImageProviderSchema,
|
|
@@ -372,6 +387,8 @@ export const mulmoStudioBeatSchema = z
|
|
|
372
387
|
audioFile: z.string().optional(),
|
|
373
388
|
imageFile: z.string().optional(), // path to the image
|
|
374
389
|
movieFile: z.string().optional(), // path to the movie file
|
|
390
|
+
soundEffectFile: z.string().optional(), // path to the sound effect file
|
|
391
|
+
lipSyncFile: z.string().optional(), // path to the lip sync file
|
|
375
392
|
captionFile: z.string().optional(), // path to the caption image
|
|
376
393
|
})
|
|
377
394
|
.strict();
|
|
@@ -396,6 +413,8 @@ export const mulmoSessionStateSchema = z.object({
|
|
|
396
413
|
caption: z.record(z.number().int(), z.boolean()),
|
|
397
414
|
html: z.record(z.number().int(), z.boolean()),
|
|
398
415
|
imageReference: z.record(z.number().int(), z.boolean()),
|
|
416
|
+
soundEffect: z.record(z.number().int(), z.boolean()),
|
|
417
|
+
lipSync: z.record(z.number().int(), z.boolean()),
|
|
399
418
|
}),
|
|
400
419
|
});
|
|
401
420
|
export const mulmoStudioSchema = z
|
package/lib/types/type.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualDataSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoMovieParamsSchema,
|
|
1
|
+
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualDataSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoImageParamsImagesSchema, mulmoFillOptionSchema, mulmoMovieParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoScriptTemplateSchema, mulmoScriptTemplateFileSchema, text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoImageAssetSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mulmoSessionStateSchema, mulmoOpenAIImageModelSchema, mulmoGoogleImageModelSchema, mulmoGoogleMovieModelSchema, mulmoReplicateMovieModelSchema, mulmoImagePromptMediaSchema } from "./schema.js";
|
|
2
2
|
import { pdf_modes, pdf_sizes, storyToScriptGenerateMode } from "../utils/const.js";
|
|
3
3
|
import type { LLM } from "../utils/provider2agent.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
export type LANG = z.infer<typeof langSchema>;
|
|
6
6
|
export type MulmoBeat = z.infer<typeof mulmoBeatSchema>;
|
|
7
7
|
export type SpeakerDictonary = z.infer<typeof speakerDictionarySchema>;
|
|
8
|
-
export type MulmoSpeechParams = z.infer<typeof mulmoSpeechParamsSchema>;
|
|
9
8
|
export type SpeechOptions = z.infer<typeof speechOptionsSchema>;
|
|
10
9
|
export type SpeakerData = z.infer<typeof speakerDataSchema>;
|
|
11
10
|
export type MulmoImageParams = z.infer<typeof mulmoImageParamsSchema>;
|
|
@@ -92,7 +91,7 @@ export type Text2HtmlAgentInfo = {
|
|
|
92
91
|
export type BeatMediaType = "movie" | "image";
|
|
93
92
|
export type StoryToScriptGenerateMode = (typeof storyToScriptGenerateMode)[keyof typeof storyToScriptGenerateMode];
|
|
94
93
|
export type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf";
|
|
95
|
-
export type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie" | "html" | "imageReference";
|
|
94
|
+
export type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie" | "html" | "imageReference" | "soundEffect" | "lipSync";
|
|
96
95
|
export type SessionProgressEvent = {
|
|
97
96
|
kind: "session";
|
|
98
97
|
sessionType: SessionType;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type BgmAsset = {
|
|
2
|
+
name: string;
|
|
3
|
+
title: string;
|
|
4
|
+
url: string;
|
|
5
|
+
suno_url: string;
|
|
6
|
+
date: string;
|
|
7
|
+
duration: string;
|
|
8
|
+
account: string;
|
|
9
|
+
original_license: string;
|
|
10
|
+
prompt: string;
|
|
11
|
+
model: string;
|
|
12
|
+
};
|
|
13
|
+
export type BgmAssets = {
|
|
14
|
+
license: string;
|
|
15
|
+
bgms: BgmAsset[];
|
|
16
|
+
};
|
|
17
|
+
export declare const bgmAssets: BgmAssets;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const bgmAssets = {
|
|
2
|
+
license: "Free to distribute as the BMG of media generated by MulmoCast, including commercial use.",
|
|
3
|
+
bgms: [
|
|
4
|
+
{
|
|
5
|
+
name: "story001.mp3",
|
|
6
|
+
title: "Whispered Melody",
|
|
7
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story001.mp3",
|
|
8
|
+
suno_url: "https://suno.com/s/v6zer50aQJu8Y0qA",
|
|
9
|
+
date: "2025-06-17",
|
|
10
|
+
duration: "03:17",
|
|
11
|
+
account: "@snakajima",
|
|
12
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
13
|
+
prompt: "instrumental, smooth, piano",
|
|
14
|
+
model: "v4.5 beta",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "story002.mp3",
|
|
18
|
+
title: "Rise and Shine",
|
|
19
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story002.mp3",
|
|
20
|
+
suno_url: "https://suno.com/s/mJnvyu3UXnkdAPfQ",
|
|
21
|
+
date: "2025-06-17",
|
|
22
|
+
duration: "04:04",
|
|
23
|
+
account: "@snakajima",
|
|
24
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
25
|
+
prompt: "techno, inspiring, piano",
|
|
26
|
+
model: "v4.5 beta",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "story003.mp3",
|
|
30
|
+
title: "Chasing the Sunset",
|
|
31
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story003.mp3",
|
|
32
|
+
suno_url: "https://suno.com/s/2zGjMQ9vURJbaMZA",
|
|
33
|
+
date: "2025-06-17",
|
|
34
|
+
duration: "02:49",
|
|
35
|
+
account: "@snakajima",
|
|
36
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
37
|
+
prompt: "piano, inspiring, sunset",
|
|
38
|
+
model: "v4.5 beta",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "story004.mp3",
|
|
42
|
+
title: "Whispering Keys",
|
|
43
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story004.mp3",
|
|
44
|
+
suno_url: "https://suno.com/s/0SFoBRsBWsncw6tu",
|
|
45
|
+
date: "2025-06-17",
|
|
46
|
+
duration: "04:00",
|
|
47
|
+
account: "@snakajima",
|
|
48
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
49
|
+
prompt: "Piano, classical, ambient",
|
|
50
|
+
model: "v4",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "story005.mp3",
|
|
54
|
+
title: "Whisper of Ivory",
|
|
55
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story005.mp3",
|
|
56
|
+
suno_url: "https://suno.com/s/0SFoBRsBWsncw6tu",
|
|
57
|
+
date: "2025-06-17",
|
|
58
|
+
duration: "04:00",
|
|
59
|
+
account: "@snakajima",
|
|
60
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
61
|
+
prompt: "Piano solo, classical, ambient",
|
|
62
|
+
model: "v4",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "theme001.mp3",
|
|
66
|
+
title: "Rise of the Flame",
|
|
67
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/theme001.mp3",
|
|
68
|
+
suno_url: "https://suno.com/s/WhYOf8oJYhBgSKET",
|
|
69
|
+
date: "2025-06-20",
|
|
70
|
+
duration: "03:23",
|
|
71
|
+
account: "@snakajima",
|
|
72
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
73
|
+
prompt: "Olympic Theme, classical, emotional",
|
|
74
|
+
model: "v4",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "olympic001.mp3",
|
|
78
|
+
title: "Olympic-style Theme Music",
|
|
79
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/olympic001.mp3",
|
|
80
|
+
suno_url: "https://suno.com/s/32wpnmCrkFVvkTSQ",
|
|
81
|
+
date: "2025-07-17",
|
|
82
|
+
duration: "02:54",
|
|
83
|
+
account: "@snakajima",
|
|
84
|
+
original_license: "Generated by Suno with commercial use rights (PRO Plan)",
|
|
85
|
+
prompt: "Epic orchestral fanfare in the style of John Williams' Olympic Fanfare and Theme. Bright brass fanfare, soaring strings, powerful percussion, and heroic French horn melodies. Triumphant and majestic mood, suitable for an opening ceremony or national celebration. Emphasize dynamic builds, rich harmonies, and cinematic grandeur.",
|
|
86
|
+
model: "v4.5+",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "morning001.mp3",
|
|
90
|
+
title: "Morning Dance",
|
|
91
|
+
url: "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/morning001.mp3",
|
|
92
|
+
suno_url: "https://suno.com/s/9MTkutZYqxeyBlwK",
|
|
93
|
+
date: "2025-07-17",
|
|
94
|
+
duration: "03:52",
|
|
95
|
+
account: "@snakajima",
|
|
96
|
+
original_license: "morning, piano solo, Japanese name, sexy",
|
|
97
|
+
prompt: "morning, piano solo, Japanese name, sexy",
|
|
98
|
+
model: "v4.5+",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
package/lib/utils/context.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
16
16
|
audioFile?: string | undefined;
|
|
17
17
|
imageFile?: string | undefined;
|
|
18
18
|
movieFile?: string | undefined;
|
|
19
|
+
soundEffectFile?: string | undefined;
|
|
20
|
+
lipSyncFile?: string | undefined;
|
|
19
21
|
captionFile?: string | undefined;
|
|
20
22
|
}[];
|
|
21
23
|
script: {
|
|
@@ -77,8 +79,12 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
77
79
|
duration: number;
|
|
78
80
|
} | undefined;
|
|
79
81
|
};
|
|
82
|
+
soundEffectParams: {
|
|
83
|
+
provider?: string | undefined;
|
|
84
|
+
model?: string | undefined;
|
|
85
|
+
};
|
|
80
86
|
$mulmocast: {
|
|
81
|
-
version: "1.
|
|
87
|
+
version: "1.1";
|
|
82
88
|
credit?: "closing" | undefined;
|
|
83
89
|
};
|
|
84
90
|
canvasSize: {
|
|
@@ -86,10 +92,10 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
86
92
|
height: number;
|
|
87
93
|
};
|
|
88
94
|
speechParams: {
|
|
89
|
-
provider: string;
|
|
90
95
|
speakers: Record<string, {
|
|
91
96
|
voiceId: string;
|
|
92
97
|
displayName?: Record<string, string> | undefined;
|
|
98
|
+
isDefault?: boolean | undefined;
|
|
93
99
|
speechOptions?: {
|
|
94
100
|
speed?: number | undefined;
|
|
95
101
|
instruction?: string | undefined;
|
|
@@ -97,16 +103,9 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
97
103
|
provider?: string | undefined;
|
|
98
104
|
model?: string | undefined;
|
|
99
105
|
}>;
|
|
100
|
-
model?: string | undefined;
|
|
101
106
|
};
|
|
102
107
|
beats: {
|
|
103
108
|
text: string;
|
|
104
|
-
speaker: string;
|
|
105
|
-
duration?: number | undefined;
|
|
106
|
-
speechOptions?: {
|
|
107
|
-
speed?: number | undefined;
|
|
108
|
-
instruction?: string | undefined;
|
|
109
|
-
} | undefined;
|
|
110
109
|
image?: {
|
|
111
110
|
type: "markdown";
|
|
112
111
|
markdown: string | string[];
|
|
@@ -211,6 +210,11 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
211
210
|
type: "voice_over";
|
|
212
211
|
startAt?: number | undefined;
|
|
213
212
|
} | undefined;
|
|
213
|
+
duration?: number | undefined;
|
|
214
|
+
speechOptions?: {
|
|
215
|
+
speed?: number | undefined;
|
|
216
|
+
instruction?: string | undefined;
|
|
217
|
+
} | undefined;
|
|
214
218
|
id?: string | undefined;
|
|
215
219
|
audio?: {
|
|
216
220
|
type: "audio";
|
|
@@ -232,6 +236,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
232
236
|
source: string;
|
|
233
237
|
} | undefined;
|
|
234
238
|
imagePrompt?: string | undefined;
|
|
239
|
+
speaker?: string | undefined;
|
|
235
240
|
description?: string | undefined;
|
|
236
241
|
imageParams?: {
|
|
237
242
|
provider: string;
|
|
@@ -270,6 +275,14 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
270
275
|
style: "aspectFit" | "aspectFill";
|
|
271
276
|
} | undefined;
|
|
272
277
|
} | undefined;
|
|
278
|
+
soundEffectParams?: {
|
|
279
|
+
provider?: string | undefined;
|
|
280
|
+
model?: string | undefined;
|
|
281
|
+
} | undefined;
|
|
282
|
+
lipSyncParams?: {
|
|
283
|
+
provider?: string | undefined;
|
|
284
|
+
model?: string | undefined;
|
|
285
|
+
} | undefined;
|
|
273
286
|
htmlImageParams?: {
|
|
274
287
|
model?: string | undefined;
|
|
275
288
|
} | undefined;
|
|
@@ -282,16 +295,22 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
282
295
|
} | undefined;
|
|
283
296
|
imageNames?: string[] | undefined;
|
|
284
297
|
moviePrompt?: string | undefined;
|
|
298
|
+
soundEffectPrompt?: string | undefined;
|
|
285
299
|
htmlPrompt?: {
|
|
286
300
|
prompt: string;
|
|
287
301
|
data?: any;
|
|
288
302
|
images?: Record<string, any> | undefined;
|
|
289
303
|
systemPrompt?: string | undefined;
|
|
290
304
|
} | undefined;
|
|
305
|
+
enableLipSync?: boolean | undefined;
|
|
291
306
|
}[];
|
|
292
307
|
lang?: string | undefined;
|
|
293
308
|
title?: string | undefined;
|
|
294
309
|
description?: string | undefined;
|
|
310
|
+
lipSyncParams?: {
|
|
311
|
+
provider?: string | undefined;
|
|
312
|
+
model?: string | undefined;
|
|
313
|
+
} | undefined;
|
|
295
314
|
htmlImageParams?: {
|
|
296
315
|
provider: string;
|
|
297
316
|
model?: string | undefined;
|
|
@@ -334,6 +353,8 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
334
353
|
caption: {};
|
|
335
354
|
html: {};
|
|
336
355
|
imageReference: {};
|
|
356
|
+
soundEffect: {};
|
|
357
|
+
lipSync: {};
|
|
337
358
|
};
|
|
338
359
|
};
|
|
339
360
|
presentationStyle: {
|
|
@@ -395,8 +416,12 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
395
416
|
duration: number;
|
|
396
417
|
} | undefined;
|
|
397
418
|
};
|
|
419
|
+
soundEffectParams: {
|
|
420
|
+
provider?: string | undefined;
|
|
421
|
+
model?: string | undefined;
|
|
422
|
+
};
|
|
398
423
|
$mulmocast: {
|
|
399
|
-
version: "1.
|
|
424
|
+
version: "1.1";
|
|
400
425
|
credit?: "closing" | undefined;
|
|
401
426
|
};
|
|
402
427
|
canvasSize: {
|
|
@@ -404,10 +429,10 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
404
429
|
height: number;
|
|
405
430
|
};
|
|
406
431
|
speechParams: {
|
|
407
|
-
provider: string;
|
|
408
432
|
speakers: Record<string, {
|
|
409
433
|
voiceId: string;
|
|
410
434
|
displayName?: Record<string, string> | undefined;
|
|
435
|
+
isDefault?: boolean | undefined;
|
|
411
436
|
speechOptions?: {
|
|
412
437
|
speed?: number | undefined;
|
|
413
438
|
instruction?: string | undefined;
|
|
@@ -415,8 +440,11 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
415
440
|
provider?: string | undefined;
|
|
416
441
|
model?: string | undefined;
|
|
417
442
|
}>;
|
|
418
|
-
model?: string | undefined;
|
|
419
443
|
};
|
|
444
|
+
lipSyncParams?: {
|
|
445
|
+
provider?: string | undefined;
|
|
446
|
+
model?: string | undefined;
|
|
447
|
+
} | undefined;
|
|
420
448
|
htmlImageParams?: {
|
|
421
449
|
provider: string;
|
|
422
450
|
model?: string | undefined;
|
package/lib/utils/context.js
CHANGED
|
@@ -58,6 +58,8 @@ const initSessionState = () => {
|
|
|
58
58
|
caption: {},
|
|
59
59
|
html: {},
|
|
60
60
|
imageReference: {},
|
|
61
|
+
soundEffect: {},
|
|
62
|
+
lipSync: {},
|
|
61
63
|
},
|
|
62
64
|
};
|
|
63
65
|
};
|
|
@@ -84,7 +86,7 @@ export const initializeContextFromFiles = async (files, raiseError, force, capti
|
|
|
84
86
|
const currentStudio = readMulmoScriptFile(outputStudioFilePath);
|
|
85
87
|
try {
|
|
86
88
|
// validate mulmoStudioSchema. skip if __test_invalid__ is true
|
|
87
|
-
const studio = createOrUpdateStudioData(mulmoScript, currentStudio?.mulmoData, fileName, caption);
|
|
89
|
+
const studio = createOrUpdateStudioData(mulmoScript, currentStudio?.mulmoData, fileName, caption, presentationStyle);
|
|
88
90
|
const multiLingual = getMultiLingual(outputMultilingualFilePath, studio.beats.length);
|
|
89
91
|
return buildContext(studio, files, presentationStyle, multiLingual, force, lang);
|
|
90
92
|
}
|
package/lib/utils/file.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MulmoScript, MulmoScriptTemplateFile, MulmoStudioContext } from "../types/index.js";
|
|
2
2
|
import { PDFMode } from "../types/index.js";
|
|
3
|
-
import { ZodSchema } from "zod";
|
|
3
|
+
import { ZodSchema, ZodType } from "zod";
|
|
4
4
|
export declare const updateNpmRoot: (_npmRoot: string) => void;
|
|
5
5
|
export declare function readMulmoScriptFile<T = MulmoScript>(path: string, errorMessage: string): {
|
|
6
6
|
mulmoData: T;
|
|
@@ -25,11 +25,15 @@ export declare const getAudioArtifactFilePath: (outDirPath: string, fileName: st
|
|
|
25
25
|
export declare const getOutputVideoFilePath: (outDirPath: string, fileName: string, lang?: string, caption?: string) => string;
|
|
26
26
|
export declare const imageSuffix = "p";
|
|
27
27
|
export declare const getBeatPngImagePath: (context: MulmoStudioContext, index: number) => string;
|
|
28
|
-
export declare const
|
|
28
|
+
export declare const getBeatMoviePaths: (context: MulmoStudioContext, index: number) => {
|
|
29
|
+
movieFile: string;
|
|
30
|
+
soundEffectFile: string;
|
|
31
|
+
lipSyncFile: string;
|
|
32
|
+
};
|
|
29
33
|
export declare const getReferenceImagePath: (context: MulmoStudioContext, key: string, extension: string) => string;
|
|
30
34
|
export declare const getCaptionImagePath: (context: MulmoStudioContext, index: number) => string;
|
|
31
35
|
export declare const getOutputPdfFilePath: (outDirPath: string, fileName: string, pdfMode: PDFMode, lang?: string) => string;
|
|
32
|
-
export declare const
|
|
36
|
+
export declare const getPromptTemplateFilePath: (promptTemplateName: string) => string;
|
|
33
37
|
export declare const mkdir: (dirPath: string) => void;
|
|
34
38
|
export declare const silent60secPath: () => string;
|
|
35
39
|
export declare const defaultBGMPath: () => string;
|
|
@@ -37,8 +41,12 @@ export declare const getHTMLFile: (filename: string) => string;
|
|
|
37
41
|
export declare const getBaseDirPath: (basedir?: string) => string;
|
|
38
42
|
export declare const getFullPath: (baseDirPath: string | undefined, file: string) => string;
|
|
39
43
|
export declare const readScriptTemplateFile: (scriptName: string) => any;
|
|
40
|
-
export declare const
|
|
44
|
+
export declare const getScriptFromPromptTemplate: (promptTemplateName: string) => any;
|
|
45
|
+
export declare const readTemplatePrompt: (promptTemplateName: string) => string;
|
|
41
46
|
export declare const getAvailableTemplates: () => MulmoScriptTemplateFile[];
|
|
47
|
+
export declare const getAvailablePromptTemplates: () => MulmoScriptTemplateFile[];
|
|
48
|
+
export declare const getAvailableScriptTemplates: () => MulmoScriptTemplateFile[];
|
|
49
|
+
export declare const getPromptTemplates: <T>(dirPath: string, schema: ZodType) => T[];
|
|
42
50
|
export declare const writingMessage: (filePath: string) => void;
|
|
43
51
|
export declare const readAndParseJson: <S extends ZodSchema<any>>(filePath: string, schema: S) => ReturnType<S["parse"]>;
|
|
44
52
|
export declare const generateTimestampedFileName: (prefix: string) => string;
|
package/lib/utils/file.js
CHANGED
|
@@ -4,7 +4,9 @@ import { parse as yamlParse } from "yaml";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { GraphAILogger } from "graphai";
|
|
6
6
|
import { MulmoScriptTemplateMethods, MulmoStudioContextMethods } from "../methods/index.js";
|
|
7
|
-
import { mulmoScriptTemplateSchema } from "../types/schema.js";
|
|
7
|
+
import { mulmoScriptTemplateSchema, mulmoPresentationStyleSchema } from "../types/schema.js";
|
|
8
|
+
const promptTemplateDirName = "./assets/templates";
|
|
9
|
+
const scriptTemplateDirName = "./scripts/templates";
|
|
8
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
11
|
const __dirname = path.dirname(__filename);
|
|
10
12
|
let npmRoot = path.resolve(__dirname, "../../");
|
|
@@ -87,13 +89,15 @@ export const getBeatPngImagePath = (context, index) => {
|
|
|
87
89
|
}
|
|
88
90
|
return `${imageProjectDirPath}/${index}${imageSuffix}.png`;
|
|
89
91
|
};
|
|
90
|
-
export const
|
|
92
|
+
export const getBeatMoviePaths = (context, index) => {
|
|
91
93
|
const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
|
|
92
94
|
const beat = context.studio.script.beats[index]; // beat could be undefined only in a test case.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
const filename = beat?.id ? `${beat.id}` : `${index}`;
|
|
96
|
+
return {
|
|
97
|
+
movieFile: `${imageProjectDirPath}/${filename}.mov`,
|
|
98
|
+
soundEffectFile: `${imageProjectDirPath}/${filename}_sound.mov`,
|
|
99
|
+
lipSyncFile: `${imageProjectDirPath}/${filename}_lipsync.mov`,
|
|
100
|
+
};
|
|
97
101
|
};
|
|
98
102
|
export const getReferenceImagePath = (context, key, extension) => {
|
|
99
103
|
const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
|
|
@@ -110,8 +114,8 @@ export const getOutputPdfFilePath = (outDirPath, fileName, pdfMode, lang) => {
|
|
|
110
114
|
}
|
|
111
115
|
return path.resolve(outDirPath, `${fileName}_${pdfMode}.pdf`);
|
|
112
116
|
};
|
|
113
|
-
export const
|
|
114
|
-
return path.resolve(npmRoot,
|
|
117
|
+
export const getPromptTemplateFilePath = (promptTemplateName) => {
|
|
118
|
+
return path.resolve(npmRoot, promptTemplateDirName, promptTemplateName + ".json");
|
|
115
119
|
};
|
|
116
120
|
export const mkdir = (dirPath) => {
|
|
117
121
|
if (!fs.existsSync(dirPath)) {
|
|
@@ -147,36 +151,56 @@ export const getFullPath = (baseDirPath, file) => {
|
|
|
147
151
|
return path.resolve(file);
|
|
148
152
|
};
|
|
149
153
|
export const readScriptTemplateFile = (scriptName) => {
|
|
150
|
-
const scriptPath = path.resolve(npmRoot,
|
|
154
|
+
const scriptPath = path.resolve(npmRoot, scriptTemplateDirName, scriptName);
|
|
151
155
|
const scriptData = fs.readFileSync(scriptPath, "utf-8");
|
|
152
156
|
// NOTE: We don't want to schema parse the script here to eliminate default values.
|
|
153
157
|
return JSON.parse(scriptData);
|
|
154
158
|
};
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
const
|
|
159
|
+
const readPromptTemplateFile = (promptTemplateName) => {
|
|
160
|
+
const promptTemplatePath = getPromptTemplateFilePath(promptTemplateName);
|
|
161
|
+
const promptTemplateData = fs.readFileSync(promptTemplatePath, "utf-8");
|
|
158
162
|
// NOTE: We don't want to schema parse the template here to eliminate default values.
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return
|
|
166
|
-
}
|
|
167
|
-
|
|
163
|
+
const promptTemplate = JSON.parse(promptTemplateData);
|
|
164
|
+
return promptTemplate;
|
|
165
|
+
};
|
|
166
|
+
const mulmoScriptTemplate2Script = (scriptTemplate) => {
|
|
167
|
+
if (scriptTemplate.scriptName) {
|
|
168
|
+
const scriptData = readScriptTemplateFile(scriptTemplate.scriptName);
|
|
169
|
+
return { ...scriptData, ...(scriptTemplate.presentationStyle ?? {}) };
|
|
170
|
+
}
|
|
171
|
+
return undefined;
|
|
172
|
+
};
|
|
173
|
+
export const getScriptFromPromptTemplate = (promptTemplateName) => {
|
|
174
|
+
const promptTemplate = readPromptTemplateFile(promptTemplateName);
|
|
175
|
+
return mulmoScriptTemplate2Script(promptTemplate);
|
|
176
|
+
};
|
|
177
|
+
export const readTemplatePrompt = (promptTemplateName) => {
|
|
178
|
+
const promptTemplate = readPromptTemplateFile(promptTemplateName);
|
|
179
|
+
const script = mulmoScriptTemplate2Script(promptTemplate);
|
|
180
|
+
const prompt = MulmoScriptTemplateMethods.getSystemPrompt(promptTemplate, script);
|
|
168
181
|
return prompt;
|
|
169
182
|
};
|
|
183
|
+
// TODO: MulmoScriptTemplateFileは、実際はpromptTempate
|
|
184
|
+
// TODO: remove it after update app
|
|
170
185
|
export const getAvailableTemplates = () => {
|
|
171
|
-
|
|
186
|
+
return getAvailablePromptTemplates();
|
|
187
|
+
};
|
|
188
|
+
export const getAvailablePromptTemplates = () => {
|
|
189
|
+
return getPromptTemplates(promptTemplateDirName, mulmoScriptTemplateSchema);
|
|
190
|
+
};
|
|
191
|
+
export const getAvailableScriptTemplates = () => {
|
|
192
|
+
return getPromptTemplates(scriptTemplateDirName, mulmoPresentationStyleSchema);
|
|
193
|
+
};
|
|
194
|
+
export const getPromptTemplates = (dirPath, schema) => {
|
|
195
|
+
const templatesDir = path.resolve(npmRoot, dirPath);
|
|
172
196
|
if (!fs.existsSync(templatesDir)) {
|
|
173
197
|
return [];
|
|
174
198
|
}
|
|
175
199
|
const files = fs.readdirSync(templatesDir);
|
|
176
200
|
return files.map((file) => {
|
|
177
|
-
const
|
|
201
|
+
const promptTemplate = JSON.parse(fs.readFileSync(path.resolve(templatesDir, file), "utf-8"));
|
|
178
202
|
return {
|
|
179
|
-
...
|
|
203
|
+
...schema.parse(promptTemplate),
|
|
180
204
|
filename: file.replace(/\.json$/, ""),
|
|
181
205
|
};
|
|
182
206
|
});
|