mulmocast 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions/images.d.ts +6 -0
- package/lib/actions/images.js +44 -6
- package/lib/agents/add_bgm_agent.js +1 -1
- package/lib/agents/combine_audio_files_agent.js +2 -2
- package/lib/agents/image_openai_agent.js +17 -10
- package/lib/agents/movie_google_agent.js +1 -1
- package/lib/index.browser.d.ts +1 -0
- package/lib/index.browser.js +1 -0
- package/lib/methods/mulmo_studio_context.d.ts +1 -15
- package/lib/types/schema.d.ts +140 -4
- package/lib/types/schema.js +9 -0
- package/lib/types/type.d.ts +13 -0
- package/lib/utils/ffmpeg_utils.d.ts +1 -1
- package/lib/utils/ffmpeg_utils.js +7 -2
- package/lib/utils/image_plugins/image.d.ts +2 -2
- package/lib/utils/image_plugins/movie.d.ts +2 -2
- package/lib/utils/preprocess.d.ts +6 -0
- package/package.json +1 -1
package/lib/actions/images.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ export declare const imagePreprocessAgent: (namedInputs: {
|
|
|
31
31
|
movieFile: string | undefined;
|
|
32
32
|
imagePath: string | undefined;
|
|
33
33
|
referenceImage: string | undefined;
|
|
34
|
+
htmlPrompt?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
imagePath: string;
|
|
37
|
+
htmlPrompt: string;
|
|
34
38
|
} | {
|
|
35
39
|
imagePath: string;
|
|
36
40
|
images: string[];
|
|
@@ -57,6 +61,7 @@ export declare const imagePreprocessAgent: (namedInputs: {
|
|
|
57
61
|
}> | undefined;
|
|
58
62
|
};
|
|
59
63
|
movieFile: string | undefined;
|
|
64
|
+
htmlPrompt?: undefined;
|
|
60
65
|
} | {
|
|
61
66
|
images: string[];
|
|
62
67
|
imageParams: {
|
|
@@ -84,6 +89,7 @@ export declare const imagePreprocessAgent: (namedInputs: {
|
|
|
84
89
|
imagePath: string;
|
|
85
90
|
referenceImage: string;
|
|
86
91
|
prompt: string;
|
|
92
|
+
htmlPrompt?: undefined;
|
|
87
93
|
}>;
|
|
88
94
|
export declare const imagePluginAgent: (namedInputs: {
|
|
89
95
|
context: MulmoStudioContext;
|
package/lib/actions/images.js
CHANGED
|
@@ -3,6 +3,7 @@ import fs from "fs";
|
|
|
3
3
|
import { GraphAI, GraphAILogger } from "graphai";
|
|
4
4
|
import { TaskManager } from "graphai/lib/task_manager.js";
|
|
5
5
|
import * as agents from "@graphai/vanilla";
|
|
6
|
+
import { openAIAgent } from "@graphai/openai_agent";
|
|
6
7
|
import { fileWriteAgent } from "@graphai/vanilla_node_agents";
|
|
7
8
|
import { getOutputStudioFilePath, getBeatPngImagePath, getBeatMoviePath, getReferenceImagePath, mkdir } from "../utils/file.js";
|
|
8
9
|
import { fileCacheAgentFilter } from "../utils/filters.js";
|
|
@@ -11,6 +12,7 @@ import { MulmoPresentationStyleMethods, MulmoStudioContextMethods } from "../met
|
|
|
11
12
|
import { findImagePlugin } from "../utils/image_plugins/index.js";
|
|
12
13
|
import { imagePrompt } from "../utils/prompt.js";
|
|
13
14
|
import { defaultOpenAIImageModel } from "../utils/const.js";
|
|
15
|
+
import { renderHTMLToImage } from "../utils/markdown.js";
|
|
14
16
|
const vanillaAgents = agents.default ?? agents;
|
|
15
17
|
dotenv.config();
|
|
16
18
|
// const openai = new OpenAI();
|
|
@@ -39,6 +41,10 @@ export const imagePreprocessAgent = async (namedInputs) => {
|
|
|
39
41
|
// undefined prompt indicates that image generation is not needed
|
|
40
42
|
return { imagePath: path, referenceImage: path, ...returnValue };
|
|
41
43
|
}
|
|
44
|
+
if (beat.htmlPrompt) {
|
|
45
|
+
const htmlPrompt = beat.htmlPrompt.prompt + (beat.htmlPrompt.data ? "\n\n data\n" + JSON.stringify(beat.htmlPrompt.data, null, 2) : "");
|
|
46
|
+
return { imagePath, htmlPrompt };
|
|
47
|
+
}
|
|
42
48
|
// images for "edit_image"
|
|
43
49
|
const images = (() => {
|
|
44
50
|
const imageNames = beat.imageNames ?? Object.keys(imageRefs); // use all images if imageNames is not specified
|
|
@@ -69,6 +75,10 @@ export const imagePluginAgent = async (namedInputs) => {
|
|
|
69
75
|
throw error;
|
|
70
76
|
}
|
|
71
77
|
};
|
|
78
|
+
const htmlImageGeneratorAgent = async (namedInputs) => {
|
|
79
|
+
const { html, file, canvasSize } = namedInputs;
|
|
80
|
+
await renderHTMLToImage(html, file, canvasSize.width, canvasSize.height);
|
|
81
|
+
};
|
|
72
82
|
const beat_graph_data = {
|
|
73
83
|
version: 0.5,
|
|
74
84
|
concurrency: 4,
|
|
@@ -100,15 +110,43 @@ const beat_graph_data = {
|
|
|
100
110
|
onComplete: ":preprocessor",
|
|
101
111
|
},
|
|
102
112
|
},
|
|
113
|
+
htmlImageAgent: {
|
|
114
|
+
if: ":preprocessor.htmlPrompt",
|
|
115
|
+
defaultValue: {},
|
|
116
|
+
agent: "openAIAgent",
|
|
117
|
+
inputs: {
|
|
118
|
+
prompt: ":preprocessor.htmlPrompt",
|
|
119
|
+
system: [
|
|
120
|
+
"Based on the provided information, create a single slide HTML page using Tailwind CSS.",
|
|
121
|
+
"If charts are needed, use Chart.js to present them in a clean and visually appealing way.",
|
|
122
|
+
"Include a balanced mix of comments, graphs, and illustrations to enhance visual impact.",
|
|
123
|
+
"Output only the HTML code. Do not include any comments, explanations, or additional information outside the HTML.",
|
|
124
|
+
"If data is provided, use it effectively to populate the slide.",
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
htmlImageGenerator: {
|
|
129
|
+
if: ":preprocessor.htmlPrompt",
|
|
130
|
+
defaultValue: {},
|
|
131
|
+
agent: htmlImageGeneratorAgent,
|
|
132
|
+
// console: { before: true, after: true },
|
|
133
|
+
inputs: {
|
|
134
|
+
html: ":htmlImageAgent.text.codeBlock()",
|
|
135
|
+
canvasSize: ":context.presentationStyle.canvasSize",
|
|
136
|
+
file: ":preprocessor.imagePath", // only for fileCacheAgentFilter
|
|
137
|
+
mulmoContext: ":context", // for fileCacheAgentFilter
|
|
138
|
+
index: ":__mapIndex", // for fileCacheAgentFilter
|
|
139
|
+
sessionType: "image", // for fileCacheAgentFilter
|
|
140
|
+
},
|
|
141
|
+
},
|
|
103
142
|
imageGenerator: {
|
|
104
143
|
if: ":preprocessor.prompt",
|
|
105
144
|
agent: ":imageAgentInfo.agent",
|
|
106
|
-
retry:
|
|
145
|
+
retry: 2,
|
|
107
146
|
inputs: {
|
|
108
147
|
prompt: ":preprocessor.prompt",
|
|
109
148
|
images: ":preprocessor.images",
|
|
110
149
|
file: ":preprocessor.imagePath", // only for fileCacheAgentFilter
|
|
111
|
-
text: ":preprocessor.prompt", // only for fileCacheAgentFilter
|
|
112
150
|
force: ":context.force", // only for fileCacheAgentFilter
|
|
113
151
|
mulmoContext: ":context", // for fileCacheAgentFilter
|
|
114
152
|
index: ":__mapIndex", // for fileCacheAgentFilter
|
|
@@ -157,7 +195,7 @@ const beat_graph_data = {
|
|
|
157
195
|
output: {
|
|
158
196
|
agent: "copyAgent",
|
|
159
197
|
inputs: {
|
|
160
|
-
onComplete: ":imageFromMovie", // to wait for imageFromMovie to finish
|
|
198
|
+
onComplete: [":imageFromMovie", ":htmlImageGenerator"], // to wait for imageFromMovie to finish
|
|
161
199
|
imageFile: ":preprocessor.imagePath",
|
|
162
200
|
movieFile: ":preprocessor.movieFile",
|
|
163
201
|
},
|
|
@@ -258,7 +296,7 @@ const graphOption = async (context) => {
|
|
|
258
296
|
{
|
|
259
297
|
name: "fileCacheAgentFilter",
|
|
260
298
|
agent: fileCacheAgentFilter,
|
|
261
|
-
nodeIds: ["imageGenerator", "movieGenerator"],
|
|
299
|
+
nodeIds: ["imageGenerator", "movieGenerator", "htmlImageGenerator"],
|
|
262
300
|
},
|
|
263
301
|
];
|
|
264
302
|
const taskManager = new TaskManager(getConcurrency(context));
|
|
@@ -358,7 +396,7 @@ const getConcurrency = (context) => {
|
|
|
358
396
|
const generateImages = async (context, callbacks) => {
|
|
359
397
|
const options = await graphOption(context);
|
|
360
398
|
const injections = await prepareGenerateImages(context);
|
|
361
|
-
const graph = new GraphAI(graph_data, { ...vanillaAgents, imageGoogleAgent, movieGoogleAgent, imageOpenaiAgent, mediaMockAgent, fileWriteAgent }, options);
|
|
399
|
+
const graph = new GraphAI(graph_data, { ...vanillaAgents, imageGoogleAgent, movieGoogleAgent, imageOpenaiAgent, mediaMockAgent, fileWriteAgent, openAIAgent }, options);
|
|
362
400
|
Object.keys(injections).forEach((key) => {
|
|
363
401
|
graph.injectValue(key, injections[key]);
|
|
364
402
|
});
|
|
@@ -385,7 +423,7 @@ export const images = async (context, callbacks) => {
|
|
|
385
423
|
export const generateBeatImage = async (index, context, callbacks) => {
|
|
386
424
|
const options = await graphOption(context);
|
|
387
425
|
const injections = await prepareGenerateImages(context);
|
|
388
|
-
const graph = new GraphAI(beat_graph_data, { ...vanillaAgents, imageGoogleAgent, movieGoogleAgent, imageOpenaiAgent, mediaMockAgent, fileWriteAgent }, options);
|
|
426
|
+
const graph = new GraphAI(beat_graph_data, { ...vanillaAgents, imageGoogleAgent, movieGoogleAgent, imageOpenaiAgent, mediaMockAgent, fileWriteAgent, openAIAgent }, options);
|
|
389
427
|
Object.keys(injections).forEach((key) => {
|
|
390
428
|
if ("outputStudioFilePath" !== key) {
|
|
391
429
|
graph.injectValue(key, injections[key]);
|
|
@@ -9,7 +9,7 @@ const addBGMAgent = async ({ namedInputs, params, }) => {
|
|
|
9
9
|
const totalDuration = speechDuration + introPadding + outroPadding;
|
|
10
10
|
GraphAILogger.log("totalDucation:", speechDuration, totalDuration);
|
|
11
11
|
const ffmpegContext = FfmpegContextInit();
|
|
12
|
-
const musicInputIndex = FfmpegContextAddInput(ffmpegContext, musicFile);
|
|
12
|
+
const musicInputIndex = FfmpegContextAddInput(ffmpegContext, musicFile, ["-stream_loop", "-1"]);
|
|
13
13
|
const voiceInputIndex = FfmpegContextAddInput(ffmpegContext, voiceFile);
|
|
14
14
|
ffmpegContext.filterComplex.push(`[${musicInputIndex}:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo, volume=${context.presentationStyle.audioParams.bgmVolume}[music]`);
|
|
15
15
|
ffmpegContext.filterComplex.push(`[${voiceInputIndex}:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo, volume=${context.presentationStyle.audioParams.audioVolume}, adelay=${introPadding * 1000}|${introPadding * 1000}[voice]`);
|
|
@@ -35,7 +35,7 @@ const getMediaDurations = (context) => {
|
|
|
35
35
|
return {
|
|
36
36
|
movieDuration,
|
|
37
37
|
audioDuration,
|
|
38
|
-
|
|
38
|
+
hasMedia: movieDuration + audioDuration > 0,
|
|
39
39
|
silenceDuration: 0,
|
|
40
40
|
};
|
|
41
41
|
}));
|
|
@@ -70,7 +70,7 @@ const combineAudioFilesAgent = async ({ namedInputs, }) => {
|
|
|
70
70
|
if (audioDuration > 0) {
|
|
71
71
|
// Check if the current beat has spilled over audio.
|
|
72
72
|
const group = [index];
|
|
73
|
-
for (let i = index + 1; i < context.studio.beats.length && !mediaDurations[i].
|
|
73
|
+
for (let i = index + 1; i < context.studio.beats.length && !mediaDurations[i].hasMedia; i++) {
|
|
74
74
|
group.push(i);
|
|
75
75
|
}
|
|
76
76
|
if (group.length > 1) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import { GraphAILogger } from "graphai";
|
|
3
4
|
import OpenAI, { toFile } from "openai";
|
|
4
5
|
import { defaultOpenAIImageModel } from "../utils/const.js";
|
|
5
6
|
// https://platform.openai.com/docs/guides/image-generation
|
|
@@ -42,17 +43,23 @@ export const imageOpenaiAgent = async ({ namedInputs, params }) => {
|
|
|
42
43
|
imageOptions.moderation = moderation || "auto";
|
|
43
44
|
}
|
|
44
45
|
const response = await (async () => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
try {
|
|
47
|
+
const targetSize = imageOptions.size;
|
|
48
|
+
if ((images ?? []).length > 0 && (targetSize === "1536x1024" || targetSize === "1024x1536" || targetSize === "1024x1024")) {
|
|
49
|
+
const imagelist = await Promise.all((images ?? []).map(async (file) => {
|
|
50
|
+
const ext = path.extname(file).toLowerCase();
|
|
51
|
+
const type = ext === ".jpg" || ext === ".jpeg" ? "image/jpeg" : "image/png";
|
|
52
|
+
return await toFile(fs.createReadStream(file), null, { type });
|
|
53
|
+
}));
|
|
54
|
+
return await openai.images.edit({ ...imageOptions, size: targetSize, image: imagelist });
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return await openai.images.generate(imageOptions);
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
catch (error) {
|
|
61
|
+
GraphAILogger.info("Failed to generate image:", error.message);
|
|
62
|
+
throw error;
|
|
56
63
|
}
|
|
57
64
|
})();
|
|
58
65
|
if (!response.data) {
|
|
@@ -102,7 +102,7 @@ export const movieGoogleAgent = async ({ namedInputs, params, config }) => {
|
|
|
102
102
|
throw new Error("ERROR: geneateImage returned undefined");
|
|
103
103
|
}
|
|
104
104
|
catch (error) {
|
|
105
|
-
GraphAILogger.info("Failed to generate movie:", error);
|
|
105
|
+
GraphAILogger.info("Failed to generate movie:", error.message);
|
|
106
106
|
throw error;
|
|
107
107
|
}
|
|
108
108
|
};
|
package/lib/index.browser.d.ts
CHANGED
package/lib/index.browser.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import { MulmoStudioContext } from "../types/index.js";
|
|
2
|
-
type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf";
|
|
3
|
-
type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie";
|
|
4
|
-
type SessionProgressEvent = {
|
|
5
|
-
kind: "session";
|
|
6
|
-
sessionType: SessionType;
|
|
7
|
-
inSession: boolean;
|
|
8
|
-
} | {
|
|
9
|
-
kind: "beat";
|
|
10
|
-
sessionType: BeatSessionType;
|
|
11
|
-
index: number;
|
|
12
|
-
inSession: boolean;
|
|
13
|
-
};
|
|
14
|
-
type SessionProgressCallback = (change: SessionProgressEvent) => void;
|
|
1
|
+
import { BeatSessionType, MulmoStudioContext, SessionProgressCallback, SessionType } from "../types/index.js";
|
|
15
2
|
export declare const addSessionProgressCallback: (cb: SessionProgressCallback) => void;
|
|
16
3
|
export declare const removeSessionProgressCallback: (cb: SessionProgressCallback) => void;
|
|
17
4
|
export declare const MulmoStudioContextMethods: {
|
|
@@ -25,4 +12,3 @@ export declare const MulmoStudioContextMethods: {
|
|
|
25
12
|
setSessionState(context: MulmoStudioContext, sessionType: SessionType, value: boolean): void;
|
|
26
13
|
setBeatSessionState(context: MulmoStudioContext, sessionType: BeatSessionType, index: number, value: boolean): void;
|
|
27
14
|
};
|
|
28
|
-
export {};
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -1163,6 +1163,22 @@ export declare const audioParamsSchema: z.ZodObject<{
|
|
|
1163
1163
|
bgmVolume?: number | undefined;
|
|
1164
1164
|
audioVolume?: number | undefined;
|
|
1165
1165
|
}>;
|
|
1166
|
+
export declare const htmlPromptParamsSchema: z.ZodObject<{
|
|
1167
|
+
systemPrompt: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
1168
|
+
prompt: z.ZodDefault<z.ZodString>;
|
|
1169
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
1170
|
+
images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1171
|
+
}, "strict", z.ZodTypeAny, {
|
|
1172
|
+
prompt: string;
|
|
1173
|
+
data?: any;
|
|
1174
|
+
images?: Record<string, any> | undefined;
|
|
1175
|
+
systemPrompt?: string | undefined;
|
|
1176
|
+
}, {
|
|
1177
|
+
data?: any;
|
|
1178
|
+
images?: Record<string, any> | undefined;
|
|
1179
|
+
systemPrompt?: string | undefined;
|
|
1180
|
+
prompt?: string | undefined;
|
|
1181
|
+
}>;
|
|
1166
1182
|
export declare const mulmoBeatSchema: z.ZodObject<{
|
|
1167
1183
|
speaker: z.ZodDefault<z.ZodString>;
|
|
1168
1184
|
text: z.ZodDefault<z.ZodString>;
|
|
@@ -1823,6 +1839,22 @@ export declare const mulmoBeatSchema: z.ZodObject<{
|
|
|
1823
1839
|
imageNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1824
1840
|
imagePrompt: z.ZodOptional<z.ZodString>;
|
|
1825
1841
|
moviePrompt: z.ZodOptional<z.ZodString>;
|
|
1842
|
+
htmlPrompt: z.ZodOptional<z.ZodObject<{
|
|
1843
|
+
systemPrompt: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
1844
|
+
prompt: z.ZodDefault<z.ZodString>;
|
|
1845
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
1846
|
+
images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1847
|
+
}, "strict", z.ZodTypeAny, {
|
|
1848
|
+
prompt: string;
|
|
1849
|
+
data?: any;
|
|
1850
|
+
images?: Record<string, any> | undefined;
|
|
1851
|
+
systemPrompt?: string | undefined;
|
|
1852
|
+
}, {
|
|
1853
|
+
data?: any;
|
|
1854
|
+
images?: Record<string, any> | undefined;
|
|
1855
|
+
systemPrompt?: string | undefined;
|
|
1856
|
+
prompt?: string | undefined;
|
|
1857
|
+
}>>;
|
|
1826
1858
|
}, "strict", z.ZodTypeAny, {
|
|
1827
1859
|
text: string;
|
|
1828
1860
|
speaker: string;
|
|
@@ -1984,6 +2016,12 @@ export declare const mulmoBeatSchema: z.ZodObject<{
|
|
|
1984
2016
|
imageNames?: string[] | undefined;
|
|
1985
2017
|
imagePrompt?: string | undefined;
|
|
1986
2018
|
moviePrompt?: string | undefined;
|
|
2019
|
+
htmlPrompt?: {
|
|
2020
|
+
prompt: string;
|
|
2021
|
+
data?: any;
|
|
2022
|
+
images?: Record<string, any> | undefined;
|
|
2023
|
+
systemPrompt?: string | undefined;
|
|
2024
|
+
} | undefined;
|
|
1987
2025
|
}, {
|
|
1988
2026
|
text?: string | undefined;
|
|
1989
2027
|
duration?: number | undefined;
|
|
@@ -2145,6 +2183,12 @@ export declare const mulmoBeatSchema: z.ZodObject<{
|
|
|
2145
2183
|
imageNames?: string[] | undefined;
|
|
2146
2184
|
imagePrompt?: string | undefined;
|
|
2147
2185
|
moviePrompt?: string | undefined;
|
|
2186
|
+
htmlPrompt?: {
|
|
2187
|
+
data?: any;
|
|
2188
|
+
images?: Record<string, any> | undefined;
|
|
2189
|
+
systemPrompt?: string | undefined;
|
|
2190
|
+
prompt?: string | undefined;
|
|
2191
|
+
} | undefined;
|
|
2148
2192
|
}>;
|
|
2149
2193
|
export declare const mulmoCanvasDimensionSchema: z.ZodDefault<z.ZodObject<{
|
|
2150
2194
|
width: z.ZodNumber;
|
|
@@ -3741,6 +3785,22 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
3741
3785
|
imageNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
3742
3786
|
imagePrompt: z.ZodOptional<z.ZodString>;
|
|
3743
3787
|
moviePrompt: z.ZodOptional<z.ZodString>;
|
|
3788
|
+
htmlPrompt: z.ZodOptional<z.ZodObject<{
|
|
3789
|
+
systemPrompt: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
3790
|
+
prompt: z.ZodDefault<z.ZodString>;
|
|
3791
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
3792
|
+
images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
3793
|
+
}, "strict", z.ZodTypeAny, {
|
|
3794
|
+
prompt: string;
|
|
3795
|
+
data?: any;
|
|
3796
|
+
images?: Record<string, any> | undefined;
|
|
3797
|
+
systemPrompt?: string | undefined;
|
|
3798
|
+
}, {
|
|
3799
|
+
data?: any;
|
|
3800
|
+
images?: Record<string, any> | undefined;
|
|
3801
|
+
systemPrompt?: string | undefined;
|
|
3802
|
+
prompt?: string | undefined;
|
|
3803
|
+
}>>;
|
|
3744
3804
|
}, "strict", z.ZodTypeAny, {
|
|
3745
3805
|
text: string;
|
|
3746
3806
|
speaker: string;
|
|
@@ -3902,6 +3962,12 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
3902
3962
|
imageNames?: string[] | undefined;
|
|
3903
3963
|
imagePrompt?: string | undefined;
|
|
3904
3964
|
moviePrompt?: string | undefined;
|
|
3965
|
+
htmlPrompt?: {
|
|
3966
|
+
prompt: string;
|
|
3967
|
+
data?: any;
|
|
3968
|
+
images?: Record<string, any> | undefined;
|
|
3969
|
+
systemPrompt?: string | undefined;
|
|
3970
|
+
} | undefined;
|
|
3905
3971
|
}, {
|
|
3906
3972
|
text?: string | undefined;
|
|
3907
3973
|
duration?: number | undefined;
|
|
@@ -4063,6 +4129,12 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
4063
4129
|
imageNames?: string[] | undefined;
|
|
4064
4130
|
imagePrompt?: string | undefined;
|
|
4065
4131
|
moviePrompt?: string | undefined;
|
|
4132
|
+
htmlPrompt?: {
|
|
4133
|
+
data?: any;
|
|
4134
|
+
images?: Record<string, any> | undefined;
|
|
4135
|
+
systemPrompt?: string | undefined;
|
|
4136
|
+
prompt?: string | undefined;
|
|
4137
|
+
} | undefined;
|
|
4066
4138
|
}>, "many">;
|
|
4067
4139
|
imagePath: z.ZodOptional<z.ZodString>;
|
|
4068
4140
|
__test_invalid__: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -4269,6 +4341,12 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
4269
4341
|
imageNames?: string[] | undefined;
|
|
4270
4342
|
imagePrompt?: string | undefined;
|
|
4271
4343
|
moviePrompt?: string | undefined;
|
|
4344
|
+
htmlPrompt?: {
|
|
4345
|
+
prompt: string;
|
|
4346
|
+
data?: any;
|
|
4347
|
+
images?: Record<string, any> | undefined;
|
|
4348
|
+
systemPrompt?: string | undefined;
|
|
4349
|
+
} | undefined;
|
|
4272
4350
|
}[];
|
|
4273
4351
|
lang?: string | undefined;
|
|
4274
4352
|
title?: string | undefined;
|
|
@@ -4480,6 +4558,12 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
4480
4558
|
imageNames?: string[] | undefined;
|
|
4481
4559
|
imagePrompt?: string | undefined;
|
|
4482
4560
|
moviePrompt?: string | undefined;
|
|
4561
|
+
htmlPrompt?: {
|
|
4562
|
+
data?: any;
|
|
4563
|
+
images?: Record<string, any> | undefined;
|
|
4564
|
+
systemPrompt?: string | undefined;
|
|
4565
|
+
prompt?: string | undefined;
|
|
4566
|
+
} | undefined;
|
|
4483
4567
|
}[];
|
|
4484
4568
|
lang?: string | undefined;
|
|
4485
4569
|
title?: string | undefined;
|
|
@@ -5731,6 +5815,22 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
5731
5815
|
imageNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5732
5816
|
imagePrompt: z.ZodOptional<z.ZodString>;
|
|
5733
5817
|
moviePrompt: z.ZodOptional<z.ZodString>;
|
|
5818
|
+
htmlPrompt: z.ZodOptional<z.ZodObject<{
|
|
5819
|
+
systemPrompt: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
5820
|
+
prompt: z.ZodDefault<z.ZodString>;
|
|
5821
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
5822
|
+
images: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
5823
|
+
}, "strict", z.ZodTypeAny, {
|
|
5824
|
+
prompt: string;
|
|
5825
|
+
data?: any;
|
|
5826
|
+
images?: Record<string, any> | undefined;
|
|
5827
|
+
systemPrompt?: string | undefined;
|
|
5828
|
+
}, {
|
|
5829
|
+
data?: any;
|
|
5830
|
+
images?: Record<string, any> | undefined;
|
|
5831
|
+
systemPrompt?: string | undefined;
|
|
5832
|
+
prompt?: string | undefined;
|
|
5833
|
+
}>>;
|
|
5734
5834
|
}, "strict", z.ZodTypeAny, {
|
|
5735
5835
|
text: string;
|
|
5736
5836
|
speaker: string;
|
|
@@ -5892,6 +5992,12 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
5892
5992
|
imageNames?: string[] | undefined;
|
|
5893
5993
|
imagePrompt?: string | undefined;
|
|
5894
5994
|
moviePrompt?: string | undefined;
|
|
5995
|
+
htmlPrompt?: {
|
|
5996
|
+
prompt: string;
|
|
5997
|
+
data?: any;
|
|
5998
|
+
images?: Record<string, any> | undefined;
|
|
5999
|
+
systemPrompt?: string | undefined;
|
|
6000
|
+
} | undefined;
|
|
5895
6001
|
}, {
|
|
5896
6002
|
text?: string | undefined;
|
|
5897
6003
|
duration?: number | undefined;
|
|
@@ -6053,6 +6159,12 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6053
6159
|
imageNames?: string[] | undefined;
|
|
6054
6160
|
imagePrompt?: string | undefined;
|
|
6055
6161
|
moviePrompt?: string | undefined;
|
|
6162
|
+
htmlPrompt?: {
|
|
6163
|
+
data?: any;
|
|
6164
|
+
images?: Record<string, any> | undefined;
|
|
6165
|
+
systemPrompt?: string | undefined;
|
|
6166
|
+
prompt?: string | undefined;
|
|
6167
|
+
} | undefined;
|
|
6056
6168
|
}>, "many">;
|
|
6057
6169
|
imagePath: z.ZodOptional<z.ZodString>;
|
|
6058
6170
|
__test_invalid__: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -6259,6 +6371,12 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6259
6371
|
imageNames?: string[] | undefined;
|
|
6260
6372
|
imagePrompt?: string | undefined;
|
|
6261
6373
|
moviePrompt?: string | undefined;
|
|
6374
|
+
htmlPrompt?: {
|
|
6375
|
+
prompt: string;
|
|
6376
|
+
data?: any;
|
|
6377
|
+
images?: Record<string, any> | undefined;
|
|
6378
|
+
systemPrompt?: string | undefined;
|
|
6379
|
+
} | undefined;
|
|
6262
6380
|
}[];
|
|
6263
6381
|
lang?: string | undefined;
|
|
6264
6382
|
title?: string | undefined;
|
|
@@ -6470,6 +6588,12 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6470
6588
|
imageNames?: string[] | undefined;
|
|
6471
6589
|
imagePrompt?: string | undefined;
|
|
6472
6590
|
moviePrompt?: string | undefined;
|
|
6591
|
+
htmlPrompt?: {
|
|
6592
|
+
data?: any;
|
|
6593
|
+
images?: Record<string, any> | undefined;
|
|
6594
|
+
systemPrompt?: string | undefined;
|
|
6595
|
+
prompt?: string | undefined;
|
|
6596
|
+
} | undefined;
|
|
6473
6597
|
}[];
|
|
6474
6598
|
lang?: string | undefined;
|
|
6475
6599
|
title?: string | undefined;
|
|
@@ -6788,6 +6912,12 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
6788
6912
|
imageNames?: string[] | undefined;
|
|
6789
6913
|
imagePrompt?: string | undefined;
|
|
6790
6914
|
moviePrompt?: string | undefined;
|
|
6915
|
+
htmlPrompt?: {
|
|
6916
|
+
prompt: string;
|
|
6917
|
+
data?: any;
|
|
6918
|
+
images?: Record<string, any> | undefined;
|
|
6919
|
+
systemPrompt?: string | undefined;
|
|
6920
|
+
} | undefined;
|
|
6791
6921
|
}[];
|
|
6792
6922
|
lang?: string | undefined;
|
|
6793
6923
|
title?: string | undefined;
|
|
@@ -7010,6 +7140,12 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
7010
7140
|
imageNames?: string[] | undefined;
|
|
7011
7141
|
imagePrompt?: string | undefined;
|
|
7012
7142
|
moviePrompt?: string | undefined;
|
|
7143
|
+
htmlPrompt?: {
|
|
7144
|
+
data?: any;
|
|
7145
|
+
images?: Record<string, any> | undefined;
|
|
7146
|
+
systemPrompt?: string | undefined;
|
|
7147
|
+
prompt?: string | undefined;
|
|
7148
|
+
} | undefined;
|
|
7013
7149
|
}[];
|
|
7014
7150
|
lang?: string | undefined;
|
|
7015
7151
|
title?: string | undefined;
|
|
@@ -7569,8 +7705,8 @@ export declare const mulmoScriptTemplateSchema: z.ZodObject<{
|
|
|
7569
7705
|
}>>;
|
|
7570
7706
|
}, "strict", z.ZodTypeAny, {
|
|
7571
7707
|
title: string;
|
|
7572
|
-
description: string;
|
|
7573
7708
|
systemPrompt: string;
|
|
7709
|
+
description: string;
|
|
7574
7710
|
scriptName?: string | undefined;
|
|
7575
7711
|
presentationStyle?: {
|
|
7576
7712
|
audioParams: {
|
|
@@ -7650,8 +7786,8 @@ export declare const mulmoScriptTemplateSchema: z.ZodObject<{
|
|
|
7650
7786
|
} | undefined;
|
|
7651
7787
|
}, {
|
|
7652
7788
|
title: string;
|
|
7653
|
-
description: string;
|
|
7654
7789
|
systemPrompt: string;
|
|
7790
|
+
description: string;
|
|
7655
7791
|
scriptName?: string | undefined;
|
|
7656
7792
|
presentationStyle?: {
|
|
7657
7793
|
$mulmocast: {
|
|
@@ -8206,9 +8342,9 @@ export declare const mulmoScriptTemplateFileSchema: z.ZodObject<{
|
|
|
8206
8342
|
filename: z.ZodString;
|
|
8207
8343
|
}, "strict", z.ZodTypeAny, {
|
|
8208
8344
|
title: string;
|
|
8345
|
+
systemPrompt: string;
|
|
8209
8346
|
description: string;
|
|
8210
8347
|
filename: string;
|
|
8211
|
-
systemPrompt: string;
|
|
8212
8348
|
scriptName?: string | undefined;
|
|
8213
8349
|
presentationStyle?: {
|
|
8214
8350
|
audioParams: {
|
|
@@ -8288,9 +8424,9 @@ export declare const mulmoScriptTemplateFileSchema: z.ZodObject<{
|
|
|
8288
8424
|
} | undefined;
|
|
8289
8425
|
}, {
|
|
8290
8426
|
title: string;
|
|
8427
|
+
systemPrompt: string;
|
|
8291
8428
|
description: string;
|
|
8292
8429
|
filename: string;
|
|
8293
|
-
systemPrompt: string;
|
|
8294
8430
|
scriptName?: string | undefined;
|
|
8295
8431
|
presentationStyle?: {
|
|
8296
8432
|
$mulmocast: {
|
package/lib/types/schema.js
CHANGED
|
@@ -171,6 +171,14 @@ export const audioParamsSchema = z
|
|
|
171
171
|
audioVolume: z.number().default(1.0).describe("Volume of the audio"),
|
|
172
172
|
})
|
|
173
173
|
.strict();
|
|
174
|
+
export const htmlPromptParamsSchema = z
|
|
175
|
+
.object({
|
|
176
|
+
systemPrompt: z.string().default("").optional(),
|
|
177
|
+
prompt: z.string().default(""),
|
|
178
|
+
data: z.any().optional(),
|
|
179
|
+
images: z.record(z.any()).optional(),
|
|
180
|
+
})
|
|
181
|
+
.strict();
|
|
174
182
|
export const mulmoBeatSchema = z
|
|
175
183
|
.object({
|
|
176
184
|
speaker: speakerIdSchema.default("Presenter"),
|
|
@@ -187,6 +195,7 @@ export const mulmoBeatSchema = z
|
|
|
187
195
|
imageNames: z.array(imageIdSchema).optional(), // list of image names to use for image generation. The default is all images in the imageParams.images.
|
|
188
196
|
imagePrompt: z.string().optional(),
|
|
189
197
|
moviePrompt: z.string().optional(),
|
|
198
|
+
htmlPrompt: htmlPromptParamsSchema.optional(),
|
|
190
199
|
})
|
|
191
200
|
.strict();
|
|
192
201
|
export const mulmoCanvasDimensionSchema = z
|
package/lib/types/type.d.ts
CHANGED
|
@@ -79,3 +79,16 @@ export type Text2ImageAgentInfo = {
|
|
|
79
79
|
};
|
|
80
80
|
export type BeatMediaType = "movie" | "image";
|
|
81
81
|
export type StoryToScriptGenerateMode = (typeof storyToScriptGenerateMode)[keyof typeof storyToScriptGenerateMode];
|
|
82
|
+
export type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf";
|
|
83
|
+
export type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie";
|
|
84
|
+
export type SessionProgressEvent = {
|
|
85
|
+
kind: "session";
|
|
86
|
+
sessionType: SessionType;
|
|
87
|
+
inSession: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
kind: "beat";
|
|
90
|
+
sessionType: BeatSessionType;
|
|
91
|
+
index: number;
|
|
92
|
+
inSession: boolean;
|
|
93
|
+
};
|
|
94
|
+
export type SessionProgressCallback = (change: SessionProgressEvent) => void;
|
|
@@ -5,7 +5,7 @@ export type FfmpegContext = {
|
|
|
5
5
|
filterComplex: string[];
|
|
6
6
|
};
|
|
7
7
|
export declare const FfmpegContextInit: () => FfmpegContext;
|
|
8
|
-
export declare const FfmpegContextAddInput: (context: FfmpegContext, input: string) => number;
|
|
8
|
+
export declare const FfmpegContextAddInput: (context: FfmpegContext, input: string, inputOptions?: string[]) => number;
|
|
9
9
|
export declare const FfmpegContextPushFormattedAudio: (context: FfmpegContext, sourceId: string, outputId: string, duration?: number | undefined) => void;
|
|
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>;
|
|
@@ -7,8 +7,13 @@ export const FfmpegContextInit = () => {
|
|
|
7
7
|
filterComplex: [],
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export const FfmpegContextAddInput = (context, input) => {
|
|
11
|
-
|
|
10
|
+
export const FfmpegContextAddInput = (context, input, inputOptions) => {
|
|
11
|
+
if (inputOptions) {
|
|
12
|
+
context.command.input(input).inputOptions(inputOptions);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
context.command.input(input);
|
|
16
|
+
}
|
|
12
17
|
context.inputCount++;
|
|
13
18
|
return context.inputCount - 1; // returned the index of the input
|
|
14
19
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const imageType = "image";
|
|
2
|
-
export declare const process: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
|
|
3
|
-
export declare const path: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
|
|
2
|
+
export declare const process: (params: import("../../index.browser.js").ImageProcessorParams) => string | undefined;
|
|
3
|
+
export declare const path: (params: import("../../index.browser.js").ImageProcessorParams) => string | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const imageType = "movie";
|
|
2
|
-
export declare const process: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
|
|
3
|
-
export declare const path: (params: import("../../index.js").ImageProcessorParams) => string | undefined;
|
|
2
|
+
export declare const process: (params: import("../../index.browser.js").ImageProcessorParams) => string | undefined;
|
|
3
|
+
export declare const path: (params: import("../../index.browser.js").ImageProcessorParams) => string | undefined;
|
|
@@ -211,6 +211,12 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
211
211
|
imageNames?: string[] | undefined;
|
|
212
212
|
imagePrompt?: string | undefined;
|
|
213
213
|
moviePrompt?: string | undefined;
|
|
214
|
+
htmlPrompt?: {
|
|
215
|
+
prompt: string;
|
|
216
|
+
data?: any;
|
|
217
|
+
images?: Record<string, any> | undefined;
|
|
218
|
+
systemPrompt?: string | undefined;
|
|
219
|
+
} | undefined;
|
|
214
220
|
}[];
|
|
215
221
|
lang?: string | undefined;
|
|
216
222
|
title?: string | undefined;
|