mulmocast 0.0.5 → 0.0.7
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/README.md +294 -39
- package/assets/audio/silent60sec.mp3 +0 -0
- package/assets/html/caption.html +45 -0
- package/assets/html/chart.html +1 -1
- package/assets/html/mermaid.html +6 -2
- package/assets/html/tailwind.html +13 -0
- package/assets/templates/business.json +2 -128
- package/assets/templates/children_book.json +1 -128
- package/assets/templates/coding.json +2 -136
- package/assets/templates/comic_strips.json +6 -0
- package/assets/templates/ghibli_strips.json +6 -0
- package/assets/templates/sensei_and_taro.json +1 -118
- package/lib/actions/audio.js +62 -39
- package/lib/actions/captions.d.ts +2 -0
- package/lib/actions/captions.js +75 -0
- package/lib/actions/images.js +34 -13
- package/lib/actions/index.d.ts +1 -0
- package/lib/actions/index.js +1 -0
- package/lib/actions/movie.js +102 -101
- package/lib/actions/pdf.js +26 -6
- package/lib/actions/translate.js +60 -39
- package/lib/agents/add_bgm_agent.js +15 -39
- package/lib/agents/combine_audio_files_agent.js +53 -35
- package/lib/agents/index.d.ts +2 -3
- package/lib/agents/index.js +2 -3
- package/lib/agents/tts_google_agent.d.ts +4 -0
- package/lib/agents/tts_google_agent.js +51 -0
- package/lib/agents/validate_schema_agent.d.ts +19 -0
- package/lib/agents/validate_schema_agent.js +36 -0
- package/lib/cli/args.d.ts +2 -0
- package/lib/cli/args.js +9 -2
- package/lib/cli/bin.d.ts +3 -0
- package/lib/cli/bin.js +38 -0
- package/lib/cli/cli.js +34 -7
- package/lib/cli/commands/audio/builder.d.ts +14 -0
- package/lib/cli/commands/audio/builder.js +6 -0
- package/lib/cli/commands/audio/handler.d.ts +4 -0
- package/lib/cli/commands/audio/handler.js +7 -0
- package/lib/cli/commands/audio/index.d.ts +4 -0
- package/lib/cli/commands/audio/index.js +4 -0
- package/lib/cli/commands/image/builder.d.ts +14 -0
- package/lib/cli/commands/image/builder.js +6 -0
- package/lib/cli/commands/image/handler.d.ts +4 -0
- package/lib/cli/commands/image/handler.js +7 -0
- package/lib/cli/commands/image/index.d.ts +4 -0
- package/lib/cli/commands/image/index.js +4 -0
- package/lib/cli/commands/movie/builder.d.ts +18 -0
- package/lib/cli/commands/movie/builder.js +19 -0
- package/lib/cli/commands/movie/handler.d.ts +6 -0
- package/lib/cli/commands/movie/handler.js +12 -0
- package/lib/cli/commands/movie/index.d.ts +4 -0
- package/lib/cli/commands/movie/index.js +4 -0
- package/lib/cli/commands/pdf/builder.d.ts +18 -0
- package/lib/cli/commands/pdf/builder.js +19 -0
- package/lib/cli/commands/pdf/handler.d.ts +6 -0
- package/lib/cli/commands/pdf/handler.js +8 -0
- package/lib/cli/commands/pdf/index.d.ts +4 -0
- package/lib/cli/commands/pdf/index.js +4 -0
- package/lib/cli/commands/tool/index.d.ts +6 -0
- package/lib/cli/commands/tool/index.js +8 -0
- package/lib/cli/commands/tool/prompt/builder.d.ts +4 -0
- package/lib/cli/commands/tool/prompt/builder.js +11 -0
- package/lib/cli/commands/tool/prompt/handler.d.ts +4 -0
- package/lib/cli/commands/tool/prompt/handler.js +14 -0
- package/lib/cli/commands/tool/prompt/index.d.ts +4 -0
- package/lib/cli/commands/tool/prompt/index.js +4 -0
- package/lib/cli/commands/tool/schema/builder.d.ts +2 -0
- package/lib/cli/commands/tool/schema/builder.js +3 -0
- package/lib/cli/commands/tool/schema/handler.d.ts +2 -0
- package/lib/cli/commands/tool/schema/handler.js +12 -0
- package/lib/cli/commands/tool/schema/index.d.ts +4 -0
- package/lib/cli/commands/tool/schema/index.js +4 -0
- package/lib/cli/commands/tool/scripting/builder.d.ts +20 -0
- package/lib/cli/commands/tool/scripting/builder.js +63 -0
- package/lib/cli/commands/tool/scripting/handler.d.ts +13 -0
- package/lib/cli/commands/tool/scripting/handler.js +36 -0
- package/lib/cli/commands/tool/scripting/index.d.ts +4 -0
- package/lib/cli/commands/tool/scripting/index.js +4 -0
- package/lib/cli/commands/tool/story_to_script/builder.d.ts +20 -0
- package/lib/cli/commands/tool/story_to_script/builder.js +61 -0
- package/lib/cli/commands/tool/story_to_script/handler.d.ts +13 -0
- package/lib/cli/commands/tool/story_to_script/handler.js +36 -0
- package/lib/cli/commands/tool/story_to_script/index.d.ts +4 -0
- package/lib/cli/commands/tool/story_to_script/index.js +4 -0
- package/lib/cli/commands/translate/builder.d.ts +14 -0
- package/lib/cli/commands/translate/builder.js +5 -0
- package/lib/cli/commands/translate/handler.d.ts +4 -0
- package/lib/cli/commands/translate/handler.js +6 -0
- package/lib/cli/commands/translate/index.d.ts +4 -0
- package/lib/cli/commands/translate/index.js +4 -0
- package/lib/cli/common.d.ts +6 -2
- package/lib/cli/common.js +18 -7
- package/lib/cli/helpers.d.ts +38 -0
- package/lib/cli/helpers.js +115 -0
- package/lib/cli/tool-args.d.ts +1 -0
- package/lib/cli/tool-args.js +1 -1
- package/lib/cli/tool-cli.js +8 -0
- package/lib/methods/mulmo_script.d.ts +0 -1
- package/lib/methods/mulmo_script.js +4 -7
- package/lib/methods/mulmo_script_template.d.ts +2 -2
- package/lib/methods/mulmo_script_template.js +3 -13
- package/lib/methods/mulmo_studio.d.ts +8 -0
- package/lib/methods/mulmo_studio.js +24 -0
- package/lib/tools/create_mulmo_script_from_url.d.ts +1 -1
- package/lib/tools/create_mulmo_script_from_url.js +43 -14
- package/lib/tools/create_mulmo_script_interactively.d.ts +1 -1
- package/lib/tools/create_mulmo_script_interactively.js +21 -20
- package/lib/tools/dump_prompt.js +2 -0
- package/lib/tools/story_to_script.d.ts +12 -0
- package/lib/tools/story_to_script.js +275 -0
- package/lib/types/cli_types.d.ts +14 -0
- package/lib/types/cli_types.js +1 -0
- package/lib/types/schema.d.ts +637 -1766
- package/lib/types/schema.js +77 -8
- package/lib/types/type.d.ts +10 -3
- package/lib/utils/const.d.ts +5 -0
- package/lib/utils/const.js +5 -0
- package/lib/utils/ffmpeg_utils.d.ts +12 -0
- package/lib/utils/ffmpeg_utils.js +63 -0
- package/lib/utils/file.d.ts +8 -3
- package/lib/utils/file.js +40 -9
- package/lib/utils/filters.js +16 -11
- package/lib/utils/image_plugins/chart.js +6 -1
- package/lib/utils/image_plugins/html_tailwind.d.ts +3 -0
- package/lib/utils/image_plugins/html_tailwind.js +18 -0
- package/lib/utils/image_plugins/index.d.ts +2 -1
- package/lib/utils/image_plugins/index.js +2 -1
- package/lib/utils/image_plugins/mermaid.js +1 -1
- package/lib/utils/image_plugins/tailwind.d.ts +3 -0
- package/lib/utils/image_plugins/tailwind.js +18 -0
- package/lib/utils/image_plugins/text_slide.js +9 -2
- package/lib/utils/markdown.d.ts +1 -1
- package/lib/utils/markdown.js +8 -4
- package/lib/utils/preprocess.d.ts +40 -10
- package/lib/utils/preprocess.js +7 -2
- package/lib/utils/prompt.d.ts +16 -0
- package/lib/utils/prompt.js +74 -0
- package/lib/utils/utils.d.ts +10 -5
- package/lib/utils/utils.js +37 -17
- package/package.json +27 -23
|
@@ -2,18 +2,27 @@ import { MulmoStudio, MulmoScript } from "../types/index.js";
|
|
|
2
2
|
export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, currentStudio: MulmoStudio | undefined, fileName: string) => {
|
|
3
3
|
beats: {
|
|
4
4
|
duration?: number | undefined;
|
|
5
|
-
|
|
5
|
+
hash?: string | undefined;
|
|
6
|
+
audioFile?: string | undefined;
|
|
7
|
+
imageFile?: string | undefined;
|
|
8
|
+
captionFile?: string | undefined;
|
|
9
|
+
}[];
|
|
10
|
+
multiLingual: {
|
|
11
|
+
multiLingualTexts: Record<string, {
|
|
6
12
|
text: string;
|
|
7
13
|
lang: string;
|
|
8
14
|
texts?: string[] | undefined;
|
|
9
15
|
ttsTexts?: string[] | undefined;
|
|
10
16
|
duration?: number | undefined;
|
|
11
|
-
}
|
|
12
|
-
hash?: string | undefined;
|
|
13
|
-
audioFile?: string | undefined;
|
|
14
|
-
imageFile?: string | undefined;
|
|
17
|
+
}>;
|
|
15
18
|
}[];
|
|
16
19
|
script: {
|
|
20
|
+
audioParams: {
|
|
21
|
+
padding: number;
|
|
22
|
+
introPadding: number;
|
|
23
|
+
closingPadding: number;
|
|
24
|
+
outroPadding: number;
|
|
25
|
+
};
|
|
17
26
|
$mulmocast: {
|
|
18
27
|
version: "1.0";
|
|
19
28
|
credit?: "closing" | undefined;
|
|
@@ -23,7 +32,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
23
32
|
height: number;
|
|
24
33
|
};
|
|
25
34
|
speechParams: {
|
|
26
|
-
provider: "openai" | "nijivoice";
|
|
35
|
+
provider: "openai" | "nijivoice" | "google";
|
|
27
36
|
speakers: Record<string, {
|
|
28
37
|
voiceId: string;
|
|
29
38
|
displayName?: Record<string, string> | undefined;
|
|
@@ -36,6 +45,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
36
45
|
beats: {
|
|
37
46
|
text: string;
|
|
38
47
|
speaker: string;
|
|
48
|
+
duration?: number | undefined;
|
|
39
49
|
speechOptions?: {
|
|
40
50
|
speed?: number | undefined;
|
|
41
51
|
instruction?: string | undefined;
|
|
@@ -110,7 +120,8 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
110
120
|
type: "textSlide";
|
|
111
121
|
slide: {
|
|
112
122
|
title: string;
|
|
113
|
-
|
|
123
|
+
subtitle?: string | undefined;
|
|
124
|
+
bullets?: string[] | undefined;
|
|
114
125
|
};
|
|
115
126
|
} | {
|
|
116
127
|
type: "chart";
|
|
@@ -133,6 +144,9 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
133
144
|
type: "mermaid";
|
|
134
145
|
title: string;
|
|
135
146
|
appendix?: string[] | undefined;
|
|
147
|
+
} | {
|
|
148
|
+
type: "html_tailwind";
|
|
149
|
+
html: string | string[];
|
|
136
150
|
} | undefined;
|
|
137
151
|
audio?: {
|
|
138
152
|
type: "audio";
|
|
@@ -159,6 +173,9 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
159
173
|
style?: string | undefined;
|
|
160
174
|
moderation?: string | undefined;
|
|
161
175
|
} | undefined;
|
|
176
|
+
audioParams?: {
|
|
177
|
+
padding?: number | undefined;
|
|
178
|
+
} | undefined;
|
|
162
179
|
textSlideParams?: {
|
|
163
180
|
cssStyles: string | string[];
|
|
164
181
|
} | undefined;
|
|
@@ -176,9 +193,6 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
176
193
|
textSlideParams?: {
|
|
177
194
|
cssStyles: string | string[];
|
|
178
195
|
} | undefined;
|
|
179
|
-
videoParams?: {
|
|
180
|
-
padding?: number | undefined;
|
|
181
|
-
} | undefined;
|
|
182
196
|
omitCaptions?: boolean | undefined;
|
|
183
197
|
description?: string | undefined;
|
|
184
198
|
references?: {
|
|
@@ -191,4 +205,20 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
191
205
|
__test_invalid__?: boolean | undefined;
|
|
192
206
|
};
|
|
193
207
|
filename: string;
|
|
208
|
+
state: {
|
|
209
|
+
inSession: {
|
|
210
|
+
pdf: boolean;
|
|
211
|
+
image: boolean;
|
|
212
|
+
audio: boolean;
|
|
213
|
+
video: boolean;
|
|
214
|
+
multiLingual: boolean;
|
|
215
|
+
caption: boolean;
|
|
216
|
+
};
|
|
217
|
+
inBeatSession: {
|
|
218
|
+
image: Set<number>;
|
|
219
|
+
audio: Set<number>;
|
|
220
|
+
multiLingual: Set<number>;
|
|
221
|
+
caption: Set<number>;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
194
224
|
};
|
package/lib/utils/preprocess.js
CHANGED
|
@@ -4,11 +4,13 @@ const rebuildStudio = (currentStudio, mulmoScript, fileName) => {
|
|
|
4
4
|
if (parsed.success) {
|
|
5
5
|
return parsed.data;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
// We need to parse it to fill default values
|
|
8
|
+
return mulmoStudioSchema.parse({
|
|
8
9
|
script: mulmoScript,
|
|
9
10
|
filename: fileName,
|
|
10
11
|
beats: [...Array(mulmoScript.beats.length)].map(() => ({})),
|
|
11
|
-
|
|
12
|
+
multiLingual: [...Array(mulmoScript.beats.length)].map(() => ({ multiLingualTexts: {} })),
|
|
13
|
+
});
|
|
12
14
|
};
|
|
13
15
|
const mulmoCredit = (speaker) => {
|
|
14
16
|
return {
|
|
@@ -42,6 +44,9 @@ export const createOrUpdateStudioData = (_mulmoScript, currentStudio, fileName)
|
|
|
42
44
|
mulmoScript.beats.forEach((beat, index) => {
|
|
43
45
|
// Filling the default values
|
|
44
46
|
studio.script.beats[index] = mulmoBeatSchema.parse(beat);
|
|
47
|
+
if (!studio.multiLingual[index]) {
|
|
48
|
+
studio.multiLingual[index] = { multiLingualTexts: {} };
|
|
49
|
+
}
|
|
45
50
|
});
|
|
46
51
|
return studio;
|
|
47
52
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MulmoBeat, MulmoScript, MulmoScriptTemplate, MulmoStoryboard } from "../types/index.js";
|
|
2
|
+
export declare const imagePrompt: (beat: MulmoBeat, style?: string) => string;
|
|
3
|
+
export declare const graphDataScriptFromUrlPrompt: (sourceTextInput: string) => string;
|
|
4
|
+
export declare const graphDataScriptGeneratePrompt: (scene: string) => string;
|
|
5
|
+
export declare const getMulmoScriptTemplateSystemPrompt: (template: MulmoScriptTemplate, script?: MulmoScript) => string;
|
|
6
|
+
export declare const interactiveClarificationPrompt = "If there are any unclear points, be sure to ask the user questions and clarify them before generating the script.";
|
|
7
|
+
export declare const prefixPrompt = "Here is the web content that can be used as reference material for the script:";
|
|
8
|
+
export declare const translateSystemPrompt = "Please translate the given text into the language specified in language (in locale format, like en, ja, fr, ch).";
|
|
9
|
+
export declare const translatePrompts: string[];
|
|
10
|
+
export declare const sceneToBeatsPrompt: ({ sampleBeats, beatsPerScene, allScenes, }: {
|
|
11
|
+
sampleBeats: MulmoScript["beats"];
|
|
12
|
+
beatsPerScene: number;
|
|
13
|
+
allScenes: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
export declare const storyToScriptInfoPrompt: (scriptWithoutBeats: Omit<MulmoScript, "beats">, story: MulmoStoryboard) => string;
|
|
16
|
+
export declare const storyToScriptPrompt: (script: MulmoScript, beatsPerScene: number, story: MulmoStoryboard) => string;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { mulmoScriptSchema } from "../types/schema.js";
|
|
2
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
|
+
export const imagePrompt = (beat, style) => {
|
|
4
|
+
return (beat.imagePrompt || `generate image appropriate for the text. text: ${beat.text}`) + "\n" + (style || "");
|
|
5
|
+
};
|
|
6
|
+
// sourceTextInput: ${:sourceText.text}
|
|
7
|
+
export const graphDataScriptFromUrlPrompt = (sourceTextInput) => {
|
|
8
|
+
return `Please create a script using the information from the following URLs as reference: ${sourceTextInput}`;
|
|
9
|
+
};
|
|
10
|
+
export const graphDataScriptGeneratePrompt = (scene) => {
|
|
11
|
+
return `Please generate a script from the following scenes: ${scene}`;
|
|
12
|
+
};
|
|
13
|
+
export const getMulmoScriptTemplateSystemPrompt = (template, script) => {
|
|
14
|
+
// script is provided, use it as a script template
|
|
15
|
+
if (script) {
|
|
16
|
+
return `${template.systemPrompt}\n\`\`\`JSON\n${JSON.stringify(script)}\n\`\`\``;
|
|
17
|
+
}
|
|
18
|
+
// script is not provided, use the default schema
|
|
19
|
+
const defaultSchema = zodToJsonSchema(mulmoScriptSchema, {
|
|
20
|
+
strictUnions: true,
|
|
21
|
+
});
|
|
22
|
+
const specificOutputPrompt = `The output should follow the JSON schema specified below. Please provide your response as valid JSON within \`\`\`json code blocks for clarity.`;
|
|
23
|
+
return `${template.systemPrompt}\n\n${specificOutputPrompt}\n\n\`\`\`JSON\n${JSON.stringify(defaultSchema)}\n\`\`\``;
|
|
24
|
+
};
|
|
25
|
+
export const interactiveClarificationPrompt = `If there are any unclear points, be sure to ask the user questions and clarify them before generating the script.`;
|
|
26
|
+
export const prefixPrompt = "Here is the web content that can be used as reference material for the script:";
|
|
27
|
+
export const translateSystemPrompt = "Please translate the given text into the language specified in language (in locale format, like en, ja, fr, ch).";
|
|
28
|
+
export const translatePrompts = ["## Original Language", ":lang", "", "## Language", ":targetLang", "", "## Target", ":beat.text"];
|
|
29
|
+
export const sceneToBeatsPrompt = ({ sampleBeats, beatsPerScene, allScenes, }) => {
|
|
30
|
+
return `Generate scripts for the given scenes, following the structure of the sample scripts below.
|
|
31
|
+
\`\`\`JSON
|
|
32
|
+
${JSON.stringify(sampleBeats)}
|
|
33
|
+
\`\`\`
|
|
34
|
+
From the content of each scene, generate exactly ${beatsPerScene} scripts (beats).
|
|
35
|
+
The scripts should be created considering the overall content of the scenes.
|
|
36
|
+
The scenes are as follows:
|
|
37
|
+
\`\`\`
|
|
38
|
+
${allScenes}
|
|
39
|
+
\`\`\`
|
|
40
|
+
Please provide your response as valid JSON within \`\`\`json code blocks for clarity.`.trim();
|
|
41
|
+
};
|
|
42
|
+
export const storyToScriptInfoPrompt = (scriptWithoutBeats, story) => {
|
|
43
|
+
return `Generate script for the given storyboard, following the structure of the sample scripts below.
|
|
44
|
+
Storyboard:
|
|
45
|
+
- title: ${story.title}
|
|
46
|
+
- description: ${story.scenes.map((scene) => scene.description).join("\n")}
|
|
47
|
+
- references: ${story.references?.map((reference) => JSON.stringify(reference)).join("\n")}
|
|
48
|
+
|
|
49
|
+
Sample script:
|
|
50
|
+
\`\`\`JSON
|
|
51
|
+
${JSON.stringify(scriptWithoutBeats)}
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
Only include keys that exist in the sample script.
|
|
55
|
+
Do not add any keys that are not present in the sample script.
|
|
56
|
+
Please provide your response as valid JSON within \`\`\`json code blocks for clarity.`.trim();
|
|
57
|
+
};
|
|
58
|
+
export const storyToScriptPrompt = (script, beatsPerScene, story) => {
|
|
59
|
+
return `Generate script for the given storyboard, following the structure of the sample scripts below.
|
|
60
|
+
Storyboard:
|
|
61
|
+
- title: ${story.title}
|
|
62
|
+
- references: ${story.references?.map((reference) => JSON.stringify(reference)).join("\n")}
|
|
63
|
+
- scenes: ${JSON.stringify(story.scenes)}
|
|
64
|
+
|
|
65
|
+
Sample script:
|
|
66
|
+
\`\`\`JSON
|
|
67
|
+
${JSON.stringify(script)}
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
Generate exactly ${beatsPerScene} scripts (beats) for each scene.
|
|
71
|
+
Only include keys that exist in the sample script.
|
|
72
|
+
Do not add any keys that are not present in the sample script.
|
|
73
|
+
Please provide your response as valid JSON within \`\`\`json code blocks for clarity.`.trim();
|
|
74
|
+
};
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export declare const
|
|
1
|
+
import { MulmoBeat, MulmoStudioMultiLingualData } from "../types/index.js";
|
|
2
|
+
export declare const llm: readonly ["openAI", "anthropic", "gemini", "groq"];
|
|
3
|
+
export type LLM = (typeof llm)[number];
|
|
4
|
+
export declare const llmConfig: Record<LLM, {
|
|
5
|
+
agent: string;
|
|
6
|
+
defaultModel: string;
|
|
7
|
+
max_tokens: number;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const llmPair: (_llm?: LLM, _model?: string) => {
|
|
5
10
|
agent: string;
|
|
6
11
|
model: string;
|
|
7
12
|
max_tokens: number;
|
|
@@ -9,4 +14,4 @@ export declare const llmPair: (_agent?: LLMAgent, _model?: string) => {
|
|
|
9
14
|
export declare const chunkArray: <T>(array: T[], size?: number) => T[][];
|
|
10
15
|
export declare const isHttp: (fileOrUrl: string) => boolean;
|
|
11
16
|
export declare const text2hash: (input: string) => string;
|
|
12
|
-
export
|
|
17
|
+
export declare const localizedText: (beat: MulmoBeat, multiLingualData?: MulmoStudioMultiLingualData, lang?: string) => string;
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
-
export const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export const llm = ["openAI", "anthropic", "gemini", "groq"];
|
|
3
|
+
export const llmConfig = {
|
|
4
|
+
openAI: {
|
|
5
|
+
agent: "openAIAgent",
|
|
6
|
+
defaultModel: "gpt-4o",
|
|
7
|
+
max_tokens: 8192,
|
|
8
|
+
},
|
|
9
|
+
anthropic: {
|
|
10
|
+
agent: "anthropicAgent",
|
|
11
|
+
defaultModel: "claude-3-7-sonnet-20250219",
|
|
12
|
+
max_tokens: 8192,
|
|
13
|
+
},
|
|
14
|
+
gemini: {
|
|
15
|
+
agent: "geminiAgent",
|
|
16
|
+
defaultModel: "gemini-1.5-flash",
|
|
17
|
+
max_tokens: 8192,
|
|
18
|
+
},
|
|
19
|
+
groq: {
|
|
20
|
+
agent: "groqAgent",
|
|
21
|
+
defaultModel: "llama3-8b-8192",
|
|
22
|
+
max_tokens: 4096,
|
|
23
|
+
},
|
|
8
24
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
export const defaultOpenAIModel = defaultModels["openAIAgent"];
|
|
16
|
-
export const llmPair = (_agent, _model) => {
|
|
17
|
-
const agent = _agent && llmAgents.includes(_agent ?? "") ? _agent : "openAIAgent";
|
|
18
|
-
const model = _model ?? defaultModels[agent ?? ""];
|
|
19
|
-
const max_tokens = longMaxTokens[agent];
|
|
25
|
+
export const llmPair = (_llm, _model) => {
|
|
26
|
+
const llmKey = _llm ?? "openAI";
|
|
27
|
+
const agent = llmConfig[llmKey]?.agent ?? llmConfig.openAI.agent;
|
|
28
|
+
const model = _model ?? llmConfig[llmKey]?.defaultModel ?? llmConfig.openAI.defaultModel;
|
|
29
|
+
const max_tokens = llmConfig[llmKey]?.max_tokens ?? llmConfig.openAI.max_tokens;
|
|
20
30
|
return { agent, model, max_tokens };
|
|
21
31
|
};
|
|
22
32
|
export const chunkArray = (array, size = 3) => {
|
|
@@ -32,3 +42,13 @@ export const isHttp = (fileOrUrl) => {
|
|
|
32
42
|
export const text2hash = (input) => {
|
|
33
43
|
return crypto.createHash("sha256").update(input).digest("hex");
|
|
34
44
|
};
|
|
45
|
+
export const localizedText = (beat, multiLingualData, lang) => {
|
|
46
|
+
if (lang &&
|
|
47
|
+
multiLingualData &&
|
|
48
|
+
multiLingualData?.multiLingualTexts &&
|
|
49
|
+
multiLingualData?.multiLingualTexts[lang] &&
|
|
50
|
+
multiLingualData?.multiLingualTexts[lang].text) {
|
|
51
|
+
return multiLingualData?.multiLingualTexts[lang].text;
|
|
52
|
+
}
|
|
53
|
+
return beat.text;
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "lib/cli/
|
|
6
|
+
"main": "lib/cli/bin.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"mulmo": "lib/cli/
|
|
9
|
-
"mulmo-tool": "lib/cli/tool-cli.js"
|
|
8
|
+
"mulmo": "lib/cli/bin.js"
|
|
10
9
|
},
|
|
11
10
|
"files": [
|
|
12
11
|
"./lib",
|
|
13
12
|
"./assets/music/StarsBeyondEx.mp3",
|
|
14
13
|
"./assets/audio/silent300.mp3",
|
|
15
14
|
"./assets/audio/silent800.mp3",
|
|
15
|
+
"./assets/audio/silent60sec.mp3",
|
|
16
16
|
"./assets/html/",
|
|
17
17
|
"./assets/font/",
|
|
18
18
|
"./assets/templates/"
|
|
@@ -23,20 +23,22 @@
|
|
|
23
23
|
"test": "tests"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"audio": "npx tsx ./src/cli/
|
|
27
|
-
"translate": "npx tsx ./src/cli/
|
|
28
|
-
"movie": "npx tsx ./src/cli/
|
|
29
|
-
"images": "npx tsx ./src/cli/
|
|
30
|
-
"preprocess": "npx tsx ./src/cli/
|
|
26
|
+
"audio": "npx tsx ./src/cli/bin.ts audio",
|
|
27
|
+
"translate": "npx tsx ./src/cli/bin.ts translate",
|
|
28
|
+
"movie": "npx tsx ./src/cli/bin.ts movie",
|
|
29
|
+
"images": "npx tsx ./src/cli/bin.ts images",
|
|
30
|
+
"preprocess": "npx tsx ./src/cli/bin.ts preprocess",
|
|
31
|
+
"pdf": "npx tsx ./src/cli/bin.ts pdf",
|
|
31
32
|
"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",
|
|
32
33
|
"ci_test": "tsx --test ./test/*/test_*.ts",
|
|
33
34
|
"lint": "eslint src test",
|
|
34
35
|
"build": "tsc",
|
|
35
36
|
"build_test": "tsc && git checkout -- lib/*",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
37
|
+
"cli": "npx tsx ./src/cli/bin.ts",
|
|
38
|
+
"scripting": "npx tsx ./src/cli/bin.ts tool scripting",
|
|
39
|
+
"prompt": "npx tsx ./src/cli/bin.ts tool prompt",
|
|
40
|
+
"schema": "npx tsx ./src/cli/bin.ts tool schema",
|
|
41
|
+
"story_to_script": "npx tsx ./src/cli/bin.ts tool story_to_script",
|
|
40
42
|
"latest": "yarn upgrade-interactive --latest",
|
|
41
43
|
"format": "prettier --write '{src,scripts,assets/templates,draft,ideason,scripts_mag2,proto,test,graphai,output,docs/scripts}/**/*.{ts,json,yaml}'"
|
|
42
44
|
},
|
|
@@ -48,43 +50,45 @@
|
|
|
48
50
|
},
|
|
49
51
|
"homepage": "https://github.com/receptron/mulmocast-cli#readme",
|
|
50
52
|
"dependencies": {
|
|
51
|
-
"@
|
|
53
|
+
"@google-cloud/text-to-speech": "^6.1.0",
|
|
52
54
|
"@graphai/anthropic_agent": "^2.0.0",
|
|
53
55
|
"@graphai/browserless_agent": "^2.0.0",
|
|
54
56
|
"@graphai/gemini_agent": "^1.0.1",
|
|
55
57
|
"@graphai/groq_agent": "^1.0.1",
|
|
56
58
|
"@graphai/input_agents": "^1.0.1",
|
|
57
|
-
"@graphai/openai_agent": "^
|
|
58
|
-
"@graphai/
|
|
59
|
+
"@graphai/openai_agent": "^2.0.0",
|
|
60
|
+
"@graphai/stream_agent_filter": "^2.0.1",
|
|
61
|
+
"@graphai/vanilla": "^2.0.2",
|
|
59
62
|
"@graphai/vanilla_node_agents": "^2.0.0",
|
|
60
63
|
"@pdf-lib/fontkit": "^1.1.1",
|
|
61
|
-
"@types/fluent-ffmpeg": "^2.1.26",
|
|
62
64
|
"canvas": "^3.1.0",
|
|
65
|
+
"clipboardy": "^4.0.0",
|
|
63
66
|
"dotenv": "^16.4.7",
|
|
64
67
|
"fluent-ffmpeg": "^2.1.3",
|
|
65
68
|
"google-auth-library": "^9.15.1",
|
|
66
|
-
"graphai": "^
|
|
67
|
-
"inquirer": "^12.6.
|
|
69
|
+
"graphai": "^2.0.3",
|
|
70
|
+
"inquirer": "^12.6.1",
|
|
68
71
|
"marked": "^15.0.11",
|
|
69
72
|
"ora": "^8.2.0",
|
|
70
73
|
"pdf-lib": "^1.17.1",
|
|
71
74
|
"puppeteer": "^24.8.1",
|
|
72
|
-
"yaml": "^2.
|
|
75
|
+
"yaml": "^2.8.0",
|
|
73
76
|
"yargs": "^17.7.2",
|
|
74
77
|
"zod": "^3.24.4",
|
|
75
78
|
"zod-to-json-schema": "^3.24.5"
|
|
76
79
|
},
|
|
77
80
|
"devDependencies": {
|
|
78
81
|
"@receptron/test_utils": "^2.0.0",
|
|
82
|
+
"@types/fluent-ffmpeg": "^2.1.26",
|
|
79
83
|
"@types/yargs": "^17.0.33",
|
|
80
|
-
"eslint": "^9.
|
|
81
|
-
"eslint-config-prettier": "^10.
|
|
84
|
+
"eslint": "^9.27.0",
|
|
85
|
+
"eslint-config-prettier": "^10.1.5",
|
|
82
86
|
"eslint-plugin-prettier": "^5.4.0",
|
|
83
87
|
"prettier": "^3.3.3",
|
|
84
88
|
"ts-node": "^10.9.2",
|
|
85
89
|
"tsx": "^4.19.4",
|
|
86
90
|
"typescript": "^5.7.3",
|
|
87
|
-
"typescript-eslint": "^8.32.
|
|
91
|
+
"typescript-eslint": "^8.32.1"
|
|
88
92
|
},
|
|
89
93
|
"engines": {
|
|
90
94
|
"node": ">=16.0.0"
|