mulmocast 0.0.11 → 0.0.12
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 +1 -3
- package/assets/templates/ghibli_shorts.json +34 -0
- package/assets/templates/trailer.json +25 -0
- package/lib/actions/audio.js +29 -16
- package/lib/actions/captions.js +5 -5
- package/lib/actions/images.js +51 -12
- package/lib/actions/movie.js +46 -13
- package/lib/actions/pdf.js +3 -3
- package/lib/actions/translate.js +15 -15
- package/lib/agents/image_openai_agent.js +6 -3
- package/lib/agents/index.d.ts +2 -1
- package/lib/agents/index.js +2 -1
- package/lib/agents/tts_elevenlabs_agent.d.ts +4 -0
- package/lib/agents/tts_elevenlabs_agent.js +60 -0
- package/lib/agents/tts_google_agent.js +1 -1
- package/lib/agents/tts_nijivoice_agent.js +3 -2
- package/lib/agents/tts_openai_agent.js +1 -1
- package/lib/cli/commands/audio/handler.js +4 -1
- package/lib/cli/commands/image/handler.js +4 -1
- package/lib/cli/commands/movie/handler.js +4 -1
- package/lib/cli/commands/pdf/handler.js +4 -1
- package/lib/cli/commands/translate/handler.js +4 -1
- package/lib/cli/helpers.d.ts +3 -3
- package/lib/cli/helpers.js +38 -20
- package/lib/methods/mulmo_media_source.d.ts +1 -0
- package/lib/methods/mulmo_media_source.js +12 -0
- package/lib/methods/mulmo_script.d.ts +1 -0
- package/lib/methods/mulmo_script.js +9 -0
- package/lib/methods/mulmo_studio_context.d.ts +5 -0
- package/lib/methods/mulmo_studio_context.js +23 -0
- package/lib/types/schema.d.ts +1498 -242
- package/lib/types/schema.js +25 -34
- package/lib/types/type.d.ts +4 -1
- package/lib/utils/file.d.ts +4 -15
- package/lib/utils/file.js +2 -13
- package/lib/utils/filters.js +4 -4
- package/lib/utils/image_plugins/beat.d.ts +4 -0
- package/lib/utils/image_plugins/beat.js +7 -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/source.js +2 -2
- package/lib/utils/preprocess.d.ts +24 -20
- package/lib/utils/preprocess.js +4 -0
- package/package.json +1 -1
- package/scripts/templates/movie_prompts_no_text_template.json +50 -0
package/lib/types/schema.js
CHANGED
|
@@ -20,11 +20,13 @@ export const speechOptionsSchema = z
|
|
|
20
20
|
})
|
|
21
21
|
.strict();
|
|
22
22
|
const speakerIdSchema = z.string();
|
|
23
|
+
export const text2SpeechProviderSchema = z.union([z.literal("openai"), z.literal("nijivoice"), z.literal("google"), z.literal("elevenlabs")]).default("openai");
|
|
23
24
|
const speakerDataSchema = z
|
|
24
25
|
.object({
|
|
25
26
|
displayName: z.record(langSchema, z.string()).optional(),
|
|
26
27
|
voiceId: z.string(),
|
|
27
28
|
speechOptions: speechOptionsSchema.optional(),
|
|
29
|
+
provider: text2SpeechProviderSchema.optional(),
|
|
28
30
|
})
|
|
29
31
|
.strict();
|
|
30
32
|
export const speakerDictionarySchema = z.record(speakerIdSchema, speakerDataSchema);
|
|
@@ -103,6 +105,12 @@ export const mulmoHtmlTailwindMediaSchema = z
|
|
|
103
105
|
html: stringOrStringArray,
|
|
104
106
|
})
|
|
105
107
|
.strict();
|
|
108
|
+
export const mulmoBeatReferenceMediaSchema = z
|
|
109
|
+
.object({
|
|
110
|
+
type: z.literal("beat"),
|
|
111
|
+
id: z.string().optional().describe("Specifies the beat to reference."),
|
|
112
|
+
})
|
|
113
|
+
.strict();
|
|
106
114
|
export const mulmoImageAssetSchema = z.union([
|
|
107
115
|
mulmoMarkdownMediaSchema,
|
|
108
116
|
mulmoWebMediaSchema,
|
|
@@ -116,6 +124,7 @@ export const mulmoImageAssetSchema = z.union([
|
|
|
116
124
|
mulmoChartMediaSchema,
|
|
117
125
|
mulmoMermaidMediaSchema,
|
|
118
126
|
mulmoHtmlTailwindMediaSchema,
|
|
127
|
+
mulmoBeatReferenceMediaSchema,
|
|
119
128
|
]);
|
|
120
129
|
const mulmoAudioMediaSchema = z
|
|
121
130
|
.object({
|
|
@@ -144,13 +153,6 @@ export const textSlideParamsSchema = z
|
|
|
144
153
|
cssStyles: stringOrStringArray,
|
|
145
154
|
})
|
|
146
155
|
.strict();
|
|
147
|
-
/* TODO: Add something later
|
|
148
|
-
export const videoParamsSchema = z
|
|
149
|
-
.object({
|
|
150
|
-
padding: z.number().optional(), // msec
|
|
151
|
-
})
|
|
152
|
-
.strict();
|
|
153
|
-
*/
|
|
154
156
|
export const beatAudioParamsSchema = z
|
|
155
157
|
.object({
|
|
156
158
|
padding: z.number().optional().describe("Padding between beats"), // seconds
|
|
@@ -163,12 +165,14 @@ export const audioParamsSchema = z
|
|
|
163
165
|
introPadding: z.number().describe("Padding at the beginning of the audio"), // seconds
|
|
164
166
|
closingPadding: z.number().describe("Padding before the last beat"), // seconds
|
|
165
167
|
outroPadding: z.number().describe("Padding at the end of the audio"), // seconds
|
|
168
|
+
bgm: mediaSourceSchema.optional(),
|
|
166
169
|
})
|
|
167
170
|
.strict();
|
|
168
171
|
export const mulmoBeatSchema = z
|
|
169
172
|
.object({
|
|
170
173
|
speaker: speakerIdSchema.default("Presenter"),
|
|
171
|
-
text: z.string().describe("Text to be spoken. If empty, the audio is not generated."),
|
|
174
|
+
text: z.string().default("").describe("Text to be spoken. If empty, the audio is not generated."),
|
|
175
|
+
id: z.string().optional().describe("Unique identifier for the beat."),
|
|
172
176
|
description: z.string().optional(),
|
|
173
177
|
image: mulmoImageAssetSchema.optional(),
|
|
174
178
|
audio: mulmoAudioAssetSchema.optional(),
|
|
@@ -195,7 +199,6 @@ export const mulmoCastCreditSchema = z
|
|
|
195
199
|
credit: z.literal("closing").optional(),
|
|
196
200
|
})
|
|
197
201
|
.strict();
|
|
198
|
-
export const text2SpeechProviderSchema = z.union([z.literal("openai"), z.literal("nijivoice"), z.literal("google")]).default("openai");
|
|
199
202
|
export const mulmoSpeechParamsSchema = z
|
|
200
203
|
.object({
|
|
201
204
|
provider: text2SpeechProviderSchema, // has default value
|
|
@@ -204,10 +207,15 @@ export const mulmoSpeechParamsSchema = z
|
|
|
204
207
|
.strict();
|
|
205
208
|
export const text2ImageProviderSchema = z.union([z.literal("openai"), z.literal("google")]).default("openai");
|
|
206
209
|
export const text2MovieProviderSchema = z.union([z.literal("openai"), z.literal("google")]).default("google");
|
|
210
|
+
export const mulmoTransitionSchema = z.object({
|
|
211
|
+
type: z.enum(["fade"]),
|
|
212
|
+
duration: z.number().min(0).max(2).default(0.3), // transition duration in seconds
|
|
213
|
+
});
|
|
207
214
|
export const mulmoMovieParamsSchema = z
|
|
208
215
|
.object({
|
|
209
216
|
provider: text2MovieProviderSchema.optional(),
|
|
210
217
|
model: z.string().optional(), // default: provider specific
|
|
218
|
+
transition: mulmoTransitionSchema.optional(),
|
|
211
219
|
})
|
|
212
220
|
.strict();
|
|
213
221
|
export const mulmoPresentationStyleSchema = z.object({
|
|
@@ -231,15 +239,12 @@ export const mulmoPresentationStyleSchema = z.object({
|
|
|
231
239
|
movieParams: mulmoMovieParamsSchema.optional(),
|
|
232
240
|
// for textSlides
|
|
233
241
|
textSlideParams: textSlideParamsSchema.optional(),
|
|
234
|
-
// videoParams: videoParamsSchema.optional(),
|
|
235
242
|
audioParams: audioParamsSchema.default({
|
|
236
243
|
introPadding: 1.0,
|
|
237
244
|
padding: 0.3,
|
|
238
245
|
closingPadding: 0.8,
|
|
239
246
|
outroPadding: 1.0,
|
|
240
247
|
}),
|
|
241
|
-
// TODO: Switch to showCaptions later
|
|
242
|
-
omitCaptions: z.boolean().optional(), // default is false
|
|
243
248
|
});
|
|
244
249
|
export const mulmoReferenceSchema = z.object({
|
|
245
250
|
url: URLStringSchema,
|
|
@@ -284,11 +289,11 @@ export const mulmoSessionStateSchema = z.object({
|
|
|
284
289
|
pdf: z.boolean(),
|
|
285
290
|
}),
|
|
286
291
|
inBeatSession: z.object({
|
|
287
|
-
audio: z.
|
|
288
|
-
image: z.
|
|
289
|
-
movie: z.
|
|
290
|
-
multiLingual: z.
|
|
291
|
-
caption: z.
|
|
292
|
+
audio: z.record(z.number().int(), z.boolean()),
|
|
293
|
+
image: z.record(z.number().int(), z.boolean()),
|
|
294
|
+
movie: z.record(z.number().int(), z.boolean()),
|
|
295
|
+
multiLingual: z.record(z.number().int(), z.boolean()),
|
|
296
|
+
caption: z.record(z.number().int(), z.boolean()),
|
|
292
297
|
}),
|
|
293
298
|
});
|
|
294
299
|
export const mulmoStudioSchema = z
|
|
@@ -297,23 +302,6 @@ export const mulmoStudioSchema = z
|
|
|
297
302
|
filename: z.string(),
|
|
298
303
|
beats: z.array(mulmoStudioBeatSchema).min(1),
|
|
299
304
|
multiLingual: mulmoStudioMultiLingualSchema,
|
|
300
|
-
state: mulmoSessionStateSchema.default({
|
|
301
|
-
inSession: {
|
|
302
|
-
audio: false,
|
|
303
|
-
image: false,
|
|
304
|
-
video: false,
|
|
305
|
-
multiLingual: false,
|
|
306
|
-
caption: false,
|
|
307
|
-
pdf: false,
|
|
308
|
-
},
|
|
309
|
-
inBeatSession: {
|
|
310
|
-
audio: new Set(),
|
|
311
|
-
image: new Set(),
|
|
312
|
-
movie: new Set(),
|
|
313
|
-
multiLingual: new Set(),
|
|
314
|
-
caption: new Set(),
|
|
315
|
-
},
|
|
316
|
-
}),
|
|
317
305
|
})
|
|
318
306
|
.strict();
|
|
319
307
|
export const mulmoScriptTemplateSchema = z
|
|
@@ -325,6 +313,9 @@ export const mulmoScriptTemplateSchema = z
|
|
|
325
313
|
presentationStyle: mulmoPresentationStyleSchema.optional(),
|
|
326
314
|
})
|
|
327
315
|
.strict();
|
|
316
|
+
export const mulmoScriptTemplateFileSchema = mulmoScriptTemplateSchema.extend({
|
|
317
|
+
filename: z.string(),
|
|
318
|
+
});
|
|
328
319
|
export const mulmoStoryboardSceneSchema = z
|
|
329
320
|
.object({
|
|
330
321
|
description: z.string(),
|
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, text2ImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoPresentationStyleSchema, multiLingualTextsSchema, mulmoMermaidMediaSchema, mulmoTextSlideMediaSchema, mulmoMarkdownMediaSchema, mulmoImageMediaSchema, mulmoChartMediaSchema, mediaSourceSchema } from "./schema.js";
|
|
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";
|
|
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";
|
|
@@ -22,6 +22,7 @@ export type MulmoStudioBeat = z.infer<typeof mulmoStudioBeatSchema>;
|
|
|
22
22
|
export type MulmoMediaSource = z.infer<typeof mediaSourceSchema>;
|
|
23
23
|
export type MulmoStudio = z.infer<typeof mulmoStudioSchema>;
|
|
24
24
|
export type MulmoScriptTemplate = z.infer<typeof mulmoScriptTemplateSchema>;
|
|
25
|
+
export type MulmoScriptTemplateFile = z.infer<typeof mulmoScriptTemplateFileSchema>;
|
|
25
26
|
export type MulmoStudioMultiLingual = z.infer<typeof mulmoStudioMultiLingualSchema>;
|
|
26
27
|
export type MulmoStudioMultiLingualData = z.infer<typeof mulmoStudioMultiLingualDataSchema>;
|
|
27
28
|
export type MultiLingualTexts = z.infer<typeof multiLingualTextsSchema>;
|
|
@@ -31,6 +32,7 @@ export type MulmoMarkdownMedia = z.infer<typeof mulmoMarkdownMediaSchema>;
|
|
|
31
32
|
export type MulmoImageMedia = z.infer<typeof mulmoImageMediaSchema>;
|
|
32
33
|
export type MulmoChartMedia = z.infer<typeof mulmoChartMediaSchema>;
|
|
33
34
|
export type MulmoMermaidMedia = z.infer<typeof mulmoMermaidMediaSchema>;
|
|
35
|
+
export type MulmoSessionState = z.infer<typeof mulmoSessionStateSchema>;
|
|
34
36
|
export type FileDirs = {
|
|
35
37
|
mulmoFilePath: string;
|
|
36
38
|
mulmoFileDirPath: string;
|
|
@@ -45,6 +47,7 @@ export type MulmoStudioContext = {
|
|
|
45
47
|
lang?: string;
|
|
46
48
|
force: boolean;
|
|
47
49
|
caption?: string;
|
|
50
|
+
sessionState: MulmoSessionState;
|
|
48
51
|
};
|
|
49
52
|
export type ScriptingParams = {
|
|
50
53
|
urls: string[];
|
package/lib/utils/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MulmoScript,
|
|
1
|
+
import { MulmoScript, MulmoScriptTemplateFile } 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;
|
|
@@ -14,16 +14,8 @@ export declare function readMulmoScriptFile<T = MulmoScript>(path: string): {
|
|
|
14
14
|
} | null;
|
|
15
15
|
export declare const fetchMulmoScriptFile: (url: string) => Promise<{
|
|
16
16
|
result: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} | {
|
|
20
|
-
result: boolean;
|
|
21
|
-
script: any;
|
|
22
|
-
status?: undefined;
|
|
23
|
-
} | {
|
|
24
|
-
result: boolean;
|
|
25
|
-
status: string;
|
|
26
|
-
script?: undefined;
|
|
17
|
+
script?: MulmoScript;
|
|
18
|
+
status: string | number;
|
|
27
19
|
}>;
|
|
28
20
|
export declare const getOutputStudioFilePath: (outDirPath: string, fileName: string) => string;
|
|
29
21
|
export declare const resolveDirPath: (dirPath: string, studioFileName: string) => string;
|
|
@@ -44,9 +36,6 @@ export declare const getBaseDirPath: (basedir?: string) => string;
|
|
|
44
36
|
export declare const getFullPath: (baseDirPath: string | undefined, file: string) => string;
|
|
45
37
|
export declare const readScriptTemplateFile: (scriptName: string) => any;
|
|
46
38
|
export declare const readTemplatePrompt: (templateName: string) => string;
|
|
47
|
-
export declare const getAvailableTemplates: () =>
|
|
48
|
-
filename: string;
|
|
49
|
-
})[];
|
|
39
|
+
export declare const getAvailableTemplates: () => MulmoScriptTemplateFile[];
|
|
50
40
|
export declare const writingMessage: (filePath: string) => void;
|
|
51
|
-
export declare const resolveMediaSource: (source: MulmoMediaSource, context: MulmoStudioContext) => string | null;
|
|
52
41
|
export declare const readAndParseJson: <S extends ZodSchema<any>>(filePath: string, schema: S) => ReturnType<S["parse"]>;
|
package/lib/utils/file.js
CHANGED
|
@@ -4,7 +4,6 @@ import { parse as yamlParse } from "yaml";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { GraphAILogger } from "graphai";
|
|
6
6
|
import { MulmoScriptTemplateMethods } from "../methods/mulmo_script_template.js";
|
|
7
|
-
import { MulmoStudioContextMethods } from "../methods/index.js";
|
|
8
7
|
import { mulmoScriptTemplateSchema } from "../types/schema.js";
|
|
9
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
9
|
const __dirname = path.dirname(__filename);
|
|
@@ -17,7 +16,6 @@ export function readMulmoScriptFile(arg2, errorMessage) {
|
|
|
17
16
|
if (!fs.existsSync(scriptPath)) {
|
|
18
17
|
if (errorMessage) {
|
|
19
18
|
GraphAILogger.info(errorMessage);
|
|
20
|
-
process.exit(1);
|
|
21
19
|
}
|
|
22
20
|
return null;
|
|
23
21
|
}
|
|
@@ -34,7 +32,6 @@ export function readMulmoScriptFile(arg2, errorMessage) {
|
|
|
34
32
|
catch (__error) {
|
|
35
33
|
if (errorMessage) {
|
|
36
34
|
GraphAILogger.info("read file format is broken.");
|
|
37
|
-
process.exit(1);
|
|
38
35
|
}
|
|
39
36
|
return null;
|
|
40
37
|
}
|
|
@@ -45,10 +42,11 @@ export const fetchMulmoScriptFile = async (url) => {
|
|
|
45
42
|
if (!res.ok) {
|
|
46
43
|
return { result: false, status: res.status };
|
|
47
44
|
}
|
|
48
|
-
const script = await res.json();
|
|
45
|
+
const script = (await res.json());
|
|
49
46
|
return {
|
|
50
47
|
result: true,
|
|
51
48
|
script,
|
|
49
|
+
status: 200,
|
|
52
50
|
};
|
|
53
51
|
}
|
|
54
52
|
catch {
|
|
@@ -162,15 +160,6 @@ export const getAvailableTemplates = () => {
|
|
|
162
160
|
export const writingMessage = (filePath) => {
|
|
163
161
|
GraphAILogger.debug(`writing: ${filePath}`);
|
|
164
162
|
};
|
|
165
|
-
export const resolveMediaSource = (source, context) => {
|
|
166
|
-
if (source.kind === "path") {
|
|
167
|
-
return MulmoStudioContextMethods.resolveAssetPath(context, source.path);
|
|
168
|
-
}
|
|
169
|
-
if (source.kind === "url") {
|
|
170
|
-
return source.url;
|
|
171
|
-
}
|
|
172
|
-
return null;
|
|
173
|
-
};
|
|
174
163
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
164
|
export const readAndParseJson = (filePath, schema) => {
|
|
176
165
|
const fileContent = fs.readFileSync(filePath, "utf-8");
|
package/lib/utils/filters.js
CHANGED
|
@@ -5,10 +5,10 @@ import fsPromise from "fs/promises";
|
|
|
5
5
|
import { GraphAILogger } from "graphai";
|
|
6
6
|
import { writingMessage } from "./file.js";
|
|
7
7
|
import { text2hash } from "./utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
|
|
9
9
|
export const fileCacheAgentFilter = async (context, next) => {
|
|
10
10
|
const { namedInputs } = context;
|
|
11
|
-
const { file, force,
|
|
11
|
+
const { file, force, mulmoContext, index, sessionType } = namedInputs;
|
|
12
12
|
const shouldUseCache = async () => {
|
|
13
13
|
if (force) {
|
|
14
14
|
return false;
|
|
@@ -25,7 +25,7 @@ export const fileCacheAgentFilter = async (context, next) => {
|
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
MulmoStudioContextMethods.setBeatSessionState(mulmoContext, sessionType, index, true);
|
|
29
29
|
const output = (await next(context));
|
|
30
30
|
const buffer = output ? output["buffer"] : undefined;
|
|
31
31
|
if (buffer) {
|
|
@@ -37,7 +37,7 @@ export const fileCacheAgentFilter = async (context, next) => {
|
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
39
|
finally {
|
|
40
|
-
|
|
40
|
+
MulmoStudioContextMethods.setBeatSessionState(mulmoContext, sessionType, index, false);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
export const browserlessCacheGenerator = (cacheDir) => {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ImageProcessorParams } from "../../types/index.js";
|
|
2
|
+
export declare const imageType = "beat";
|
|
3
|
+
export declare const processBeatReference: (__: ImageProcessorParams) => Promise<undefined>;
|
|
4
|
+
export declare const process: (__: ImageProcessorParams) => Promise<undefined>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const imageType = "beat";
|
|
2
|
+
export const processBeatReference = async (__) => {
|
|
3
|
+
// For beat reference, return undefined to indicate no image should be generated
|
|
4
|
+
// The actual reference will be resolved in mergeResult
|
|
5
|
+
return undefined;
|
|
6
|
+
};
|
|
7
|
+
export const process = processBeatReference;
|
|
@@ -5,4 +5,5 @@ import * as pluginChart from "./chart.js";
|
|
|
5
5
|
import * as pluginMermaid from "./mermaid.js";
|
|
6
6
|
import * as pluginMovie from "./movie.js";
|
|
7
7
|
import * as pluginHtmlTailwind from "./html_tailwind.js";
|
|
8
|
-
|
|
8
|
+
import * as pluginBeat from "./beat.js";
|
|
9
|
+
export declare const imagePlugins: (typeof pluginTextSlide | typeof pluginMarkdown | typeof pluginImage | typeof pluginChart | typeof pluginMermaid | typeof pluginMovie | typeof pluginHtmlTailwind | typeof pluginBeat)[];
|
|
@@ -5,4 +5,5 @@ import * as pluginChart from "./chart.js";
|
|
|
5
5
|
import * as pluginMermaid from "./mermaid.js";
|
|
6
6
|
import * as pluginMovie from "./movie.js";
|
|
7
7
|
import * as pluginHtmlTailwind from "./html_tailwind.js";
|
|
8
|
-
|
|
8
|
+
import * as pluginBeat from "./beat.js";
|
|
9
|
+
export const imagePlugins = [pluginTextSlide, pluginMarkdown, pluginImage, pluginChart, pluginMermaid, pluginMovie, pluginHtmlTailwind, pluginBeat];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GraphAILogger } from "graphai";
|
|
2
|
-
import {
|
|
2
|
+
import { MulmoMediaSourceMethods } from "../../methods/mulmo_media_source.js";
|
|
3
3
|
export const processSource = (imageType) => {
|
|
4
4
|
return (params) => {
|
|
5
5
|
const { beat, context } = params;
|
|
6
6
|
if (!beat.image || beat.image.type !== imageType)
|
|
7
7
|
return;
|
|
8
|
-
const path =
|
|
8
|
+
const path = MulmoMediaSourceMethods.resolve(beat.image.source, context);
|
|
9
9
|
if (path) {
|
|
10
10
|
return path;
|
|
11
11
|
}
|
|
@@ -23,6 +23,19 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
23
23
|
introPadding: number;
|
|
24
24
|
closingPadding: number;
|
|
25
25
|
outroPadding: number;
|
|
26
|
+
bgm?: {
|
|
27
|
+
url: string;
|
|
28
|
+
kind: "url";
|
|
29
|
+
} | {
|
|
30
|
+
kind: "base64";
|
|
31
|
+
data: string;
|
|
32
|
+
} | {
|
|
33
|
+
text: string;
|
|
34
|
+
kind: "text";
|
|
35
|
+
} | {
|
|
36
|
+
path: string;
|
|
37
|
+
kind: "path";
|
|
38
|
+
} | undefined;
|
|
26
39
|
};
|
|
27
40
|
$mulmocast: {
|
|
28
41
|
version: "1.0";
|
|
@@ -33,7 +46,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
33
46
|
height: number;
|
|
34
47
|
};
|
|
35
48
|
speechParams: {
|
|
36
|
-
provider: "openai" | "nijivoice" | "google";
|
|
49
|
+
provider: "openai" | "nijivoice" | "google" | "elevenlabs";
|
|
37
50
|
speakers: Record<string, {
|
|
38
51
|
voiceId: string;
|
|
39
52
|
displayName?: Record<string, string> | undefined;
|
|
@@ -41,6 +54,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
41
54
|
speed?: number | undefined;
|
|
42
55
|
instruction?: string | undefined;
|
|
43
56
|
} | undefined;
|
|
57
|
+
provider?: "openai" | "nijivoice" | "google" | "elevenlabs" | undefined;
|
|
44
58
|
}>;
|
|
45
59
|
};
|
|
46
60
|
beats: {
|
|
@@ -133,6 +147,9 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
133
147
|
} | {
|
|
134
148
|
type: "html_tailwind";
|
|
135
149
|
html: string | string[];
|
|
150
|
+
} | {
|
|
151
|
+
type: "beat";
|
|
152
|
+
id?: string | undefined;
|
|
136
153
|
} | {
|
|
137
154
|
type: "movie";
|
|
138
155
|
source: {
|
|
@@ -150,6 +167,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
150
167
|
};
|
|
151
168
|
mixAudio: number;
|
|
152
169
|
} | undefined;
|
|
170
|
+
id?: string | undefined;
|
|
153
171
|
audio?: {
|
|
154
172
|
type: "audio";
|
|
155
173
|
source: {
|
|
@@ -230,10 +248,13 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
230
248
|
cssStyles: string | string[];
|
|
231
249
|
} | undefined;
|
|
232
250
|
movieParams?: {
|
|
233
|
-
model?: string | undefined;
|
|
234
251
|
provider?: "openai" | "google" | undefined;
|
|
252
|
+
model?: string | undefined;
|
|
253
|
+
transition?: {
|
|
254
|
+
type: "fade";
|
|
255
|
+
duration: number;
|
|
256
|
+
} | undefined;
|
|
235
257
|
} | undefined;
|
|
236
|
-
omitCaptions?: boolean | undefined;
|
|
237
258
|
references?: {
|
|
238
259
|
type: "image" | "audio" | "article" | "paper" | "video";
|
|
239
260
|
url: string;
|
|
@@ -244,21 +265,4 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
244
265
|
__test_invalid__?: boolean | undefined;
|
|
245
266
|
};
|
|
246
267
|
filename: string;
|
|
247
|
-
state: {
|
|
248
|
-
inSession: {
|
|
249
|
-
pdf: boolean;
|
|
250
|
-
image: boolean;
|
|
251
|
-
audio: boolean;
|
|
252
|
-
video: boolean;
|
|
253
|
-
multiLingual: boolean;
|
|
254
|
-
caption: boolean;
|
|
255
|
-
};
|
|
256
|
-
inBeatSession: {
|
|
257
|
-
image: Set<number>;
|
|
258
|
-
movie: Set<number>;
|
|
259
|
-
audio: Set<number>;
|
|
260
|
-
multiLingual: Set<number>;
|
|
261
|
-
caption: Set<number>;
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
268
|
};
|
package/lib/utils/preprocess.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { GraphAILogger } from "graphai";
|
|
1
2
|
import { mulmoScriptSchema, mulmoBeatSchema, mulmoStudioSchema } from "../types/index.js";
|
|
2
3
|
const rebuildStudio = (currentStudio, mulmoScript, fileName) => {
|
|
3
4
|
const parsed = mulmoStudioSchema.safeParse(currentStudio);
|
|
4
5
|
if (parsed.success) {
|
|
5
6
|
return parsed.data;
|
|
6
7
|
}
|
|
8
|
+
if (currentStudio) {
|
|
9
|
+
GraphAILogger.info("currentStudio is invalid", parsed.error);
|
|
10
|
+
}
|
|
7
11
|
// We need to parse it to fill default values
|
|
8
12
|
return mulmoStudioSchema.parse({
|
|
9
13
|
script: mulmoScript,
|
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$mulmocast": {
|
|
3
|
+
"version": "1.0",
|
|
4
|
+
"credit": "closing"
|
|
5
|
+
},
|
|
6
|
+
"title": "[TITLE: Brief, engaging title for the topic]",
|
|
7
|
+
"lang": "en",
|
|
8
|
+
"references": [
|
|
9
|
+
{
|
|
10
|
+
"url": "[SOURCE_URL: URL of the source material]",
|
|
11
|
+
"title": "[SOURCE_TITLE: Title of the referenced article, or paper]",
|
|
12
|
+
"type": "[SOURCE_TYPE: article, paper]"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"movieParams": {
|
|
16
|
+
"provider": "google"
|
|
17
|
+
},
|
|
18
|
+
"beats": [
|
|
19
|
+
{
|
|
20
|
+
"duration": 5.0,
|
|
21
|
+
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]",
|
|
22
|
+
"moviePrompt": "[MOVIE_PROMPT: A movie prompt for that image.]"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"duration": 5.0,
|
|
26
|
+
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]",
|
|
27
|
+
"moviePrompt": "[MOVIE_PROMPT: A movie prompt for that image.]"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"duration": 5.0,
|
|
31
|
+
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]",
|
|
32
|
+
"moviePrompt": "[MOVIE_PROMPT: A movie prompt for that image.]"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"duration": 5.0,
|
|
36
|
+
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]",
|
|
37
|
+
"moviePrompt": "[MOVIE_PROMPT: A movie prompt for that image.]"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"duration": 5.0,
|
|
41
|
+
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]",
|
|
42
|
+
"moviePrompt": "[MOVIE_PROMPT: A movie prompt for that image.]"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"duration": 5.0,
|
|
46
|
+
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]",
|
|
47
|
+
"moviePrompt": "[MOVIE_PROMPT: A movie prompt for that image.]"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|