mulmocast 0.0.15 → 0.0.17
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/text_and_image.json +6 -0
- package/assets/templates/text_only.json +6 -0
- package/lib/actions/audio.d.ts +4 -2
- package/lib/actions/audio.js +89 -48
- package/lib/actions/captions.d.ts +1 -1
- package/lib/actions/captions.js +17 -14
- package/lib/actions/images.d.ts +6 -3
- package/lib/actions/images.js +64 -39
- package/lib/actions/movie.js +19 -19
- package/lib/actions/pdf.js +3 -4
- package/lib/actions/translate.js +11 -11
- package/lib/agents/add_bgm_agent.js +3 -3
- package/lib/agents/combine_audio_files_agent.js +88 -42
- package/lib/agents/index.d.ts +2 -1
- package/lib/agents/index.js +2 -1
- package/lib/agents/tavily_agent.d.ts +15 -0
- package/lib/agents/tavily_agent.js +130 -0
- package/lib/cli/commands/audio/builder.d.ts +2 -0
- package/lib/cli/commands/image/builder.d.ts +2 -0
- package/lib/cli/commands/movie/builder.d.ts +2 -0
- package/lib/cli/commands/movie/handler.js +1 -6
- package/lib/cli/commands/pdf/builder.d.ts +2 -0
- package/lib/cli/commands/translate/builder.d.ts +2 -0
- package/lib/cli/common.d.ts +2 -0
- package/lib/cli/common.js +6 -0
- package/lib/cli/helpers.d.ts +7 -1
- package/lib/cli/helpers.js +30 -3
- package/lib/methods/index.d.ts +1 -1
- package/lib/methods/index.js +1 -1
- package/lib/methods/mulmo_presentation_style.d.ts +14 -0
- package/lib/methods/mulmo_presentation_style.js +70 -0
- package/lib/methods/mulmo_studio_context.d.ts +17 -0
- package/lib/methods/mulmo_studio_context.js +30 -2
- package/lib/tools/deep_research.d.ts +2 -0
- package/lib/tools/deep_research.js +265 -0
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +0 -1
- package/lib/types/schema.d.ts +101 -55
- package/lib/types/schema.js +3 -3
- package/lib/types/type.d.ts +5 -1
- package/lib/utils/ffmpeg_utils.d.ts +1 -0
- package/lib/utils/ffmpeg_utils.js +10 -0
- package/lib/utils/file.d.ts +7 -4
- package/lib/utils/file.js +24 -12
- package/lib/utils/preprocess.d.ts +0 -9
- package/lib/utils/preprocess.js +4 -10
- package/lib/utils/prompt.d.ts +3 -0
- package/lib/utils/prompt.js +52 -0
- package/package.json +11 -10
- package/assets/music/StarsBeyondEx.mp3 +0 -0
package/lib/types/schema.d.ts
CHANGED
|
@@ -49,6 +49,37 @@ export declare const speechOptionsSchema: z.ZodObject<{
|
|
|
49
49
|
instruction?: string | undefined;
|
|
50
50
|
}>;
|
|
51
51
|
export declare const text2SpeechProviderSchema: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"openai">, z.ZodLiteral<"nijivoice">, z.ZodLiteral<"google">, z.ZodLiteral<"elevenlabs">]>>;
|
|
52
|
+
export declare const speakerDataSchema: z.ZodObject<{
|
|
53
|
+
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
54
|
+
voiceId: z.ZodString;
|
|
55
|
+
speechOptions: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
speed: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, "strict", z.ZodTypeAny, {
|
|
59
|
+
speed?: number | undefined;
|
|
60
|
+
instruction?: string | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
speed?: number | undefined;
|
|
63
|
+
instruction?: string | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
provider: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"openai">, z.ZodLiteral<"nijivoice">, z.ZodLiteral<"google">, z.ZodLiteral<"elevenlabs">]>>>;
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
67
|
+
voiceId: string;
|
|
68
|
+
displayName?: Record<string, string> | undefined;
|
|
69
|
+
speechOptions?: {
|
|
70
|
+
speed?: number | undefined;
|
|
71
|
+
instruction?: string | undefined;
|
|
72
|
+
} | undefined;
|
|
73
|
+
provider?: "openai" | "nijivoice" | "google" | "elevenlabs" | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
voiceId: string;
|
|
76
|
+
displayName?: Record<string, string> | undefined;
|
|
77
|
+
speechOptions?: {
|
|
78
|
+
speed?: number | undefined;
|
|
79
|
+
instruction?: string | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
provider?: "openai" | "nijivoice" | "google" | "elevenlabs" | undefined;
|
|
82
|
+
}>;
|
|
52
83
|
export declare const speakerDictionarySchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
53
84
|
displayName: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
54
85
|
voiceId: z.ZodString;
|
|
@@ -848,6 +879,76 @@ export declare const mulmoAudioAssetSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
848
879
|
type: "midi";
|
|
849
880
|
source: string;
|
|
850
881
|
}>]>;
|
|
882
|
+
export declare const mulmoImageParamsImagesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
883
|
+
type: z.ZodLiteral<"image">;
|
|
884
|
+
source: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
885
|
+
kind: z.ZodLiteral<"url">;
|
|
886
|
+
url: z.ZodString;
|
|
887
|
+
}, "strict", z.ZodTypeAny, {
|
|
888
|
+
url: string;
|
|
889
|
+
kind: "url";
|
|
890
|
+
}, {
|
|
891
|
+
url: string;
|
|
892
|
+
kind: "url";
|
|
893
|
+
}>, z.ZodObject<{
|
|
894
|
+
kind: z.ZodLiteral<"base64">;
|
|
895
|
+
data: z.ZodString;
|
|
896
|
+
}, "strict", z.ZodTypeAny, {
|
|
897
|
+
kind: "base64";
|
|
898
|
+
data: string;
|
|
899
|
+
}, {
|
|
900
|
+
kind: "base64";
|
|
901
|
+
data: string;
|
|
902
|
+
}>, z.ZodObject<{
|
|
903
|
+
kind: z.ZodLiteral<"text">;
|
|
904
|
+
text: z.ZodString;
|
|
905
|
+
}, "strict", z.ZodTypeAny, {
|
|
906
|
+
text: string;
|
|
907
|
+
kind: "text";
|
|
908
|
+
}, {
|
|
909
|
+
text: string;
|
|
910
|
+
kind: "text";
|
|
911
|
+
}>, z.ZodObject<{
|
|
912
|
+
kind: z.ZodLiteral<"path">;
|
|
913
|
+
path: z.ZodString;
|
|
914
|
+
}, "strict", z.ZodTypeAny, {
|
|
915
|
+
path: string;
|
|
916
|
+
kind: "path";
|
|
917
|
+
}, {
|
|
918
|
+
path: string;
|
|
919
|
+
kind: "path";
|
|
920
|
+
}>]>;
|
|
921
|
+
}, "strict", z.ZodTypeAny, {
|
|
922
|
+
type: "image";
|
|
923
|
+
source: {
|
|
924
|
+
url: string;
|
|
925
|
+
kind: "url";
|
|
926
|
+
} | {
|
|
927
|
+
kind: "base64";
|
|
928
|
+
data: string;
|
|
929
|
+
} | {
|
|
930
|
+
text: string;
|
|
931
|
+
kind: "text";
|
|
932
|
+
} | {
|
|
933
|
+
path: string;
|
|
934
|
+
kind: "path";
|
|
935
|
+
};
|
|
936
|
+
}, {
|
|
937
|
+
type: "image";
|
|
938
|
+
source: {
|
|
939
|
+
url: string;
|
|
940
|
+
kind: "url";
|
|
941
|
+
} | {
|
|
942
|
+
kind: "base64";
|
|
943
|
+
data: string;
|
|
944
|
+
} | {
|
|
945
|
+
text: string;
|
|
946
|
+
kind: "text";
|
|
947
|
+
} | {
|
|
948
|
+
path: string;
|
|
949
|
+
kind: "path";
|
|
950
|
+
};
|
|
951
|
+
}>>;
|
|
851
952
|
export declare const mulmoImageParamsSchema: z.ZodObject<{
|
|
852
953
|
model: z.ZodOptional<z.ZodString>;
|
|
853
954
|
style: z.ZodOptional<z.ZodString>;
|
|
@@ -6439,43 +6540,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6439
6540
|
movieFile?: string | undefined;
|
|
6440
6541
|
captionFile?: string | undefined;
|
|
6441
6542
|
}>, "many">;
|
|
6442
|
-
multiLingual: z.ZodArray<z.ZodObject<{
|
|
6443
|
-
multiLingualTexts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
6444
|
-
text: z.ZodString;
|
|
6445
|
-
lang: z.ZodString;
|
|
6446
|
-
texts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6447
|
-
ttsTexts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6448
|
-
duration: z.ZodOptional<z.ZodNumber>;
|
|
6449
|
-
}, "strict", z.ZodTypeAny, {
|
|
6450
|
-
text: string;
|
|
6451
|
-
lang: string;
|
|
6452
|
-
texts?: string[] | undefined;
|
|
6453
|
-
ttsTexts?: string[] | undefined;
|
|
6454
|
-
duration?: number | undefined;
|
|
6455
|
-
}, {
|
|
6456
|
-
text: string;
|
|
6457
|
-
lang: string;
|
|
6458
|
-
texts?: string[] | undefined;
|
|
6459
|
-
ttsTexts?: string[] | undefined;
|
|
6460
|
-
duration?: number | undefined;
|
|
6461
|
-
}>>;
|
|
6462
|
-
}, "strip", z.ZodTypeAny, {
|
|
6463
|
-
multiLingualTexts: Record<string, {
|
|
6464
|
-
text: string;
|
|
6465
|
-
lang: string;
|
|
6466
|
-
texts?: string[] | undefined;
|
|
6467
|
-
ttsTexts?: string[] | undefined;
|
|
6468
|
-
duration?: number | undefined;
|
|
6469
|
-
}>;
|
|
6470
|
-
}, {
|
|
6471
|
-
multiLingualTexts: Record<string, {
|
|
6472
|
-
text: string;
|
|
6473
|
-
lang: string;
|
|
6474
|
-
texts?: string[] | undefined;
|
|
6475
|
-
ttsTexts?: string[] | undefined;
|
|
6476
|
-
duration?: number | undefined;
|
|
6477
|
-
}>;
|
|
6478
|
-
}>, "many">;
|
|
6479
6543
|
}, "strict", z.ZodTypeAny, {
|
|
6480
6544
|
beats: {
|
|
6481
6545
|
duration?: number | undefined;
|
|
@@ -6485,15 +6549,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6485
6549
|
movieFile?: string | undefined;
|
|
6486
6550
|
captionFile?: string | undefined;
|
|
6487
6551
|
}[];
|
|
6488
|
-
multiLingual: {
|
|
6489
|
-
multiLingualTexts: Record<string, {
|
|
6490
|
-
text: string;
|
|
6491
|
-
lang: string;
|
|
6492
|
-
texts?: string[] | undefined;
|
|
6493
|
-
ttsTexts?: string[] | undefined;
|
|
6494
|
-
duration?: number | undefined;
|
|
6495
|
-
}>;
|
|
6496
|
-
}[];
|
|
6497
6552
|
script: {
|
|
6498
6553
|
audioParams: {
|
|
6499
6554
|
padding: number;
|
|
@@ -6751,15 +6806,6 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6751
6806
|
movieFile?: string | undefined;
|
|
6752
6807
|
captionFile?: string | undefined;
|
|
6753
6808
|
}[];
|
|
6754
|
-
multiLingual: {
|
|
6755
|
-
multiLingualTexts: Record<string, {
|
|
6756
|
-
text: string;
|
|
6757
|
-
lang: string;
|
|
6758
|
-
texts?: string[] | undefined;
|
|
6759
|
-
ttsTexts?: string[] | undefined;
|
|
6760
|
-
duration?: number | undefined;
|
|
6761
|
-
}>;
|
|
6762
|
-
}[];
|
|
6763
6809
|
script: {
|
|
6764
6810
|
$mulmocast: {
|
|
6765
6811
|
version: "1.0";
|
package/lib/types/schema.js
CHANGED
|
@@ -21,7 +21,7 @@ export const speechOptionsSchema = z
|
|
|
21
21
|
.strict();
|
|
22
22
|
const speakerIdSchema = z.string();
|
|
23
23
|
export const text2SpeechProviderSchema = z.union([z.literal("openai"), z.literal("nijivoice"), z.literal("google"), z.literal("elevenlabs")]).default("openai");
|
|
24
|
-
const speakerDataSchema = z
|
|
24
|
+
export const speakerDataSchema = z
|
|
25
25
|
.object({
|
|
26
26
|
displayName: z.record(langSchema, z.string()).optional(),
|
|
27
27
|
voiceId: z.string(),
|
|
@@ -140,12 +140,13 @@ const mulmoMidiMediaSchema = z
|
|
|
140
140
|
.strict();
|
|
141
141
|
export const mulmoAudioAssetSchema = z.union([mulmoAudioMediaSchema, mulmoMidiMediaSchema]);
|
|
142
142
|
const imageIdSchema = z.string();
|
|
143
|
+
export const mulmoImageParamsImagesSchema = z.record(imageIdSchema, mulmoImageMediaSchema);
|
|
143
144
|
export const mulmoImageParamsSchema = z
|
|
144
145
|
.object({
|
|
145
146
|
model: z.string().optional(), // default: provider specific
|
|
146
147
|
style: z.string().optional(), // optional image style
|
|
147
148
|
moderation: z.string().optional(), // optional image style
|
|
148
|
-
images:
|
|
149
|
+
images: mulmoImageParamsImagesSchema.optional(),
|
|
149
150
|
})
|
|
150
151
|
.strict();
|
|
151
152
|
export const textSlideParamsSchema = z
|
|
@@ -301,7 +302,6 @@ export const mulmoStudioSchema = z
|
|
|
301
302
|
script: mulmoScriptSchema,
|
|
302
303
|
filename: z.string(),
|
|
303
304
|
beats: z.array(mulmoStudioBeatSchema).min(1),
|
|
304
|
-
multiLingual: mulmoStudioMultiLingualSchema,
|
|
305
305
|
})
|
|
306
306
|
.strict();
|
|
307
307
|
export const mulmoScriptTemplateSchema = z
|
package/lib/types/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualDataSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoMovieParamsSchema, mulmoSpeechParamsSchema, textSlideParamsSchema, speechOptionsSchema, mulmoCanvasDimensionSchema, mulmoScriptTemplateSchema, mulmoScriptTemplateFileSchema, text2ImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mulmoSessionStateSchema } from "./schema.js";
|
|
1
|
+
import { langSchema, localizedTextSchema, mulmoBeatSchema, mulmoScriptSchema, mulmoStudioSchema, mulmoStudioBeatSchema, mulmoStoryboardSchema, mulmoStoryboardSceneSchema, mulmoStudioMultiLingualSchema, mulmoStudioMultiLingualDataSchema, speakerDictionarySchema, mulmoImageParamsSchema, mulmoImageParamsImagesSchema, mulmoMovieParamsSchema, mulmoSpeechParamsSchema, textSlideParamsSchema, speechOptionsSchema, speakerDataSchema, mulmoCanvasDimensionSchema, mulmoScriptTemplateSchema, mulmoScriptTemplateFileSchema, text2ImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema, mulmoSessionStateSchema } from "./schema.js";
|
|
2
2
|
import { pdf_modes, pdf_sizes, storyToScriptGenerateMode } from "../utils/const.js";
|
|
3
3
|
import { LLM } from "../utils/utils.js";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -7,7 +7,9 @@ export type MulmoBeat = z.infer<typeof mulmoBeatSchema>;
|
|
|
7
7
|
export type SpeakerDictonary = z.infer<typeof speakerDictionarySchema>;
|
|
8
8
|
export type MulmoSpeechParams = z.infer<typeof mulmoSpeechParamsSchema>;
|
|
9
9
|
export type SpeechOptions = z.infer<typeof speechOptionsSchema>;
|
|
10
|
+
export type SpeakerData = z.infer<typeof speakerDataSchema>;
|
|
10
11
|
export type MulmoImageParams = z.infer<typeof mulmoImageParamsSchema>;
|
|
12
|
+
export type MulmoImageParamsImages = z.infer<typeof mulmoImageParamsImagesSchema>;
|
|
11
13
|
export type TextSlideParams = z.infer<typeof textSlideParamsSchema>;
|
|
12
14
|
export type Text2ImageProvider = z.infer<typeof text2ImageProviderSchema>;
|
|
13
15
|
export type Text2MovieProvider = z.infer<typeof text2MovieProviderSchema>;
|
|
@@ -49,6 +51,8 @@ export type MulmoStudioContext = {
|
|
|
49
51
|
force: boolean;
|
|
50
52
|
caption?: string;
|
|
51
53
|
sessionState: MulmoSessionState;
|
|
54
|
+
presentationStyle: MulmoPresentationStyle;
|
|
55
|
+
multiLingual: MulmoStudioMultiLingual;
|
|
52
56
|
};
|
|
53
57
|
export type ScriptingParams = {
|
|
54
58
|
urls: string[];
|
|
@@ -10,3 +10,4 @@ export declare const FfmpegContextPushFormattedAudio: (context: FfmpegContext, s
|
|
|
10
10
|
export declare const FfmpegContextInputFormattedAudio: (context: FfmpegContext, input: string, duration?: number | undefined) => string;
|
|
11
11
|
export declare const FfmpegContextGenerateOutput: (context: FfmpegContext, output: string, options?: string[]) => Promise<number>;
|
|
12
12
|
export declare const ffmpegGetMediaDuration: (filePath: string) => Promise<number>;
|
|
13
|
+
export declare const extractImageFromMovie: (movieFile: string, imagePath: string) => Promise<void>;
|
|
@@ -61,3 +61,13 @@ export const ffmpegGetMediaDuration = (filePath) => {
|
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
+
export const extractImageFromMovie = (movieFile, imagePath) => {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
ffmpeg(movieFile)
|
|
67
|
+
.outputOptions(["-frames:v 1"])
|
|
68
|
+
.output(imagePath)
|
|
69
|
+
.on("end", () => resolve())
|
|
70
|
+
.on("error", (err) => reject(err))
|
|
71
|
+
.run();
|
|
72
|
+
});
|
|
73
|
+
};
|
package/lib/utils/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MulmoScript, MulmoScriptTemplateFile } from "../types/index.js";
|
|
1
|
+
import type { MulmoScript, MulmoScriptTemplateFile, MulmoStudioContext } from "../types/index.js";
|
|
2
2
|
import { PDFMode } from "../types/index.js";
|
|
3
3
|
import { ZodSchema } from "zod";
|
|
4
4
|
export declare const updateNpmRoot: (_npmRoot: string) => void;
|
|
@@ -18,12 +18,15 @@ export declare const fetchMulmoScriptFile: (url: string) => Promise<{
|
|
|
18
18
|
status: string | number;
|
|
19
19
|
}>;
|
|
20
20
|
export declare const getOutputStudioFilePath: (outDirPath: string, fileName: string) => string;
|
|
21
|
+
export declare const getOutputMultilingualFilePath: (outDirPath: string, fileName: string) => string;
|
|
21
22
|
export declare const resolveDirPath: (dirPath: string, studioFileName: string) => string;
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const getAudioSegmentFilePath: (audioDirPath: string, studioFileName: string, fileName: string) => string;
|
|
24
|
-
export declare const getAudioCombinedFilePath: (audioDirPath: string, fileName: string, lang?: string) => string;
|
|
23
|
+
export declare const getAudioFilePath: (audioDirPath: string, dirName: string, fileName: string, lang?: string) => string;
|
|
25
24
|
export declare const getAudioArtifactFilePath: (outDirPath: string, fileName: string) => string;
|
|
26
25
|
export declare const getOutputVideoFilePath: (outDirPath: string, fileName: string, lang?: string, caption?: string) => string;
|
|
26
|
+
export declare const imageSuffix = "p";
|
|
27
|
+
export declare const getBeatPngImagePath: (context: MulmoStudioContext, index: number) => string;
|
|
28
|
+
export declare const getBeatMoviePath: (context: MulmoStudioContext, index: number) => string;
|
|
29
|
+
export declare const getReferenceImagePath: (context: MulmoStudioContext, key: string, extension: string) => string;
|
|
27
30
|
export declare const getOutputPdfFilePath: (outDirPath: string, fileName: string, pdfMode: PDFMode, lang?: string) => string;
|
|
28
31
|
export declare const getTemplateFilePath: (templateName: string) => string;
|
|
29
32
|
export declare const mkdir: (dirPath: string) => void;
|
package/lib/utils/file.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { parse as yamlParse } from "yaml";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { GraphAILogger } from "graphai";
|
|
6
|
-
import { MulmoScriptTemplateMethods } from "../methods/
|
|
6
|
+
import { MulmoScriptTemplateMethods, MulmoStudioContextMethods } from "../methods/index.js";
|
|
7
7
|
import { mulmoScriptTemplateSchema } from "../types/schema.js";
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = path.dirname(__filename);
|
|
@@ -56,21 +56,18 @@ export const fetchMulmoScriptFile = async (url) => {
|
|
|
56
56
|
export const getOutputStudioFilePath = (outDirPath, fileName) => {
|
|
57
57
|
return path.resolve(outDirPath, fileName + "_studio.json");
|
|
58
58
|
};
|
|
59
|
+
export const getOutputMultilingualFilePath = (outDirPath, fileName) => {
|
|
60
|
+
return path.resolve(outDirPath, fileName + "_lang.json");
|
|
61
|
+
};
|
|
59
62
|
export const resolveDirPath = (dirPath, studioFileName) => {
|
|
60
63
|
return path.resolve(dirPath, studioFileName);
|
|
61
64
|
};
|
|
62
|
-
//
|
|
63
|
-
export const
|
|
64
|
-
return path.resolve(audioDirPath, studioFileName);
|
|
65
|
-
};
|
|
66
|
-
export const getAudioSegmentFilePath = (audioDirPath, studioFileName, fileName) => {
|
|
67
|
-
return path.resolve(getAudioSegmentDirPath(audioDirPath, studioFileName), fileName + ".mp3");
|
|
68
|
-
};
|
|
69
|
-
export const getAudioCombinedFilePath = (audioDirPath, fileName, lang) => {
|
|
65
|
+
// audio
|
|
66
|
+
export const getAudioFilePath = (audioDirPath, dirName, fileName, lang) => {
|
|
70
67
|
if (lang) {
|
|
71
|
-
return path.resolve(audioDirPath,
|
|
68
|
+
return path.resolve(audioDirPath, dirName, `${fileName}_${lang}.mp3`);
|
|
72
69
|
}
|
|
73
|
-
return path.resolve(audioDirPath,
|
|
70
|
+
return path.resolve(audioDirPath, dirName, fileName + ".mp3");
|
|
74
71
|
};
|
|
75
72
|
export const getAudioArtifactFilePath = (outDirPath, fileName) => {
|
|
76
73
|
return path.resolve(outDirPath, fileName + ".mp3");
|
|
@@ -80,6 +77,21 @@ export const getOutputVideoFilePath = (outDirPath, fileName, lang, caption) => {
|
|
|
80
77
|
const suffix2 = caption ? `__${caption}` : "";
|
|
81
78
|
return path.resolve(outDirPath, `${fileName}${suffix}${suffix2}.mp4`);
|
|
82
79
|
};
|
|
80
|
+
// image
|
|
81
|
+
export const imageSuffix = "p";
|
|
82
|
+
export const getBeatPngImagePath = (context, index) => {
|
|
83
|
+
const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
|
|
84
|
+
return `${imageProjectDirPath}/${index}${imageSuffix}.png`;
|
|
85
|
+
};
|
|
86
|
+
export const getBeatMoviePath = (context, index) => {
|
|
87
|
+
const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
|
|
88
|
+
return `${imageProjectDirPath}/${index}.mov`;
|
|
89
|
+
};
|
|
90
|
+
export const getReferenceImagePath = (context, key, extension) => {
|
|
91
|
+
const imageProjectDirPath = MulmoStudioContextMethods.getImageProjectDirPath(context);
|
|
92
|
+
return `${imageProjectDirPath}/${key}.${extension}`;
|
|
93
|
+
};
|
|
94
|
+
// pdf
|
|
83
95
|
export const getOutputPdfFilePath = (outDirPath, fileName, pdfMode, lang) => {
|
|
84
96
|
if (lang) {
|
|
85
97
|
return path.resolve(outDirPath, `${fileName}_${pdfMode}_${lang}.pdf`);
|
|
@@ -98,7 +110,7 @@ export const mkdir = (dirPath) => {
|
|
|
98
110
|
// export const silentPath = path.resolve(npmRoot, "./assets/audio/silent300.mp3");
|
|
99
111
|
// export const silentLastPath = path.resolve(npmRoot, "./assets/audio/silent800.mp3");
|
|
100
112
|
export const silent60secPath = () => path.resolve(npmRoot, "./assets/audio/silent60sec.mp3");
|
|
101
|
-
export const defaultBGMPath = () =>
|
|
113
|
+
export const defaultBGMPath = () => "https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/story002.mp3";
|
|
102
114
|
export const getHTMLFile = (filename) => {
|
|
103
115
|
const htmlPath = path.resolve(npmRoot, `./assets/html/${filename}.html`);
|
|
104
116
|
return fs.readFileSync(htmlPath, "utf-8");
|
|
@@ -8,15 +8,6 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
8
8
|
movieFile?: string | undefined;
|
|
9
9
|
captionFile?: string | undefined;
|
|
10
10
|
}[];
|
|
11
|
-
multiLingual: {
|
|
12
|
-
multiLingualTexts: Record<string, {
|
|
13
|
-
text: string;
|
|
14
|
-
lang: string;
|
|
15
|
-
texts?: string[] | undefined;
|
|
16
|
-
ttsTexts?: string[] | undefined;
|
|
17
|
-
duration?: number | undefined;
|
|
18
|
-
}>;
|
|
19
|
-
}[];
|
|
20
11
|
script: {
|
|
21
12
|
audioParams: {
|
|
22
13
|
padding: number;
|
package/lib/utils/preprocess.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GraphAILogger } from "graphai";
|
|
2
|
-
import { mulmoScriptSchema,
|
|
2
|
+
import { mulmoScriptSchema, mulmoStudioSchema } from "../types/index.js";
|
|
3
3
|
const rebuildStudio = (currentStudio, mulmoScript, fileName) => {
|
|
4
|
-
const
|
|
4
|
+
const isTest = process.env.NODE_ENV === "test";
|
|
5
|
+
const parsed = isTest && currentStudio ? { data: mulmoStudioSchema.parse(currentStudio), success: true, error: null } : mulmoStudioSchema.safeParse(currentStudio);
|
|
5
6
|
if (parsed.success) {
|
|
6
7
|
return parsed.data;
|
|
7
8
|
}
|
|
@@ -13,7 +14,6 @@ const rebuildStudio = (currentStudio, mulmoScript, fileName) => {
|
|
|
13
14
|
script: mulmoScript,
|
|
14
15
|
filename: fileName,
|
|
15
16
|
beats: [...Array(mulmoScript.beats.length)].map(() => ({})),
|
|
16
|
-
multiLingual: [...Array(mulmoScript.beats.length)].map(() => ({ multiLingualTexts: {} })),
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
const mulmoCredit = (speaker) => {
|
|
@@ -39,18 +39,12 @@ const mulmoCredit = (speaker) => {
|
|
|
39
39
|
export const createOrUpdateStudioData = (_mulmoScript, currentStudio, fileName) => {
|
|
40
40
|
const mulmoScript = _mulmoScript.__test_invalid__ ? _mulmoScript : mulmoScriptSchema.parse(_mulmoScript); // validate and insert default value
|
|
41
41
|
const studio = rebuildStudio(currentStudio, mulmoScript, fileName);
|
|
42
|
+
// TODO: Move this code out of this function later
|
|
42
43
|
// Addition cloing credit
|
|
43
44
|
if (mulmoScript.$mulmocast.credit === "closing") {
|
|
44
45
|
mulmoScript.beats.push(mulmoCredit(mulmoScript.beats[0].speaker)); // First speaker
|
|
45
46
|
}
|
|
46
47
|
studio.script = mulmoScriptSchema.parse(mulmoScript); // update the script
|
|
47
48
|
studio.beats = studio.script.beats.map((_, index) => studio.beats[index] ?? {});
|
|
48
|
-
mulmoScript.beats.forEach((beat, index) => {
|
|
49
|
-
// Filling the default values
|
|
50
|
-
studio.script.beats[index] = mulmoBeatSchema.parse(beat);
|
|
51
|
-
if (!studio.multiLingual[index]) {
|
|
52
|
-
studio.multiLingual[index] = { multiLingualTexts: {} };
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
49
|
return studio;
|
|
56
50
|
};
|
package/lib/utils/prompt.d.ts
CHANGED
|
@@ -14,3 +14,6 @@ export declare const sceneToBeatsPrompt: ({ sampleBeats, beatsPerScene, allScene
|
|
|
14
14
|
}) => string;
|
|
15
15
|
export declare const storyToScriptInfoPrompt: (scriptWithoutBeats: Omit<MulmoScript, "beats">, story: MulmoStoryboard) => string;
|
|
16
16
|
export declare const storyToScriptPrompt: (script: MulmoScript, beatsPerScene: number, story: MulmoStoryboard) => string;
|
|
17
|
+
export declare const searchQueryPrompt: (inquiry: string, followUpQueries: string) => string;
|
|
18
|
+
export declare const reflectionPrompt: (researchTopic: string, searchResults: string) => string;
|
|
19
|
+
export declare const finalAnswerPrompt: (userInput: string, searchResults: string, researchTopic: string) => string;
|
package/lib/utils/prompt.js
CHANGED
|
@@ -72,3 +72,55 @@ Only include keys that exist in the sample script.
|
|
|
72
72
|
Do not add any keys that are not present in the sample script.
|
|
73
73
|
Please provide your response as valid JSON within \`\`\`json code blocks for clarity.`.trim();
|
|
74
74
|
};
|
|
75
|
+
export const searchQueryPrompt = (inquiry, followUpQueries) => {
|
|
76
|
+
return `
|
|
77
|
+
You are a professional research assistant specialized in generating sophisticated and diverse web search queries.
|
|
78
|
+
Create queries for advanced automated web research tools that can analyze complex results, follow links, and integrate information.
|
|
79
|
+
|
|
80
|
+
Instructions:
|
|
81
|
+
- Ensure collection of the latest information (current date: ${new Date().toLocaleDateString()})
|
|
82
|
+
- Always prioritize a single search query, add additional ones only when the original question requires multiple aspects
|
|
83
|
+
- Each query should focus on a specific aspect of the original question
|
|
84
|
+
- Do not generate more than 3 queries
|
|
85
|
+
- Generate diverse queries when the topic is broad
|
|
86
|
+
- Do not generate multiple similar queries, one is sufficient
|
|
87
|
+
- If follow-up queries exist, prioritize them over the user's inquiry
|
|
88
|
+
|
|
89
|
+
User's inquiry: ${inquiry}
|
|
90
|
+
Follow-up queries: ${followUpQueries}
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
export const reflectionPrompt = (researchTopic, searchResults) => {
|
|
94
|
+
return `
|
|
95
|
+
You are a professional research assistant analyzing summaries related to "${researchTopic}".
|
|
96
|
+
|
|
97
|
+
Instructions:
|
|
98
|
+
- Identify knowledge gaps and areas requiring deeper exploration, then generate follow-up queries
|
|
99
|
+
- If the provided summary is sufficient to answer the user's question, do not generate follow-up queries
|
|
100
|
+
- When knowledge gaps exist, generate follow-up queries that help deepen understanding
|
|
101
|
+
- Focus on technical details, implementation specifications, and emerging trends that are not fully covered
|
|
102
|
+
|
|
103
|
+
Requirements:
|
|
104
|
+
- Follow-up queries should be self-contained and include necessary context for web search
|
|
105
|
+
|
|
106
|
+
Search results: ${searchResults}
|
|
107
|
+
`;
|
|
108
|
+
};
|
|
109
|
+
export const finalAnswerPrompt = (userInput, searchResults, researchTopic) => {
|
|
110
|
+
const currentDate = new Date().toLocaleDateString();
|
|
111
|
+
return `
|
|
112
|
+
You are a professional research assistant. Generate a high-quality answer based on the following information.
|
|
113
|
+
|
|
114
|
+
Instructions:
|
|
115
|
+
- Utilize all provided information to create a logical and well-structured response
|
|
116
|
+
- Include article information (URL and title) as citations in your output when referencing search results
|
|
117
|
+
- Provide detailed technical specifications and implementation details where possible
|
|
118
|
+
- Reflect the latest information and trends
|
|
119
|
+
- Ensure the response is comprehensive and accurate
|
|
120
|
+
|
|
121
|
+
User's Question: ${userInput}
|
|
122
|
+
Search Results: ${searchResults}
|
|
123
|
+
Research Topic: ${researchTopic}
|
|
124
|
+
Current Date: ${currentDate}
|
|
125
|
+
`;
|
|
126
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"./lib",
|
|
12
12
|
"./scripts/templates",
|
|
13
|
-
"./assets/music/StarsBeyondEx.mp3",
|
|
14
13
|
"./assets/audio/silent60sec.mp3",
|
|
15
14
|
"./assets/html/",
|
|
16
15
|
"./assets/templates/"
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
"preprocess": "npx tsx ./src/cli/bin.ts preprocess",
|
|
29
28
|
"pdf": "npx tsx ./src/cli/bin.ts pdf",
|
|
30
29
|
"test": "rm -f scratchpad/test*.* && npx tsx ./src/audio.ts scripts/test/test.json && npx tsx ./src/images.ts scripts/test/test.json && npx tsx ./src/movie.ts scripts/test/test.json",
|
|
31
|
-
"ci_test": "tsx --test ./test/*/test_*.ts",
|
|
30
|
+
"ci_test": "NODE_ENV=test tsx --test ./test/*/test_*.ts",
|
|
32
31
|
"lint": "eslint src test",
|
|
33
32
|
"build": "tsc",
|
|
34
33
|
"build_test": "tsc && git checkout -- lib/*",
|
|
@@ -38,7 +37,8 @@
|
|
|
38
37
|
"schema": "npx tsx ./src/cli/bin.ts tool schema",
|
|
39
38
|
"story_to_script": "npx tsx ./src/cli/bin.ts tool story_to_script",
|
|
40
39
|
"latest": "yarn upgrade-interactive --latest",
|
|
41
|
-
"format": "prettier --write '{src,scripts,assets/templates,draft,ideason,scripts_mag2,proto,test,graphai,output,docs/scripts}/**/*.{ts,json,yaml}'"
|
|
40
|
+
"format": "prettier --write '{src,scripts,assets/templates,assets/styles,draft,ideason,scripts_mag2,proto,test,graphai,output,docs/scripts}/**/*.{ts,json,yaml}'",
|
|
41
|
+
"deep_research": "npx tsx ./src/tools/deep_research.ts"
|
|
42
42
|
},
|
|
43
43
|
"repository": "git+ssh://git@github.com/receptron/mulmocast-cli.git",
|
|
44
44
|
"author": "snakajima",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@google-cloud/text-to-speech": "^6.1.0",
|
|
52
52
|
"@graphai/anthropic_agent": "^2.0.2",
|
|
53
|
-
"@graphai/browserless_agent": "^2.0.
|
|
53
|
+
"@graphai/browserless_agent": "^2.0.1",
|
|
54
54
|
"@graphai/gemini_agent": "^2.0.0",
|
|
55
55
|
"@graphai/groq_agent": "^2.0.0",
|
|
56
56
|
"@graphai/input_agents": "^1.0.1",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"@graphai/stream_agent_filter": "^2.0.2",
|
|
59
59
|
"@graphai/vanilla": "^2.0.4",
|
|
60
60
|
"@graphai/vanilla_node_agents": "^2.0.1",
|
|
61
|
+
"@tavily/core": "^0.5.7",
|
|
61
62
|
"canvas": "^3.1.0",
|
|
62
63
|
"clipboardy": "^4.0.0",
|
|
63
64
|
"dotenv": "^16.4.7",
|
|
@@ -67,10 +68,10 @@
|
|
|
67
68
|
"inquirer": "^12.6.1",
|
|
68
69
|
"marked": "^15.0.12",
|
|
69
70
|
"ora": "^8.2.0",
|
|
70
|
-
"puppeteer": "^24.10.
|
|
71
|
+
"puppeteer": "^24.10.2",
|
|
71
72
|
"yaml": "^2.8.0",
|
|
72
73
|
"yargs": "^17.7.2",
|
|
73
|
-
"zod": "^3.25.
|
|
74
|
+
"zod": "^3.25.67",
|
|
74
75
|
"zod-to-json-schema": "^3.24.5"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
@@ -81,14 +82,14 @@
|
|
|
81
82
|
"@types/yargs": "^17.0.33",
|
|
82
83
|
"eslint": "^9.29.0",
|
|
83
84
|
"eslint-config-prettier": "^10.1.5",
|
|
84
|
-
"eslint-plugin-prettier": "^5.
|
|
85
|
+
"eslint-plugin-prettier": "^5.5.0",
|
|
85
86
|
"prettier": "^3.3.3",
|
|
86
87
|
"ts-node": "^10.9.2",
|
|
87
88
|
"tsx": "^4.20.3",
|
|
88
89
|
"typescript": "^5.7.3",
|
|
89
|
-
"typescript-eslint": "^8.34.
|
|
90
|
+
"typescript-eslint": "^8.34.1"
|
|
90
91
|
},
|
|
91
92
|
"engines": {
|
|
92
|
-
"node": ">=
|
|
93
|
+
"node": ">=18.0.0"
|
|
93
94
|
}
|
|
94
95
|
}
|
|
Binary file
|