mulmocast 1.1.0 → 1.1.2
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 +3 -3
- package/assets/templates/business.json +1 -1
- package/assets/templates/characters.json +1 -1
- package/assets/templates/children_book.json +1 -1
- package/assets/templates/coding.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 +1 -1
- package/assets/templates/ghost_comic.json +1 -1
- package/assets/templates/html.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 +1 -1
- package/assets/templates/shorts.json +1 -1
- package/assets/templates/text_and_image.json +1 -1
- package/assets/templates/text_only.json +1 -1
- package/assets/templates/trailer.json +1 -1
- package/lib/actions/image_agents.d.ts +24 -0
- package/lib/actions/image_agents.js +9 -0
- package/lib/actions/images.js +35 -6
- package/lib/actions/movie.js +3 -2
- package/lib/agents/index.d.ts +2 -1
- package/lib/agents/index.js +2 -1
- package/lib/agents/lipsync_replicate_agent.d.ts +5 -0
- package/lib/agents/lipsync_replicate_agent.js +72 -0
- package/lib/agents/movie_replicate_agent.js +10 -1
- package/lib/cli/commands/tool/prompt/builder.js +2 -2
- package/lib/cli/commands/tool/scripting/builder.js +2 -2
- package/lib/cli/commands/tool/story_to_script/builder.js +2 -2
- package/lib/data/index.d.ts +2 -0
- package/lib/data/index.js +2 -0
- package/lib/data/promptTemplates.d.ts +449 -0
- package/lib/data/promptTemplates.js +571 -0
- package/lib/data/scriptTemplates.d.ts +657 -0
- package/lib/data/scriptTemplates.js +1099 -0
- package/lib/index.browser.d.ts +2 -1
- package/lib/index.browser.js +2 -1
- package/lib/index.common.d.ts +1 -0
- package/lib/index.common.js +1 -0
- package/lib/methods/index.d.ts +0 -1
- package/lib/methods/index.js +0 -1
- package/lib/methods/mulmo_presentation_style.d.ts +10 -0
- package/lib/methods/mulmo_presentation_style.js +8 -1
- package/lib/methods/mulmo_script_template.d.ts +2 -2
- package/lib/tools/create_mulmo_script_from_url.js +14 -2
- package/lib/tools/create_mulmo_script_interactively.js +2 -1
- package/lib/tools/dump_prompt.js +1 -1
- package/lib/tools/story_to_script.js +5 -4
- package/lib/types/agent.d.ts +10 -0
- package/lib/types/schema.d.ts +322 -92
- package/lib/types/schema.js +11 -2
- package/lib/types/type.d.ts +4 -4
- package/lib/utils/context.d.ts +21 -6
- package/lib/utils/context.js +1 -0
- package/lib/utils/file.d.ts +5 -5
- package/lib/utils/file.js +36 -33
- package/lib/utils/inquirer.js +2 -2
- package/lib/utils/preprocess.d.ts +16 -6
- package/lib/utils/prompt.d.ts +1 -2
- package/lib/utils/prompt.js +0 -14
- package/lib/utils/provider2agent.d.ts +13 -0
- package/lib/utils/provider2agent.js +32 -0
- package/lib/utils/system_prompt.d.ts +1 -0
- package/lib/utils/system_prompt.js +1 -0
- package/lib/utils/templates.d.ts +3 -0
- package/lib/utils/templates.js +46 -0
- package/lib/utils/utils.js +3 -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/index.browser.d.ts
CHANGED
package/lib/index.browser.js
CHANGED
package/lib/index.common.d.ts
CHANGED
package/lib/index.common.js
CHANGED
package/lib/methods/index.d.ts
CHANGED
package/lib/methods/index.js
CHANGED
|
@@ -32,6 +32,16 @@ export declare const MulmoPresentationStyleMethods: {
|
|
|
32
32
|
identifier?: `${string}/${string}:${string}`;
|
|
33
33
|
}>;
|
|
34
34
|
};
|
|
35
|
+
getLipSyncAgentInfo(presentationStyle: MulmoPresentationStyle, beat: MulmoBeat): {
|
|
36
|
+
agentName: string;
|
|
37
|
+
defaultModel: import("../utils/provider2agent.js").ReplicateModel;
|
|
38
|
+
models: import("../utils/provider2agent.js").ReplicateModel[];
|
|
39
|
+
modelParams: Record<import("../utils/provider2agent.js").ReplicateModel, {
|
|
40
|
+
identifier?: `${string}/${string}:${string}`;
|
|
41
|
+
video: string;
|
|
42
|
+
audio: string;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
35
45
|
getConcurrency(presentationStyle: MulmoPresentationStyle): 4 | 16;
|
|
36
46
|
getHtmlImageAgentInfo(presentationStyle: MulmoPresentationStyle): Text2HtmlAgentInfo;
|
|
37
47
|
getImageType(_: MulmoPresentationStyle, beat: MulmoBeat): BeatMediaType;
|
|
@@ -2,7 +2,7 @@ import "dotenv/config";
|
|
|
2
2
|
import { isNull } from "graphai";
|
|
3
3
|
import { userAssert } from "../utils/utils.js";
|
|
4
4
|
import { text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema, } from "../types/schema.js";
|
|
5
|
-
import { provider2ImageAgent, provider2MovieAgent, provider2LLMAgent, provider2SoundEffectAgent, defaultProviders, } from "../utils/provider2agent.js";
|
|
5
|
+
import { provider2ImageAgent, provider2MovieAgent, provider2LLMAgent, provider2SoundEffectAgent, provider2LipSyncAgent, defaultProviders, } from "../utils/provider2agent.js";
|
|
6
6
|
const defaultTextSlideStyles = [
|
|
7
7
|
'*,*::before,*::after{box-sizing:border-box}body,h1,h2,h3,h4,p,figure,blockquote,dl,dd{margin:0}ul[role="list"],ol[role="list"]{list-style:none}html:focus-within{scroll-behavior:smooth}body{min-height:100vh;text-rendering:optimizeSpeed;line-height:1.5}a:not([class]){text-decoration-skip-ink:auto}img,picture{max-width:100%;display:block}input,button,textarea,select{font:inherit}@media(prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}',
|
|
8
8
|
"body { margin: 60px; margin-top: 40px; color:#333; font-size: 30px; font-family: Arial, sans-serif; box-sizing: border-box; height: 100vh }",
|
|
@@ -93,6 +93,13 @@ export const MulmoPresentationStyleMethods = {
|
|
|
93
93
|
const agentInfo = provider2SoundEffectAgent[soundEffectProvider];
|
|
94
94
|
return agentInfo;
|
|
95
95
|
},
|
|
96
|
+
getLipSyncAgentInfo(presentationStyle, beat) {
|
|
97
|
+
const lipSyncProvider = (beat.lipSyncParams?.provider ??
|
|
98
|
+
presentationStyle.lipSyncParams?.provider ??
|
|
99
|
+
defaultProviders.lipSync);
|
|
100
|
+
const agentInfo = provider2LipSyncAgent[lipSyncProvider];
|
|
101
|
+
return agentInfo;
|
|
102
|
+
},
|
|
96
103
|
getConcurrency(presentationStyle) {
|
|
97
104
|
const imageAgentInfo = MulmoPresentationStyleMethods.getImageAgentInfo(presentationStyle);
|
|
98
105
|
if (imageAgentInfo.imageParams.provider === "openai") {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MulmoScript,
|
|
1
|
+
import { MulmoScript, MulmoPromptTemplate } from "../types/index.js";
|
|
2
2
|
export declare const MulmoScriptTemplateMethods: {
|
|
3
|
-
getSystemPrompt(template:
|
|
3
|
+
getSystemPrompt(template: MulmoPromptTemplate, script?: MulmoScript): string;
|
|
4
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { GraphAI } from "graphai";
|
|
3
|
+
import { GraphAI, GraphAILogger } from "graphai";
|
|
4
4
|
import { openAIAgent } from "@graphai/openai_agent";
|
|
5
5
|
import { anthropicAgent } from "@graphai/anthropic_agent";
|
|
6
6
|
import { geminiAgent } from "@graphai/gemini_agent";
|
|
@@ -9,7 +9,8 @@ import * as agents from "@graphai/vanilla";
|
|
|
9
9
|
import { fileWriteAgent } from "@graphai/vanilla_node_agents";
|
|
10
10
|
import { browserlessAgent } from "@graphai/browserless_agent";
|
|
11
11
|
import validateSchemaAgent from "../agents/validate_schema_agent.js";
|
|
12
|
-
import {
|
|
12
|
+
import { mkdir, writingMessage } from "../utils/file.js";
|
|
13
|
+
import { readTemplatePrompt } from "../utils/templates.js";
|
|
13
14
|
import { browserlessCacheGenerator } from "../utils/filters.js";
|
|
14
15
|
import { mulmoScriptSchema, urlsSchema } from "../types/schema.js";
|
|
15
16
|
import { cliLoadingPlugin } from "../utils/plugins.js";
|
|
@@ -17,6 +18,9 @@ import { graphDataScriptFromUrlPrompt } from "../utils/prompt.js";
|
|
|
17
18
|
import { llmPair } from "../utils/utils.js";
|
|
18
19
|
import { readFileSync } from "fs";
|
|
19
20
|
const vanillaAgents = agents.default ?? agents;
|
|
21
|
+
const showErrorMessage = (text) => {
|
|
22
|
+
GraphAILogger.info("\x1b[31m" + text + "\x1b[0m");
|
|
23
|
+
};
|
|
20
24
|
const graphMulmoScript = {
|
|
21
25
|
version: 0.5,
|
|
22
26
|
loop: {
|
|
@@ -235,6 +239,10 @@ export const createMulmoScriptFromUrl = async ({ urls, templateName, outDirPath,
|
|
|
235
239
|
graph.injectValue("maxTokens", max_tokens);
|
|
236
240
|
graph.registerCallback(cliLoadingPlugin({ nodeId: "mulmoScript", message: "Generating script..." }));
|
|
237
241
|
const result = await graph.run();
|
|
242
|
+
if (!result?.writeJSON?.path) {
|
|
243
|
+
showErrorMessage("Script generation failed. Please try again.");
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
238
246
|
writingMessage(result?.writeJSON?.path ?? "");
|
|
239
247
|
};
|
|
240
248
|
export const createMulmoScriptFromFile = async (fileName, { templateName, outDirPath, filename, cacheDirPath, llm, llm_model, verbose }) => {
|
|
@@ -263,5 +271,9 @@ export const createMulmoScriptFromFile = async (fileName, { templateName, outDir
|
|
|
263
271
|
graph.registerCallback(cliLoadingPlugin({ nodeId: "mulmoScript", message: "Generating script..." }));
|
|
264
272
|
}
|
|
265
273
|
const result = await graph.run();
|
|
274
|
+
if (!result?.writeJSON?.path) {
|
|
275
|
+
showErrorMessage("Script generation failed. Please try again.");
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
266
278
|
writingMessage(result?.writeJSON?.path ?? "");
|
|
267
279
|
};
|
|
@@ -8,7 +8,8 @@ import { geminiAgent } from "@graphai/gemini_agent";
|
|
|
8
8
|
import { groqAgent } from "@graphai/groq_agent";
|
|
9
9
|
import * as agents from "@graphai/vanilla";
|
|
10
10
|
import { fileWriteAgent } from "@graphai/vanilla_node_agents";
|
|
11
|
-
import {
|
|
11
|
+
import { mkdir } from "../utils/file.js";
|
|
12
|
+
import { readTemplatePrompt } from "../utils/templates.js";
|
|
12
13
|
import { browserlessCacheGenerator } from "../utils/filters.js";
|
|
13
14
|
import { mulmoScriptSchema } from "../types/index.js";
|
|
14
15
|
import { browserlessAgent } from "@graphai/browserless_agent";
|
package/lib/tools/dump_prompt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GraphAILogger } from "graphai";
|
|
2
|
-
import { readTemplatePrompt } from "../utils/
|
|
2
|
+
import { readTemplatePrompt } from "../utils/templates.js";
|
|
3
3
|
import clipboardy from "clipboardy";
|
|
4
4
|
export const dumpPromptFromTemplate = async ({ templateName }) => {
|
|
5
5
|
const prompt = readTemplatePrompt(templateName);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getPromptTemplateFilePath, readAndParseJson, writingMessage } from "../utils/file.js";
|
|
2
|
+
import { readScriptTemplateFile } from "../utils/templates.js";
|
|
3
|
+
import { mulmoScriptSchema, mulmoPromptTemplateSchema } from "../types/schema.js";
|
|
3
4
|
import { GraphAI, GraphAILogger } from "graphai";
|
|
4
5
|
import { openAIAgent } from "@graphai/openai_agent";
|
|
5
6
|
import { anthropicAgent } from "@graphai/anthropic_agent";
|
|
@@ -228,7 +229,7 @@ const oneStepGraphData = {
|
|
|
228
229
|
};
|
|
229
230
|
const generateBeatsPrompt = async (template, beatsPerScene, story) => {
|
|
230
231
|
const allScenes = story.scenes.map((scene) => scene.description).join("\n");
|
|
231
|
-
const sampleBeats = template.scriptName ? readScriptTemplateFile(template.scriptName).beats : [];
|
|
232
|
+
const sampleBeats = template.scriptName ? (readScriptTemplateFile(template.scriptName).beats ?? []) : [];
|
|
232
233
|
return sceneToBeatsPrompt({ sampleBeats, beatsPerScene, allScenes });
|
|
233
234
|
};
|
|
234
235
|
const generateScriptInfoPrompt = async (template, story) => {
|
|
@@ -249,7 +250,7 @@ const generateScriptPrompt = async (template, beatsPerScene, story) => {
|
|
|
249
250
|
return storyToScriptPrompt(script, beatsPerScene, story);
|
|
250
251
|
};
|
|
251
252
|
export const storyToScript = async ({ story, beatsPerScene, templateName, outdir, fileName, llm, llmModel, generateMode, }) => {
|
|
252
|
-
const template = readAndParseJson(
|
|
253
|
+
const template = readAndParseJson(getPromptTemplateFilePath(templateName), mulmoPromptTemplateSchema);
|
|
253
254
|
const { agent, model, max_tokens } = llmPair(llm, llmModel);
|
|
254
255
|
const beatsPrompt = await generateBeatsPrompt(template, beatsPerScene, story);
|
|
255
256
|
const scriptInfoPrompt = await generateScriptInfoPrompt(template, story);
|
package/lib/types/agent.d.ts
CHANGED
|
@@ -66,9 +66,19 @@ export type SoundEffectAgentInputs = AgentPromptInputs & {
|
|
|
66
66
|
soundEffectFile: string;
|
|
67
67
|
movieFile: string;
|
|
68
68
|
};
|
|
69
|
+
export type ReplicateLipSyncAgentParams = {
|
|
70
|
+
model: `${string}/${string}` | undefined;
|
|
71
|
+
duration?: number;
|
|
72
|
+
};
|
|
73
|
+
export type LipSyncAgentInputs = {
|
|
74
|
+
lipSyncFile: string;
|
|
75
|
+
movieFile: string;
|
|
76
|
+
audioFile: string;
|
|
77
|
+
};
|
|
69
78
|
export type GoogleMovieAgentConfig = GoogleImageAgentConfig;
|
|
70
79
|
export type ReplicateMovieAgentConfig = AgentConfig;
|
|
71
80
|
export type ReplicateSoundEffectAgentConfig = AgentConfig;
|
|
81
|
+
export type ReplicateLipSyncAgentConfig = AgentConfig;
|
|
72
82
|
export type TTSAgentParams = {
|
|
73
83
|
suppressError: boolean;
|
|
74
84
|
voice: string;
|