mulmocast 0.0.19 → 0.0.21
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 +44 -36
- package/assets/templates/ghibli_image_only.json +28 -0
- package/lib/actions/images.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 -1
- package/lib/index.browser.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/methods/mulmo_studio_context.d.ts +1 -15
- package/lib/types/type.d.ts +13 -0
- package/lib/utils/image_plugins/image.d.ts +2 -2
- package/lib/utils/image_plugins/movie.d.ts +2 -2
- package/package.json +6 -9
- package/scripts/templates/image_prompt_only_template.json +0 -6
- package/lib/agents/image_mock_agent.d.ts +0 -4
- package/lib/agents/image_mock_agent.js +0 -18
- package/lib/agents/mulmo_prompts_agent.d.ts +0 -7
- package/lib/agents/mulmo_prompts_agent.js +0 -37
- package/lib/agents/prompts_data.d.ts +0 -15
- package/lib/agents/prompts_data.js +0 -16
- package/lib/agents/validate_mulmo_script_agent.d.ts +0 -17
- package/lib/agents/validate_mulmo_script_agent.js +0 -34
- package/lib/cli/args.d.ts +0 -15
- package/lib/cli/args.js +0 -62
- package/lib/cli/cli.d.ts +0 -17
- package/lib/cli/cli.js +0 -117
- package/lib/cli/run.d.ts +0 -2
- package/lib/cli/run.js +0 -3
- package/lib/cli/tool-args.d.ts +0 -16
- package/lib/cli/tool-args.js +0 -64
- package/lib/cli/tool-cli.d.ts +0 -2
- package/lib/cli/tool-cli.js +0 -69
- package/lib/methods/mulmo_script.d.ts +0 -11
- package/lib/methods/mulmo_script.js +0 -59
- package/lib/methods/mulmo_studio.d.ts +0 -8
- package/lib/methods/mulmo_studio.js +0 -24
- package/lib/tools/prompt.d.ts +0 -1
- package/lib/tools/prompt.js +0 -18
- package/lib/utils/image_plugins/tailwind.d.ts +0 -3
- package/lib/utils/image_plugins/tailwind.js +0 -18
- package/lib/utils/pdf.d.ts +0 -9
- package/lib/utils/pdf.js +0 -77
package/README.md
CHANGED
|
@@ -288,14 +288,16 @@ Positionals:
|
|
|
288
288
|
file Mulmo Script File [string] [required]
|
|
289
289
|
|
|
290
290
|
Options:
|
|
291
|
-
--version
|
|
292
|
-
-v, --verbose
|
|
293
|
-
-h, --help
|
|
294
|
-
-o, --outdir
|
|
295
|
-
-b, --basedir
|
|
296
|
-
-l, --lang
|
|
297
|
-
-f, --force
|
|
298
|
-
|
|
291
|
+
--version Show version number [boolean]
|
|
292
|
+
-v, --verbose verbose log [boolean] [required] [default: false]
|
|
293
|
+
-h, --help Show help [boolean]
|
|
294
|
+
-o, --outdir output dir [string]
|
|
295
|
+
-b, --basedir base dir [string]
|
|
296
|
+
-l, --lang target language [string] [choices: "en", "ja"]
|
|
297
|
+
-f, --force Force regenerate [boolean] [default: false]
|
|
298
|
+
--dryRun Dry run [boolean] [default: false]
|
|
299
|
+
-p, --presentationStyle Presentation Style [string]
|
|
300
|
+
-a, --audiodir Audio output directory [string]
|
|
299
301
|
```
|
|
300
302
|
|
|
301
303
|
```
|
|
@@ -307,14 +309,16 @@ Positionals:
|
|
|
307
309
|
file Mulmo Script File [string] [required]
|
|
308
310
|
|
|
309
311
|
Options:
|
|
310
|
-
--version
|
|
311
|
-
-v, --verbose
|
|
312
|
-
-h, --help
|
|
313
|
-
-o, --outdir
|
|
314
|
-
-b, --basedir
|
|
315
|
-
-l, --lang
|
|
316
|
-
-f, --force
|
|
317
|
-
|
|
312
|
+
--version Show version number [boolean]
|
|
313
|
+
-v, --verbose verbose log [boolean] [required] [default: false]
|
|
314
|
+
-h, --help Show help [boolean]
|
|
315
|
+
-o, --outdir output dir [string]
|
|
316
|
+
-b, --basedir base dir [string]
|
|
317
|
+
-l, --lang target language [string] [choices: "en", "ja"]
|
|
318
|
+
-f, --force Force regenerate [boolean] [default: false]
|
|
319
|
+
--dryRun Dry run [boolean] [default: false]
|
|
320
|
+
-p, --presentationStyle Presentation Style [string]
|
|
321
|
+
-i, --imagedir Image output directory [string]
|
|
318
322
|
```
|
|
319
323
|
|
|
320
324
|
```
|
|
@@ -326,16 +330,18 @@ Positionals:
|
|
|
326
330
|
file Mulmo Script File [string] [required]
|
|
327
331
|
|
|
328
332
|
Options:
|
|
329
|
-
--version
|
|
330
|
-
-v, --verbose
|
|
331
|
-
-h, --help
|
|
332
|
-
-o, --outdir
|
|
333
|
-
-b, --basedir
|
|
334
|
-
-l, --lang
|
|
335
|
-
-f, --force
|
|
336
|
-
|
|
337
|
-
-
|
|
338
|
-
-
|
|
333
|
+
--version Show version number [boolean]
|
|
334
|
+
-v, --verbose verbose log [boolean] [required] [default: false]
|
|
335
|
+
-h, --help Show help [boolean]
|
|
336
|
+
-o, --outdir output dir [string]
|
|
337
|
+
-b, --basedir base dir [string]
|
|
338
|
+
-l, --lang target language [string] [choices: "en", "ja"]
|
|
339
|
+
-f, --force Force regenerate [boolean] [default: false]
|
|
340
|
+
--dryRun Dry run [boolean] [default: false]
|
|
341
|
+
-p, --presentationStyle Presentation Style [string]
|
|
342
|
+
-a, --audiodir Audio output directory [string]
|
|
343
|
+
-i, --imagedir Image output directory [string]
|
|
344
|
+
-c, --caption Video captions [string] [choices: "en", "ja"]
|
|
339
345
|
```
|
|
340
346
|
|
|
341
347
|
```
|
|
@@ -347,17 +353,19 @@ Positionals:
|
|
|
347
353
|
file Mulmo Script File [string] [required]
|
|
348
354
|
|
|
349
355
|
Options:
|
|
350
|
-
--version
|
|
351
|
-
-v, --verbose
|
|
352
|
-
-h, --help
|
|
353
|
-
-o, --outdir
|
|
354
|
-
-b, --basedir
|
|
355
|
-
-l, --lang
|
|
356
|
-
-f, --force
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
--version Show version number [boolean]
|
|
357
|
+
-v, --verbose verbose log [boolean] [required] [default: false]
|
|
358
|
+
-h, --help Show help [boolean]
|
|
359
|
+
-o, --outdir output dir [string]
|
|
360
|
+
-b, --basedir base dir [string]
|
|
361
|
+
-l, --lang target language [string] [choices: "en", "ja"]
|
|
362
|
+
-f, --force Force regenerate [boolean] [default: false]
|
|
363
|
+
--dryRun Dry run [boolean] [default: false]
|
|
364
|
+
-p, --presentationStyle Presentation Style [string]
|
|
365
|
+
-i, --imagedir Image output directory [string]
|
|
366
|
+
--pdf_mode PDF mode
|
|
359
367
|
[string] [choices: "slide", "talk", "handout"] [default: "slide"]
|
|
360
|
-
--pdf_size
|
|
368
|
+
--pdf_size PDF paper size (default: letter)
|
|
361
369
|
[choices: "letter", "a4"] [default: "letter"]
|
|
362
370
|
```
|
|
363
371
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Ghibli comic image-only",
|
|
3
|
+
"description": "Template for Ghibli-style image-only comic presentation.",
|
|
4
|
+
"systemPrompt": "Generate a script for a presentation of the given topic. Another AI will generate an image for each beat based on the text description of that beat. Use the JSON below as a template.",
|
|
5
|
+
"presentationStyle": {
|
|
6
|
+
"$mulmocast": {
|
|
7
|
+
"version": "1.0",
|
|
8
|
+
"credit": "closing"
|
|
9
|
+
},
|
|
10
|
+
"canvasSize": {
|
|
11
|
+
"width": 1536,
|
|
12
|
+
"height": 1024
|
|
13
|
+
},
|
|
14
|
+
"imageParams": {
|
|
15
|
+
"style": "<style>Ghibli style</style>",
|
|
16
|
+
"images": {
|
|
17
|
+
"presenter": {
|
|
18
|
+
"type": "image",
|
|
19
|
+
"source": {
|
|
20
|
+
"kind": "url",
|
|
21
|
+
"url": "https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/ghibli_presenter.png"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"scriptName": "image_prompt_only_template.json"
|
|
28
|
+
}
|
package/lib/actions/images.js
CHANGED
|
@@ -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
package/lib/index.d.ts
CHANGED
package/lib/index.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/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;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types":
|
|
10
|
-
"node": "./lib/index.d.ts",
|
|
11
|
-
"browser": "./lib/index.browser.d.ts",
|
|
12
|
-
"default": "./lib/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"node": "./lib/index.js",
|
|
15
|
-
"browser": "./lib/index.browser.js",
|
|
9
|
+
"types": "./lib/index.d.ts",
|
|
16
10
|
"default": "./lib/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./browser": {
|
|
13
|
+
"types": "./lib/index.browser.d.ts",
|
|
14
|
+
"default": "./lib/index.browser.js"
|
|
17
15
|
}
|
|
18
16
|
},
|
|
19
17
|
"bin": {
|
|
@@ -26,7 +24,6 @@
|
|
|
26
24
|
"./assets/html/",
|
|
27
25
|
"./assets/templates/"
|
|
28
26
|
],
|
|
29
|
-
"types": "./lib/types/index.d.ts",
|
|
30
27
|
"directories": {
|
|
31
28
|
"lib": "lib",
|
|
32
29
|
"test": "tests"
|
|
@@ -6,27 +6,21 @@
|
|
|
6
6
|
"title": "[TITLE: Brief, engaging title for the topic]",
|
|
7
7
|
"beats": [
|
|
8
8
|
{
|
|
9
|
-
"duration": 5,
|
|
10
9
|
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
|
|
11
10
|
},
|
|
12
11
|
{
|
|
13
|
-
"duration": 5,
|
|
14
12
|
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
|
|
15
13
|
},
|
|
16
14
|
{
|
|
17
|
-
"duration": 5,
|
|
18
15
|
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
|
|
19
16
|
},
|
|
20
17
|
{
|
|
21
|
-
"duration": 5,
|
|
22
18
|
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
|
|
23
19
|
},
|
|
24
20
|
{
|
|
25
|
-
"duration": 5,
|
|
26
21
|
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
|
|
27
22
|
},
|
|
28
23
|
{
|
|
29
|
-
"duration": 5,
|
|
30
24
|
"imagePrompt": "[IMAGE_PROMPT: A prompt for the image to be generated for this beat.]"
|
|
31
25
|
}
|
|
32
26
|
]
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { GraphAILogger } from "graphai";
|
|
2
|
-
export const imageMockAgent = async () => {
|
|
3
|
-
GraphAILogger.debug("agent dryRun");
|
|
4
|
-
return { buffer: Buffer.from([]) };
|
|
5
|
-
};
|
|
6
|
-
const imageMockAgentInfo = {
|
|
7
|
-
name: "imageMockAgent",
|
|
8
|
-
agent: imageMockAgent,
|
|
9
|
-
mock: imageMockAgent,
|
|
10
|
-
samples: [],
|
|
11
|
-
description: "Image mock agent",
|
|
12
|
-
category: ["image"],
|
|
13
|
-
author: "Receptron Team",
|
|
14
|
-
repository: "https://github.com/receptron/mulmocast-cli/",
|
|
15
|
-
license: "MIT",
|
|
16
|
-
environmentVariables: [],
|
|
17
|
-
};
|
|
18
|
-
export default imageMockAgentInfo;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AgentFunction, AgentFunctionInfo } from "graphai";
|
|
2
|
-
import { prompts } from "./prompts_data.js";
|
|
3
|
-
export declare const mulmoPromptsAgent: AgentFunction<{
|
|
4
|
-
promptKey: keyof typeof prompts;
|
|
5
|
-
}>;
|
|
6
|
-
declare const mulmoPromptsAgentInfo: AgentFunctionInfo;
|
|
7
|
-
export default mulmoPromptsAgentInfo;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { prompts } from "./prompts_data.js";
|
|
2
|
-
export const mulmoPromptsAgent = async ({ params }) => {
|
|
3
|
-
const { promptKey } = params;
|
|
4
|
-
if (promptKey) {
|
|
5
|
-
const prompt = prompts[promptKey];
|
|
6
|
-
if (prompt) {
|
|
7
|
-
return {
|
|
8
|
-
text: prompt,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return prompts;
|
|
13
|
-
};
|
|
14
|
-
const mulmoPromptsAgentInfo = {
|
|
15
|
-
name: "mulmoPromptsAgent",
|
|
16
|
-
agent: mulmoPromptsAgent,
|
|
17
|
-
mock: mulmoPromptsAgent,
|
|
18
|
-
samples: [
|
|
19
|
-
{
|
|
20
|
-
inputs: {},
|
|
21
|
-
params: {
|
|
22
|
-
promptKey: "abstract",
|
|
23
|
-
},
|
|
24
|
-
result: {
|
|
25
|
-
text: "We need to add a summary at the beginning of script, which summarizes this episode, which is very engaging. Please come up with a few sentences for the announcer to read, enter them into this script, and present it as an artifact.",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
description: "Prompts Agent",
|
|
30
|
-
category: ["prompt"],
|
|
31
|
-
author: "Receptron team",
|
|
32
|
-
repository: "https://github.com/receptron/mulmocast-cli",
|
|
33
|
-
source: "https://github.com/receptron/mulmocast-cli/tree/main/src/agents/prompts_agent.ts",
|
|
34
|
-
// package: "@graphai/prompts",
|
|
35
|
-
license: "MIT",
|
|
36
|
-
};
|
|
37
|
-
export default mulmoPromptsAgentInfo;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const prompts: {
|
|
2
|
-
abstract: string;
|
|
3
|
-
image_prompt: string;
|
|
4
|
-
prompt: string;
|
|
5
|
-
prompt2: string;
|
|
6
|
-
prompt3: string;
|
|
7
|
-
prompt_eng3: string;
|
|
8
|
-
prompt_seed: string;
|
|
9
|
-
prompt_seed_materials: string;
|
|
10
|
-
prompt_taro: string;
|
|
11
|
-
prompt_taro3_json: string;
|
|
12
|
-
prompt_taro3_json2: string;
|
|
13
|
-
prompt_taro_json: string;
|
|
14
|
-
summary: string;
|
|
15
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by src/tools/prompt.ts and Do not be edited manually.
|
|
2
|
-
export const prompts = {
|
|
3
|
-
abstract: "We need to add a summary at the beginning of script, which summarizes this episode, which is very engaging. Please come up with a few sentences for the announcer to read, enter them into this script, and present it as an artifact.",
|
|
4
|
-
image_prompt: 'We need to generate a series of images for this podcast. For each line of given json, generate an appropriate text prompt for text-2-image AI, considering the flow of whole discussion and add it as "imagePrompt" property to the script. We don\'t want to show student, teacher or classroom in the image. Do not eliminate any lines.\n\n[Examples]\nA modern tech conference stage with a speaker discussing AI advancements, futuristic lighting and a large digital screen displaying AI-related graphics.\nA close-up of an AI executive speaking at a press conference, with a backdrop displaying AI chip designs and a world map.\nA futuristic AI research lab with glowing blue data streams and a large AI model being visualized on a digital display.\nA high-tech meeting room with analysts discussing global AI trends, holographic charts displaying AI development.\nA balanced scale with AI progress on one side and economic factors on the other, symbolizing analysis and perspective.\nA newspaper headline about a breakthrough in AI technology, with digital code overlaying the article.\nA timeline showing the gradual evolution of AI models, with key milestones highlighted.\n',
|
|
5
|
-
prompt: 'generate a podcast script based on this topic in the JSON format using the opening statement below. Monologue by the Host. Complete story.\nClearly mention the news source.\nNews source:\nArticle url: ...\n\n```json\n{\n "title": "(title of this episode)",\n "description": "(short description of this episode)",\n "reference": "(url to the article)",\n "tts": "openAI", // or "nijivoice", default is "openAI"\n "speakers": {\n "Host": {\n "voiceId": "shimmer",\n "displayName": {\n "en": "Host"\n }\n },\n },\n "beats": [\n {\n "speaker": "Host",\n "text": "Hello and welcome to another episode of \'life is artificial\', where we explore the cutting edge of technology, innovation, and what the future could look like.",\n },\n {\n "speaker": "Host",\n "text": "Today, ...",\n },\n ...\n ]\n}\n```\n\n',
|
|
6
|
-
prompt2: 'generate a podcast interview script of Steve Jobs about Elon Musk and his achievements with Tesla and SpaceX, in the JSON format using the opening statement below. \n\n```json\n{\n title: "(title of this episode)",\n description: "(short description of this episode)",\n script:[\n {\n speaker: "Host",\n text: "Hello and welcome to another episode of \'life is artificial\', where we explore the cutting edge of technology, innovation, and what the future could look like.",\n },\n {\n speaker: "Host",\n text: "Today, ...",\n }\n ]\n}\n```\n\n',
|
|
7
|
-
prompt3: 'Turn this interview into a script in the follwing JSON format without remove any discussions between host and guest, but remove unnecessary text like advertisements. \n\n```json\n{\n "title": "(title of this episode)",\n "description": "(short description of this episode)",\n "script":[\n {\n "speaker": "Host",\n "text": "Hello, thank you for taking an interview from me.",\n },\n {\n "speaker": "Guest",\n "text": "You are welcome",\n }\n ]\n}\n```\n',
|
|
8
|
-
prompt_eng3: 'Please create a script as an artifact in the form of a conversation between a Student and a Teacher, with the goal of explaining everything about this topic in a way that even a middle schooler can understand. However, be sure to cover all the key points. The opening line should always start with an introduction by an Announcer, saying:\n"Welcome to another episode of Life is Beautiful by Satoshi Nakajima."\nBelow, I’ll provide an example on a different topic in JSON format. Please follow this format.\n\n{\n "title": "Martial Law in Korea and Its Impact on Japan",\n "description": "An insightful discussion about the recently declared martial law in Korea and its potential implications, including parallels with constitutional considerations in Japan.",\n "tts": "openAI",\n "voices": [\n "nova",\n "echo",\n "shimmer"\n ],\n "speakers": ["Announcer", "Student", "Teacher"],\n "script": [\n {\n "speaker": "Announcer",\n "text": "Welcome to another episode of Life is Beautiful by Satoshi Nakajima."\n },\n {\n "speaker": "Announcer",\n "text": "Today\'s topic is about the recently declared martial law in Korea."\n },\n {\n "speaker": "Student",\n "text": "Could you tell me about the martial law that was declared in Korea?"\n },\n {\n "speaker": "Teacher",\n "text": "Of course. Recently, the president in Korea suddenly declared what we call \'martial law.\'"\n },\n {\n "speaker": "Student",\n "text": "What is martial law?"\n },\n {\n "speaker": "Teacher",\n "text": "Simply put, it\'s a measure used to restrict people\'s freedoms using the military when the country is in an extremely dangerous situation. For example, they can prohibit political activities and control public gatherings."\n },\n {\n "speaker": "Student",\n "text": "That\'s scary. Why did they do that?"\n },\n {\n "speaker": "Teacher",\n "text": "While the president claimed it was because \'the National Assembly wasn\'t functioning properly,\' it appears he used it to protect his own position. The military then tried to enter the National Assembly and arrest the assembly members."\n },\n {\n "speaker": "Student",\n "text": "What!? Trying to arrest National Assembly members sounds really dangerous!"\n },\n {\n "speaker": "Teacher",\n "text": "That\'s right. If the military had occupied the National Assembly, they might not have been able to lift the martial law there. In other words, the president could have controlled the country as he wished indefinitely."\n },\n {\n "speaker": "Student",\n "text": "What happened in Korea?"\n },\n {\n "speaker": "Teacher",\n "text": "Fortunately, opposition party members and citizens quickly gathered to protest, and the martial law was lifted after six hours. But it was a close call - Korea\'s democracy could have been severely damaged."\n },\n {\n "speaker": "Student",\n "text": "That\'s serious... Could something like this happen in Japan?"\n },\n {\n "speaker": "Teacher",\n "text": "Actually, there\'s a similar discussion happening in Japan right now. The Liberal Democratic Party is trying to add an \'emergency declaration\' clause to the constitution."\n },\n {\n "speaker": "Student",\n "text": "Is the emergency declaration similar to Korea\'s martial law?"\n },\n {\n "speaker": "Teacher",\n "text": "There are similarities. For instance, if the Prime Minister claims there\'s a \'risk of social order disruption,\' they can use special powers to run the country. They can issue orders with the same force as laws and give directions to local governments."\n },\n {\n "speaker": "Student",\n "text": "That sounds convenient, but I\'m worried."\n },\n {\n "speaker": "Teacher",\n "text": "Yes, you\'re right. While it\'s useful to respond quickly in emergencies, it can be very dangerous if these powers are abused. For example, the Prime Minister might run the country in ways that benefit them or take away people\'s freedoms."\n },\n {\n "speaker": "Student",\n "text": "Could the military get involved in politics like in Korea?"\n },\n {\n "speaker": "Teacher",\n "text": "We can\'t completely rule it out, which is why we need to be careful. We citizens need to closely monitor whether the LDP\'s constitutional amendment proposal includes appropriate restrictions to prevent abuse of power and speak up. It\'s important for each of us to take an active interest in preventing damage to our democracy."\n }\n ]\n}',
|
|
9
|
-
prompt_seed: 'Please generate a podcast script based on the topic provided by the user.\nIf there are any unclear points, be sure to ask the user questions and clarify them before generating the script.\nThe output should follow the JSON format specified below.\n\n```json\n{\n "title": "(title of this episode)",\n "description": "(short description of this episode)",\n "reference": "(url to the article)",\n "tts": "openAI", // or "nijivoice", default is "openAI"\n "speakers": {\n "Host": {\n "voiceId": "shimmer",\n "displayName": {\n "en": "Host"\n }\n },\n },\n "beats": [\n {\n "speaker": "Host",\n "text": "Hello and welcome to another episode of \'life is artificial\', where we explore the cutting edge of technology, innovation, and what the future could look like.",\n },\n {\n "speaker": "Host",\n "text": "Today, ...",\n },\n ...\n ]\n}\n```\n\n',
|
|
10
|
-
prompt_seed_materials: 'Generate a podcast script based on the materials provided by the user. The script should follow the JSON format specified below.\n\n```json\n{\n "title": "(title of this episode)",\n "description": "(short description of this episode)",\n "reference": "(url to the article)",\n "tts": "openAI", // or "nijivoice", default is "openAI"\n "speechParams": {\n "speakers": {\n "Host": {\n "voiceId": "shimmer",\n "displayName": {\n "en": "Host"\n }\n }\n }\n },\n "beats": [\n {\n "speaker": "Host",\n "text": "Hello and welcome to another episode of \'life is artificial\', where we explore the cutting edge of technology, innovation, and what the future could look like.",\n },\n {\n "speaker": "Host",\n "text": "Today, ...",\n },\n ...\n ]\n}\n```\n',
|
|
11
|
-
prompt_taro: "この件について、内容全てを小学生にも分かるように、太郎くんと先生の会話、という形の台本にしてください。以下に別のトピックに関するサンプルを貼り付けます。\n\n太郎:先生、今日は原子炉の「冷温停止」について説明していただけますか?\n\n先生:もちろんだよ。でも同じ「冷温停止」でも言う人によって色々な意味があって、簡単じゃあないんだよ。\n\n太郎:そうなんですか。\n\n先生:もともとはね、「冷温停止」とは「制御棒を挿入して核反応を止めた後、冷却水を循環させて原子炉の温度を安定的に100度以下に保つ事」の意味なんだけどね、福島第一の場合はそうはいかないんだ。\n\n太郎:メルトダウンしてしまっているからですね。\n\n先生:そうなんだ、核燃料は本来なら燃料棒という形で原子炉の中に整然と並んでいるはずなんだが、福島第一の場合、それが熱で溶けて流れ落ちてしまった上に、その熱で原子炉にも、その外側にある格納容器にも穴が空いてしまっているんだ。\n\n太郎:じゃあ、いったいどうやってそれを安定して冷却するんですか?\n\n先生:それがとっても大変なんだよ。分かりやすくするために、トイレに例えてみよう。君のうちには水洗トイレがあるよね。\n\n太郎:もちろんです。ウォシュレットだって付いてます。\n\n先生:君のうちにあるトイレみたいに、使った後にはちゃんと汚いものを流してくれるトイレを「安定したトイレ」と呼ぶことにしよう。\n\n太郎:はい。\n\n先生:福島第一のトイレは、まず水を流すためのタンクがこわれちゃっているんだ。\n\n太郎:あの、トイレの上についている四角いタンクですね。\n\n先生:福島第一の場合、あのタンクが壊れているんで、仕方がなく洗面台からホースで水を引っ張って来て流しているんだ。\n\n太郎:ずいぶん不便ですね。\n\n先生:でも、問題はそれだけじゃなくて、便器も壊れて穴が空いちゃっているんだ。\n\n太郎:ええ、それじゃあ、トイレの床が水びたしじゃないですか。\n\n先生:そうだよ。それも水だけじゃなくて、便とか尿とかも穴から漏れているんだ。\n\n太郎:それはひどいですね。",
|
|
12
|
-
prompt_taro3_json: 'この件について、内容全てを中学生にも分かるように、太郎くん(Student)と先生(Teacher)の会話、という形の台本をArtifactとして作って。ただし要点はしっかりと押さえて。\n最初の一言は、Announcerによるトピックの紹介にし、常に、"米国で活躍するエンジニアが新しい技術やビジネスを分かりやすく解説する、中島聡のLife is beautiful。"でスタートして。\n以下に別のトピックに関するサンプルを貼り付けます。このJSONフォーマットに従って。\n\n{\n "title": "韓国の戒厳令とその日本への影響",\n "description": "韓国で最近発令された戒厳令とその可能性のある影響について、また日本の憲法に関する考慮事項との類似点を含めた洞察に満ちた議論。",\n "tts": "nijivoice",\n "voices": [\n "c05bf02d-bed2-4335-aa69-0798e9e85205",\n "b9277ce3-ba1c-4f6f-9a65-c05ca102ded0",\n "bc06c63f-fef6-43b6-92f7-67f919bd5dae"\n ],\n "speakers": ["Announcer", "Student", "Teacher"],\n "script": [\n {\n "speaker": "Announcer",\n "text": "米国で活躍するエンジニアが、新しい技術やビジネスを分かりやすく解説する、中島聡のLife is beautiful。今日は、韓国で最近発令された戒厳令についての解説です。"\n },\n {\n "speaker": "Student",\n "text": "先生、今日は韓国で起きた戒厳令のことを教えてもらえますか?"\n },\n {\n "speaker": "Teacher",\n "text": "もちろんだよ、太郎くん。韓国で最近、大統領が「戒厳令」っていうのを突然宣言したんだ。"\n },\n {\n "speaker": "Student",\n "text": "戒厳令ってなんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "簡単に言うと、国がすごく危ない状態にあるとき、軍隊を使って人々の自由を制限するためのものなんだ。たとえば、政治活動を禁止したり、人の集まりを取り締まったりするんだよ。"\n },\n {\n "speaker": "Student",\n "text": "それって怖いですね。なんでそんなことをしたんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "大統領は「国会がうまく機能していないから」と言っていたけど、実際には自分の立場を守るために使ったように見えるんだ。それで、軍隊が国会に突入して、議員たちを捕まえようとしたんだ。"\n },\n {\n "speaker": "Student",\n "text": "ええっ!?国会議員を捕まえようとするなんて、すごく危ないことじゃないですか。"\n },\n {\n "speaker": "Teacher",\n "text": "その通りだよ。もし軍隊が国会を占拠していたら、国会で戒厳令を解除することもできなかったかもしれない。つまり、大統領がずっと自分の好きなように国を支配できるようになってしまうんだ。"\n },\n {\n "speaker": "Student",\n "text": "韓国ではどうなったんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "幸い、野党の議員や市民たちが急いで集まって抗議して、6時間後に戒厳令は解除されたんだ。でも、ほんの少しの違いで、韓国の民主主義が大きく傷つけられるところだったんだよ。"\n },\n {\n "speaker": "Student",\n "text": "それは大変なことですね…。日本ではそんなこと起きないんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "実はね、今、日本でも似たような話があるんだよ。自民党が「緊急事態宣言」を憲法に追加しようとしているんだ。"\n },\n {\n "speaker": "Student",\n "text": "緊急事態宣言って、韓国の戒厳令と同じようなものなんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "似ている部分があるね。たとえば、総理大臣が「社会秩序の混乱の危険があるから」と言えば、特別な権限を使って国を動かすことができるんだ。法律と同じ力を持つ命令を出したり、地方自治体に指示を出したりすることができるんだよ。"\n },\n {\n "speaker": "Student",\n "text": "それって便利そうですけど、なんだか心配です。"\n },\n {\n "speaker": "Teacher",\n "text": "そうだね。もちろん、緊急時には素早い対応が必要だから便利な面もあるけど、その権限が濫用されると、とても危険なんだ。たとえば、総理大臣が自分に都合のいいように国を動かしたり、国民の自由を奪ったりすることができるようになってしまうかもしれない。"\n },\n {\n "speaker": "Student",\n "text": "韓国みたいに、軍隊が政治に口を出してくることもあり得るんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "完全にあり得ないとは言えないからこそ、注意が必要なんだ。私たち国民は、自民党の改憲案が権力の濫用を防ぐための適切な制限を含んでいるのかをしっかり監視し、声を上げることが求められる。民主主義が損なわれるのを防ぐために、私たち一人ひとりが積極的に関心を持つことが大切なんだよ。"\n },\n {\n "speaker": "Student",\n "text": "ありがとうございます。とても良い勉強になりました。"\n }\n ]\n}',
|
|
13
|
-
prompt_taro3_json2: 'この件について、内容全てを高校生にも分かるように、太郎くん(Student)と先生(Teacher)の会話、という形の台本をArtifactとして作って。ただし要点はしっかりと押さえて。\n以下に別のトピックに関するサンプルを貼り付けます。このJSONフォーマットに従って。\n\n{\n "title": "韓国の戒厳令とその日本への影響",\n "description": "韓国で最近発令された戒厳令とその可能性のある影響について、また日本の憲法に関する考慮事項との類似点を含めた洞察に満ちた議論。",\n "tts": "nijivoice",\n "voices": [\n "afd7df65-0fdc-4d31-ae8b-a29f0f5eed62",\n "a7619e48-bf6a-4f9f-843f-40485651257f",\n "bc06c63f-fef6-43b6-92f7-67f919bd5dae"\n ],\n "charactors": ["春玲", "森野颯太", "ベン・カーター"],\n "speakers": ["Announcer", "Student", "Teacher"],\n "script": [\n {\n "speaker": "Student",\n "text": "先生、今日は韓国で起きた戒厳令のことを教えてもらえますか?"\n },\n {\n "speaker": "Teacher",\n "text": "もちろんだよ、太郎くん。韓国で最近、大統領が「戒厳令」っていうのを突然宣言したんだ。"\n },\n {\n "speaker": "Student",\n "text": "戒厳令ってなんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "簡単に言うと、国がすごく危ない状態にあるとき、軍隊を使って人々の自由を制限するためのものなんだ。たとえば、政治活動を禁止したり、人の集まりを取り締まったりするんだよ。"\n },\n {\n "speaker": "Student",\n "text": "それって怖いですね。なんでそんなことをしたんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "大統領は「国会がうまく機能していないから」と言っていたけど、実際には自分の立場を守るために使ったように見えるんだ。それで、軍隊が国会に突入して、議員たちを捕まえようとしたんだ。"\n },\n {\n "speaker": "Student",\n "text": "ええっ!?国会議員を捕まえようとするなんて、すごく危ないことじゃないですか。"\n },\n {\n "speaker": "Teacher",\n "text": "その通りだよ。もし軍隊が国会を占拠していたら、国会で戒厳令を解除することもできなかったかもしれない。つまり、大統領がずっと自分の好きなように国を支配できるようになってしまうんだ。"\n },\n {\n "speaker": "Student",\n "text": "韓国ではどうなったんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "幸い、野党の議員や市民たちが急いで集まって抗議して、6時間後に戒厳令は解除されたんだ。でも、ほんの少しの違いで、韓国の民主主義が大きく傷つけられるところだったんだよ。"\n },\n {\n "speaker": "Student",\n "text": "それは大変なことですね…。日本ではそんなこと起きないんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "実はね、今、日本でも似たような話があるんだよ。自民党が「緊急事態宣言」を憲法に追加しようとしているんだ。"\n },\n {\n "speaker": "Student",\n "text": "緊急事態宣言って、韓国の戒厳令と同じようなものなんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "似ている部分があるね。たとえば、総理大臣が「社会秩序の混乱の危険があるから」と言えば、特別な権限を使って国を動かすことができるんだ。法律と同じ力を持つ命令を出したり、地方自治体に指示を出したりすることができるんだよ。"\n },\n {\n "speaker": "Student",\n "text": "それって便利そうですけど、なんだか心配です。"\n },\n {\n "speaker": "Teacher",\n "text": "そうだね。もちろん、緊急時には素早い対応が必要だから便利な面もあるけど、その権限が濫用されると、とても危険なんだ。たとえば、総理大臣が自分に都合のいいように国を動かしたり、国民の自由を奪ったりすることができるようになってしまうかもしれない。"\n },\n {\n "speaker": "Student",\n "text": "韓国みたいに、軍隊が政治に口を出してくることもあり得るんですか?"\n },\n {\n "speaker": "Teacher",\n "text": "完全にあり得ないとは言えないからこそ、注意が必要なんだ。私たち国民は、自民党の改憲案が権力の濫用を防ぐための適切な制限を含んでいるのかをしっかり監視し、声を上げることが求められる。民主主義が損なわれるのを防ぐために、私たち一人ひとりが積極的に関心を持つことが大切なんだよ。"\n },\n {\n "speaker": "Student",\n "text": "ありがとうございます。とても良い勉強になりました。"\n },\n {\n "speaker": "Announcer",\n "text": "ご視聴、ありがとうございました。次回の放送もお楽しみに。"\n }\n ]\n}',
|
|
14
|
-
prompt_taro_json: 'この件について、内容全てを小学生にも分かるように、太郎くん(Guest)と先生(Host)の会話、という形の台本にしてください。以下に別のトピックに関するサンプルを貼り付けます。このJSONフォーマットに従ってください。\n\n{\n "title": "韓国の戒厳令とその日本への影響",\n "description": "韓国で最近発令された戒厳令とその可能性のある影響について、また日本の憲法に関する考慮事項との類似点を含めた洞察に満ちた議論。",\n "tts": "nijivoice",\n "script": [\n {\n "speaker": "Host",\n "text": "先生、今日は韓国で起きた戒厳令のことを教えてもらえますか?"\n },\n {\n "speaker": "Guest",\n "text": "もちろんだよ、太郎くん。韓国で最近、大統領が「戒厳令」っていうのを突然宣言したんだ。"\n },\n {\n "speaker": "Host",\n "text": "戒厳令ってなんですか?"\n },\n {\n "speaker": "Guest",\n "text": "簡単に言うと、国がすごく危ない状態にあるとき、軍隊を使って人々の自由を制限するためのものなんだ。たとえば、政治活動を禁止したり、人の集まりを取り締まったりするんだよ。"\n },\n {\n "speaker": "Host",\n "text": "それって怖いですね。なんでそんなことをしたんですか?"\n },\n {\n "speaker": "Guest",\n "text": "大統領は「国会がうまく機能していないから」と言っていたけど、実際には自分の立場を守るために使ったように見えるんだ。それで、軍隊が国会に突入して、議員たちを捕まえようとしたんだ。"\n },\n {\n "speaker": "Host",\n "text": "ええっ!?国会議員を捕まえようとするなんて、すごく危ないことじゃないですか。"\n },\n {\n "speaker": "Guest",\n "text": "その通りだよ。もし軍隊が国会を占拠していたら、国会で戒厳令を解除することもできなかったかもしれない。つまり、大統領がずっと自分の好きなように国を支配できるようになってしまうんだ。"\n },\n {\n "speaker": "Host",\n "text": "韓国ではどうなったんですか?"\n },\n {\n "speaker": "Guest",\n "text": "幸い、野党の議員や市民たちが急いで集まって抗議して、6時間後に戒厳令は解除されたんだ。でも、ほんの少しの違いで、韓国の民主主義が大きく傷つけられるところだったんだよ。"\n },\n {\n "speaker": "Host",\n "text": "それは大変なことですね…。日本ではそんなこと起きないんですか?"\n },\n {\n "speaker": "Guest",\n "text": "実はね、今、日本でも似たような話があるんだよ。自民党が「緊急事態宣言」を憲法に追加しようとしているんだ。"\n },\n {\n "speaker": "Host",\n "text": "緊急事態宣言って、韓国の戒厳令と同じようなものなんですか?"\n },\n {\n "speaker": "Guest",\n "text": "似ている部分があるね。たとえば、総理大臣が「社会秩序の混乱の危険があるから」と言えば、特別な権限を使って国を動かすことができるんだ。法律と同じ力を持つ命令を出したり、地方自治体に指示を出したりすることができるんだよ。"\n },\n {\n "speaker": "Host",\n "text": "それって便利そうですけど、なんだか心配です。"\n },\n {\n "speaker": "Guest",\n "text": "そうだね。もちろん、緊急時には素早い対応が必要だから便利な面もあるけど、その権限が濫用されると、とても危険なんだ。たとえば、総理大臣が自分に都合のいいように国を動かしたり、国民の自由を奪ったりすることができるようになってしまうかもしれない。"\n },\n {\n "speaker": "Host",\n "text": "韓国みたいに、軍隊が政治に口を出してくることもあり得るんですか?"\n },\n {\n "speaker": "Guest",\n "text": "完全にあり得ないとは言えないからこそ、注意が必要なんだ。私たち国民は、自民党の改憲案が権力の濫用を防ぐための適切な制限を含んでいるのかをしっかり監視し、声を上げることが求められる。民主主義が損なわれるのを防ぐために、私たち一人ひとりが積極的に関心を持つことが大切なんだよ。"\n }\n ]\n}',
|
|
15
|
-
summary: "We need to add a summary at the end of script, which summarizes this episode. Please come up with a few sentences for the announcer to read, enter them into this script, and present it as an artifact.",
|
|
16
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AgentFunction, AgentFunctionInfo, DefaultConfigData } from "graphai";
|
|
2
|
-
import { MulmoScript } from "../types/index.js";
|
|
3
|
-
interface ValidateMulmoScriptInputs {
|
|
4
|
-
text: string;
|
|
5
|
-
}
|
|
6
|
-
interface ValidateMulmoScriptResponse {
|
|
7
|
-
isValid: boolean;
|
|
8
|
-
data?: MulmoScript;
|
|
9
|
-
error?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* MulmoScript JSON validation agent
|
|
13
|
-
* Validates if a JSON string conforms to the MulmoScript schema
|
|
14
|
-
*/
|
|
15
|
-
export declare const validateMulmoScriptAgent: AgentFunction<object, ValidateMulmoScriptResponse, ValidateMulmoScriptInputs, DefaultConfigData>;
|
|
16
|
-
declare const validateMulmoScriptAgentInfo: AgentFunctionInfo;
|
|
17
|
-
export default validateMulmoScriptAgentInfo;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { mulmoScriptSchema } from "../types/schema.js";
|
|
2
|
-
/**
|
|
3
|
-
* MulmoScript JSON validation agent
|
|
4
|
-
* Validates if a JSON string conforms to the MulmoScript schema
|
|
5
|
-
*/
|
|
6
|
-
export const validateMulmoScriptAgent = async ({ namedInputs, }) => {
|
|
7
|
-
const { text } = namedInputs;
|
|
8
|
-
try {
|
|
9
|
-
const jsonData = JSON.parse(text);
|
|
10
|
-
const parsed = mulmoScriptSchema.parse(jsonData);
|
|
11
|
-
return {
|
|
12
|
-
isValid: true,
|
|
13
|
-
data: parsed,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return {
|
|
18
|
-
isValid: false,
|
|
19
|
-
error: error instanceof Error ? error.message : String(error),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const validateMulmoScriptAgentInfo = {
|
|
24
|
-
name: "validateMulmoScriptAgent",
|
|
25
|
-
agent: validateMulmoScriptAgent,
|
|
26
|
-
mock: validateMulmoScriptAgent,
|
|
27
|
-
samples: [],
|
|
28
|
-
description: "Validates if a JSON string conforms to the MulmoScript schema",
|
|
29
|
-
category: ["validation"],
|
|
30
|
-
author: "Receptron Team",
|
|
31
|
-
repository: "https://github.com/receptron/mulmocast-cli/tree/main/src/agents/validate_script_agent.ts",
|
|
32
|
-
license: "MIT",
|
|
33
|
-
};
|
|
34
|
-
export default validateMulmoScriptAgentInfo;
|
package/lib/cli/args.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const getArgs: () => {
|
|
2
|
-
[x: string]: unknown;
|
|
3
|
-
v: boolean;
|
|
4
|
-
o: string | undefined;
|
|
5
|
-
b: string | undefined;
|
|
6
|
-
l: string | undefined;
|
|
7
|
-
a: string | undefined;
|
|
8
|
-
i: string | undefined;
|
|
9
|
-
f: boolean;
|
|
10
|
-
c: string | undefined;
|
|
11
|
-
pdf_mode: string;
|
|
12
|
-
pdf_size: string;
|
|
13
|
-
_: (string | number)[];
|
|
14
|
-
$0: string;
|
|
15
|
-
};
|
package/lib/cli/args.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import yargs from "yargs";
|
|
2
|
-
import { hideBin } from "yargs/helpers";
|
|
3
|
-
import { commonOptions } from "./common.js";
|
|
4
|
-
import { pdf_modes, pdf_sizes, languages } from "../utils/const.js";
|
|
5
|
-
export const getArgs = () => {
|
|
6
|
-
return commonOptions(yargs(hideBin(process.argv)))
|
|
7
|
-
.scriptName("mulmo")
|
|
8
|
-
.option("a", {
|
|
9
|
-
alias: "audiodir",
|
|
10
|
-
description: "audio dir",
|
|
11
|
-
demandOption: false,
|
|
12
|
-
type: "string",
|
|
13
|
-
})
|
|
14
|
-
.option("i", {
|
|
15
|
-
alias: "imagedir",
|
|
16
|
-
description: "image dir",
|
|
17
|
-
demandOption: false,
|
|
18
|
-
type: "string",
|
|
19
|
-
})
|
|
20
|
-
.option("f", {
|
|
21
|
-
alias: "force",
|
|
22
|
-
description: "force generate",
|
|
23
|
-
demandOption: false,
|
|
24
|
-
default: false,
|
|
25
|
-
type: "boolean",
|
|
26
|
-
})
|
|
27
|
-
.option("c", {
|
|
28
|
-
alias: "caption",
|
|
29
|
-
description: "Video captions",
|
|
30
|
-
choices: languages,
|
|
31
|
-
demandOption: false,
|
|
32
|
-
type: "string",
|
|
33
|
-
})
|
|
34
|
-
.option("pdf_mode", {
|
|
35
|
-
description: "pdf mode",
|
|
36
|
-
demandOption: false,
|
|
37
|
-
choices: pdf_modes,
|
|
38
|
-
type: "string",
|
|
39
|
-
default: "slide",
|
|
40
|
-
})
|
|
41
|
-
.option("pdf_size", {
|
|
42
|
-
choices: pdf_sizes,
|
|
43
|
-
default: "letter",
|
|
44
|
-
describe: "PDF paper size (default: letter for US standard)",
|
|
45
|
-
})
|
|
46
|
-
.command("$0 <action> <file>", "Run mulmocast", (yargs) => {
|
|
47
|
-
return yargs
|
|
48
|
-
.positional("action", {
|
|
49
|
-
describe: "action to perform",
|
|
50
|
-
choices: ["translate", "audio", "images", "movie", "pdf"],
|
|
51
|
-
type: "string",
|
|
52
|
-
})
|
|
53
|
-
.positional("file", {
|
|
54
|
-
describe: "Mulmo Script File",
|
|
55
|
-
type: "string",
|
|
56
|
-
});
|
|
57
|
-
})
|
|
58
|
-
.strict()
|
|
59
|
-
.help()
|
|
60
|
-
.alias("help", "h")
|
|
61
|
-
.parseSync();
|
|
62
|
-
};
|
package/lib/cli/cli.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import "dotenv/config";
|
|
3
|
-
export declare const getFileObject: (_args: {
|
|
4
|
-
[x: string]: unknown;
|
|
5
|
-
}) => {
|
|
6
|
-
baseDirPath: string;
|
|
7
|
-
mulmoFilePath: string;
|
|
8
|
-
mulmoFileDirPath: string;
|
|
9
|
-
outDirPath: string;
|
|
10
|
-
imageDirPath: string;
|
|
11
|
-
audioDirPath: string;
|
|
12
|
-
isHttpPath: boolean;
|
|
13
|
-
fileOrUrl: string;
|
|
14
|
-
outputStudioFilePath: string;
|
|
15
|
-
fileName: string;
|
|
16
|
-
};
|
|
17
|
-
export declare const main: () => Promise<void>;
|
package/lib/cli/cli.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import "dotenv/config";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { GraphAILogger } from "graphai";
|
|
6
|
-
import { getArgs } from "./args.js";
|
|
7
|
-
import { createOrUpdateStudioData } from "../utils/preprocess.js";
|
|
8
|
-
import { outDirName, imageDirName, audioDirName } from "../utils/const.js";
|
|
9
|
-
import { translate, audio, images, movie, pdf, captions } from "../actions/index.js";
|
|
10
|
-
import { getBaseDirPath, getFullPath, readMulmoScriptFile, fetchMulmoScriptFile, getOutputStudioFilePath, resolveDirPath } from "../utils/file.js";
|
|
11
|
-
import { isHttp } from "../utils/utils.js";
|
|
12
|
-
import clipboardy from "clipboardy";
|
|
13
|
-
export const getFileObject = (_args) => {
|
|
14
|
-
const { basedir, file, outdir, imagedir, audiodir } = _args;
|
|
15
|
-
const baseDirPath = getBaseDirPath(basedir);
|
|
16
|
-
const outDirPath = getFullPath(baseDirPath, outdir ?? outDirName);
|
|
17
|
-
const { fileOrUrl, fileName } = (() => {
|
|
18
|
-
if (file === "__clipboard") {
|
|
19
|
-
// We generate a new unique script file from clipboard text in the output directory
|
|
20
|
-
const now = new Date();
|
|
21
|
-
const pad = (n) => n.toString().padStart(2, "0");
|
|
22
|
-
const fileName = `script_${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
23
|
-
const clipboardText = clipboardy.readSync();
|
|
24
|
-
const fileOrUrl = resolveDirPath(outDirPath, `${fileName}.json`);
|
|
25
|
-
fs.writeFileSync(fileOrUrl, clipboardText, "utf8");
|
|
26
|
-
return { fileOrUrl, fileName };
|
|
27
|
-
}
|
|
28
|
-
const fileOrUrl = file ?? "";
|
|
29
|
-
const fileName = path.parse(fileOrUrl).name;
|
|
30
|
-
return { fileOrUrl, fileName };
|
|
31
|
-
})();
|
|
32
|
-
const isHttpPath = isHttp(fileOrUrl);
|
|
33
|
-
const mulmoFilePath = isHttpPath ? "" : getFullPath(baseDirPath, fileOrUrl);
|
|
34
|
-
const mulmoFileDirPath = path.dirname(isHttpPath ? baseDirPath : mulmoFilePath);
|
|
35
|
-
const imageDirPath = getFullPath(outDirPath, imagedir ?? imageDirName);
|
|
36
|
-
const audioDirPath = getFullPath(outDirPath, audiodir ?? audioDirName);
|
|
37
|
-
const outputStudioFilePath = getOutputStudioFilePath(outDirPath, fileName);
|
|
38
|
-
return { baseDirPath, mulmoFilePath, mulmoFileDirPath, outDirPath, imageDirPath, audioDirPath, isHttpPath, fileOrUrl, outputStudioFilePath, fileName };
|
|
39
|
-
};
|
|
40
|
-
const fetchScript = async (isHttpPath, mulmoFilePath, fileOrUrl) => {
|
|
41
|
-
if (isHttpPath) {
|
|
42
|
-
const res = await fetchMulmoScriptFile(fileOrUrl);
|
|
43
|
-
if (!res.result || !res.script) {
|
|
44
|
-
GraphAILogger.info(`ERROR: HTTP error! ${res.status} ${fileOrUrl}`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
return res.script;
|
|
48
|
-
}
|
|
49
|
-
if (!fs.existsSync(mulmoFilePath)) {
|
|
50
|
-
GraphAILogger.info(`ERROR: File not exists ${mulmoFilePath}`);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
return readMulmoScriptFile(mulmoFilePath, "ERROR: File does not exist " + mulmoFilePath).mulmoData;
|
|
54
|
-
};
|
|
55
|
-
export const main = async () => {
|
|
56
|
-
const args = getArgs();
|
|
57
|
-
const files = getFileObject(args);
|
|
58
|
-
const { mulmoFilePath, isHttpPath, fileOrUrl, fileName, outputStudioFilePath } = files;
|
|
59
|
-
if (args.v) {
|
|
60
|
-
GraphAILogger.info(files);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
GraphAILogger.setLevelEnabled("error", false);
|
|
64
|
-
GraphAILogger.setLevelEnabled("log", false);
|
|
65
|
-
GraphAILogger.setLevelEnabled("warn", false);
|
|
66
|
-
}
|
|
67
|
-
const { action, f: force, pdf_mode, pdf_size, l: lang, c: caption } = args;
|
|
68
|
-
const mulmoScript = await fetchScript(isHttpPath, mulmoFilePath, fileOrUrl);
|
|
69
|
-
// Create or update MulmoStudio file with MulmoScript
|
|
70
|
-
const currentStudio = readMulmoScriptFile(outputStudioFilePath);
|
|
71
|
-
const studio = (() => {
|
|
72
|
-
try {
|
|
73
|
-
// validate mulmoStudioSchema. skip if __test_invalid__ is true
|
|
74
|
-
return createOrUpdateStudioData(mulmoScript, currentStudio?.mulmoData, fileName);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
GraphAILogger.info(`Error: invalid MulmoScript Schema: ${isHttpPath ? fileOrUrl : mulmoFilePath} \n ${error}`);
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
})();
|
|
81
|
-
const context = {
|
|
82
|
-
studio,
|
|
83
|
-
fileDirs: files,
|
|
84
|
-
force: Boolean(force),
|
|
85
|
-
lang: lang,
|
|
86
|
-
caption: caption,
|
|
87
|
-
};
|
|
88
|
-
if (action === "translate" || lang || caption) {
|
|
89
|
-
GraphAILogger.log("run translate");
|
|
90
|
-
await translate(context);
|
|
91
|
-
}
|
|
92
|
-
if (action === "audio") {
|
|
93
|
-
await audio(context);
|
|
94
|
-
}
|
|
95
|
-
if (action === "images") {
|
|
96
|
-
await images(context);
|
|
97
|
-
}
|
|
98
|
-
if (action === "movie") {
|
|
99
|
-
if (caption) {
|
|
100
|
-
await captions(context);
|
|
101
|
-
}
|
|
102
|
-
await audio(context);
|
|
103
|
-
await images(context);
|
|
104
|
-
await movie(context);
|
|
105
|
-
}
|
|
106
|
-
if (action === "pdf") {
|
|
107
|
-
await images(context);
|
|
108
|
-
await pdf(context, pdf_mode, pdf_size);
|
|
109
|
-
}
|
|
110
|
-
if (context.studio.script.title) {
|
|
111
|
-
GraphAILogger.info(context.studio.script.title);
|
|
112
|
-
}
|
|
113
|
-
if (context.studio.script.references) {
|
|
114
|
-
const textOutput = context.studio.script.references.map((reference) => `${reference.title}\n${reference.url}`).join("\n");
|
|
115
|
-
GraphAILogger.info(textOutput);
|
|
116
|
-
}
|
|
117
|
-
};
|
package/lib/cli/run.d.ts
DELETED
package/lib/cli/run.js
DELETED
package/lib/cli/tool-args.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const args: {
|
|
2
|
-
[x: string]: unknown;
|
|
3
|
-
v: boolean;
|
|
4
|
-
o: string | undefined;
|
|
5
|
-
b: string | undefined;
|
|
6
|
-
l: string | undefined;
|
|
7
|
-
u: string[] | never[];
|
|
8
|
-
i: boolean | undefined;
|
|
9
|
-
t: string | undefined;
|
|
10
|
-
c: string | undefined;
|
|
11
|
-
s: string;
|
|
12
|
-
llm_agent: string | undefined;
|
|
13
|
-
llm_model: string | undefined;
|
|
14
|
-
_: (string | number)[];
|
|
15
|
-
$0: string;
|
|
16
|
-
};
|
package/lib/cli/tool-args.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import yargs from "yargs";
|
|
2
|
-
import { hideBin } from "yargs/helpers";
|
|
3
|
-
import { commonOptions } from "./common.js";
|
|
4
|
-
import { getAvailableTemplates } from "../utils/file.js";
|
|
5
|
-
import { llmAgents } from "../utils/utils.js";
|
|
6
|
-
const availableTemplateNames = getAvailableTemplates().map((template) => template.filename);
|
|
7
|
-
export const args = commonOptions(yargs(hideBin(process.argv)))
|
|
8
|
-
.scriptName("mulmo-tool")
|
|
9
|
-
.option("u", {
|
|
10
|
-
alias: "url",
|
|
11
|
-
description: "URLs to reference (required when not in interactive mode)",
|
|
12
|
-
demandOption: false,
|
|
13
|
-
default: [],
|
|
14
|
-
type: "array",
|
|
15
|
-
string: true,
|
|
16
|
-
})
|
|
17
|
-
.option("i", {
|
|
18
|
-
alias: "interactive",
|
|
19
|
-
description: "Generate script in interactive mode with user prompts",
|
|
20
|
-
demandOption: false,
|
|
21
|
-
type: "boolean",
|
|
22
|
-
})
|
|
23
|
-
.option("t", {
|
|
24
|
-
alias: "template",
|
|
25
|
-
description: "Template name to use",
|
|
26
|
-
demandOption: false,
|
|
27
|
-
choices: availableTemplateNames,
|
|
28
|
-
type: "string",
|
|
29
|
-
})
|
|
30
|
-
.option("c", {
|
|
31
|
-
alias: "cache",
|
|
32
|
-
description: "cache dir",
|
|
33
|
-
demandOption: false,
|
|
34
|
-
type: "string",
|
|
35
|
-
})
|
|
36
|
-
.option("s", {
|
|
37
|
-
alias: "script",
|
|
38
|
-
description: "script filename",
|
|
39
|
-
demandOption: false,
|
|
40
|
-
default: "script",
|
|
41
|
-
type: "string",
|
|
42
|
-
})
|
|
43
|
-
.option("llm_agent", {
|
|
44
|
-
description: "llm agent",
|
|
45
|
-
demandOption: false,
|
|
46
|
-
choices: llmAgents,
|
|
47
|
-
type: "string",
|
|
48
|
-
})
|
|
49
|
-
.option("llm_model", {
|
|
50
|
-
description: "llm model",
|
|
51
|
-
demandOption: false,
|
|
52
|
-
type: "string",
|
|
53
|
-
})
|
|
54
|
-
.command("$0 <action>", "Run mulmocast tool", (yargs) => {
|
|
55
|
-
return yargs.positional("action", {
|
|
56
|
-
describe: "action to perform",
|
|
57
|
-
choices: ["scripting", "prompt", "schema"],
|
|
58
|
-
type: "string",
|
|
59
|
-
});
|
|
60
|
-
})
|
|
61
|
-
.strict()
|
|
62
|
-
.help()
|
|
63
|
-
.alias("help", "h")
|
|
64
|
-
.parseSync();
|
package/lib/cli/tool-cli.d.ts
DELETED
package/lib/cli/tool-cli.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import "dotenv/config";
|
|
3
|
-
import { GraphAILogger } from "graphai";
|
|
4
|
-
import { args } from "./tool-args.js";
|
|
5
|
-
import { outDirName, cacheDirName } from "../utils/const.js";
|
|
6
|
-
import { createMulmoScriptFromUrl } from "../tools/create_mulmo_script_from_url.js";
|
|
7
|
-
import { getBaseDirPath, getFullPath } from "../utils/file.js";
|
|
8
|
-
import { createMulmoScriptInteractively } from "../tools/create_mulmo_script_interactively.js";
|
|
9
|
-
import { dumpPromptFromTemplate } from "../tools/dump_prompt.js";
|
|
10
|
-
import { getUrlsIfNeeded, selectTemplate } from "../utils/inquirer.js";
|
|
11
|
-
import { mulmoScriptSchema } from "../types/schema.js";
|
|
12
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
13
|
-
const main = async () => {
|
|
14
|
-
const { o: outdir, b: basedir, action, v: verbose, i: interactive, s: filename, cache } = args;
|
|
15
|
-
let { t: template } = args;
|
|
16
|
-
const { u: urls } = args;
|
|
17
|
-
const { llm_model, llm_agent } = args;
|
|
18
|
-
const baseDirPath = getBaseDirPath(basedir);
|
|
19
|
-
const outDirPath = getFullPath(baseDirPath, outdir ?? outDirName);
|
|
20
|
-
const cacheDirPath = getFullPath(outDirPath, cache ?? cacheDirName);
|
|
21
|
-
if (verbose) {
|
|
22
|
-
GraphAILogger.info("baseDirPath:", baseDirPath);
|
|
23
|
-
GraphAILogger.info("outDirPath:", outDirPath);
|
|
24
|
-
GraphAILogger.info("cacheDirPath:", cacheDirPath);
|
|
25
|
-
GraphAILogger.info("template:", template);
|
|
26
|
-
GraphAILogger.info("urls:", urls);
|
|
27
|
-
GraphAILogger.info("action:", action);
|
|
28
|
-
GraphAILogger.info("interactive:", interactive);
|
|
29
|
-
GraphAILogger.info("filename:", filename);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
GraphAILogger.setLevelEnabled("error", false);
|
|
33
|
-
GraphAILogger.setLevelEnabled("log", false);
|
|
34
|
-
GraphAILogger.setLevelEnabled("warn", false);
|
|
35
|
-
}
|
|
36
|
-
// If template is not specified, show the selection prompt
|
|
37
|
-
if (!template) {
|
|
38
|
-
template = await selectTemplate();
|
|
39
|
-
if (verbose) {
|
|
40
|
-
GraphAILogger.info("Selected template:", template);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (action === "scripting") {
|
|
44
|
-
const context = { outDirPath, templateName: template, urls, filename, cacheDirPath, llm_model, llm_agent };
|
|
45
|
-
if (interactive) {
|
|
46
|
-
await createMulmoScriptInteractively(context);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
context.urls = await getUrlsIfNeeded(urls);
|
|
50
|
-
await createMulmoScriptFromUrl(context);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else if (action === "prompt") {
|
|
54
|
-
await dumpPromptFromTemplate({ templateName: template });
|
|
55
|
-
}
|
|
56
|
-
else if (action === "schema") {
|
|
57
|
-
const defaultSchema = zodToJsonSchema(mulmoScriptSchema, {
|
|
58
|
-
strictUnions: true,
|
|
59
|
-
});
|
|
60
|
-
GraphAILogger.info(JSON.stringify(defaultSchema, null, 2));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
throw new Error(`Unknown or unsupported action: ${action}`);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
main().catch((error) => {
|
|
67
|
-
GraphAILogger.info("An unexpected error occurred:", error);
|
|
68
|
-
process.exit(1);
|
|
69
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import "dotenv/config";
|
|
2
|
-
import { MulmoCanvasDimension, MulmoScript, MulmoBeat, SpeechOptions, Text2SpeechProvider, Text2ImageAgentInfo, BeatMediaType } from "../types/index.js";
|
|
3
|
-
export declare const MulmoScriptMethods: {
|
|
4
|
-
getCanvasSize(script: MulmoScript): MulmoCanvasDimension;
|
|
5
|
-
getSpeechProvider(script: MulmoScript): Text2SpeechProvider;
|
|
6
|
-
getAllSpeechProviders(script: MulmoScript): Set<Text2SpeechProvider>;
|
|
7
|
-
getTextSlideStyle(script: MulmoScript, beat: MulmoBeat): string;
|
|
8
|
-
getSpeechOptions(script: MulmoScript, beat: MulmoBeat): SpeechOptions | undefined;
|
|
9
|
-
getImageAgentInfo(script: MulmoScript, dryRun?: boolean): Text2ImageAgentInfo;
|
|
10
|
-
getImageType(_: MulmoScript, beat: MulmoBeat): BeatMediaType;
|
|
11
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import "dotenv/config";
|
|
2
|
-
import { text2ImageProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema } from "../types/schema.js";
|
|
3
|
-
const defaultTextSlideStyles = [
|
|
4
|
-
'*,*::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}}',
|
|
5
|
-
"body { margin: 60px; margin-top: 40px; color:#333; font-size: 30px; font-family: Arial, sans-serif; box-sizing: border-box; height: 100vh }",
|
|
6
|
-
"h1 { font-size: 56px; margin-bottom: 20px; text-align: center }",
|
|
7
|
-
"h2 { font-size: 48px; text-align: center }",
|
|
8
|
-
"h3 { font-size: 36px }",
|
|
9
|
-
"ul { margin-left: 40px } ",
|
|
10
|
-
"pre { background: #eeeecc; font-size: 16px; padding:4px }",
|
|
11
|
-
"p { margin-left: 40px }",
|
|
12
|
-
"table { font-size: 36px; margin: auto; border: 1px solid gray; border-collapse: collapse }",
|
|
13
|
-
"th { border-bottom: 1px solid gray }",
|
|
14
|
-
"td, th { padding: 8px }",
|
|
15
|
-
"tr:nth-child(even) { background-color: #eee }",
|
|
16
|
-
];
|
|
17
|
-
export const MulmoScriptMethods = {
|
|
18
|
-
getCanvasSize(script) {
|
|
19
|
-
return mulmoCanvasDimensionSchema.parse(script.canvasSize);
|
|
20
|
-
},
|
|
21
|
-
getSpeechProvider(script) {
|
|
22
|
-
return text2SpeechProviderSchema.parse(script.speechParams?.provider);
|
|
23
|
-
},
|
|
24
|
-
getAllSpeechProviders(script) {
|
|
25
|
-
const providers = new Set();
|
|
26
|
-
const defaultProvider = this.getSpeechProvider(script);
|
|
27
|
-
Object.values(script.speechParams.speakers).forEach((speaker) => {
|
|
28
|
-
const provider = speaker.provider ?? defaultProvider;
|
|
29
|
-
providers.add(provider);
|
|
30
|
-
});
|
|
31
|
-
return providers;
|
|
32
|
-
},
|
|
33
|
-
getTextSlideStyle(script, beat) {
|
|
34
|
-
const styles = script.textSlideParams?.cssStyles ?? [];
|
|
35
|
-
// NOTES: Taking advantage of CSS override rule (you can redefine it to override)
|
|
36
|
-
const extraStyles = beat.textSlideParams?.cssStyles ?? [];
|
|
37
|
-
// This code allows us to support both string and array of strings for cssStyles
|
|
38
|
-
return [...defaultTextSlideStyles, ...[styles], ...[extraStyles]].flat().join("\n");
|
|
39
|
-
},
|
|
40
|
-
getSpeechOptions(script, beat) {
|
|
41
|
-
return { ...script.speechParams.speakers[beat.speaker].speechOptions, ...beat.speechOptions };
|
|
42
|
-
},
|
|
43
|
-
getImageAgentInfo(script, dryRun = false) {
|
|
44
|
-
// Notice that we copy imageParams from script and update
|
|
45
|
-
// provider and model appropriately.
|
|
46
|
-
const provider = text2ImageProviderSchema.parse(script.imageParams?.provider);
|
|
47
|
-
const defaultImageParams = {
|
|
48
|
-
model: provider === "openai" ? process.env.DEFAULT_OPENAI_IMAGE_MODEL : undefined,
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
provider,
|
|
52
|
-
agent: dryRun ? "mediaMockAgent" : provider === "google" ? "imageGoogleAgent" : "imageOpenaiAgent",
|
|
53
|
-
imageParams: { ...defaultImageParams, ...script.imageParams },
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
getImageType(_, beat) {
|
|
57
|
-
return beat.image?.type == "movie" ? "movie" : "image";
|
|
58
|
-
},
|
|
59
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MulmoStudio } from "../types/index.js";
|
|
2
|
-
type SessionType = "audio" | "image" | "video" | "multiLingual" | "caption" | "pdf";
|
|
3
|
-
type BeatSessionType = "audio" | "image" | "multiLingual" | "caption" | "movie";
|
|
4
|
-
export declare const MulmoStudioMethods: {
|
|
5
|
-
setSessionState(studio: MulmoStudio, sessionType: SessionType, value: boolean): void;
|
|
6
|
-
setBeatSessionState(studio: MulmoStudio, sessionType: BeatSessionType, index: number, value: boolean): void;
|
|
7
|
-
};
|
|
8
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { GraphAILogger } from "graphai";
|
|
2
|
-
const notifyStateChange = (studio, sessionType) => {
|
|
3
|
-
const prefix = studio.state.inSession[sessionType] ? "<" : " >";
|
|
4
|
-
GraphAILogger.info(`${prefix} ${sessionType}`);
|
|
5
|
-
};
|
|
6
|
-
const notifyBeatStateChange = (studio, sessionType, index) => {
|
|
7
|
-
const prefix = studio.state.inBeatSession[sessionType].has(index) ? "{" : " }";
|
|
8
|
-
GraphAILogger.info(`${prefix} ${sessionType} ${index}`);
|
|
9
|
-
};
|
|
10
|
-
export const MulmoStudioMethods = {
|
|
11
|
-
setSessionState(studio, sessionType, value) {
|
|
12
|
-
studio.state.inSession[sessionType] = value;
|
|
13
|
-
notifyStateChange(studio, sessionType);
|
|
14
|
-
},
|
|
15
|
-
setBeatSessionState(studio, sessionType, index, value) {
|
|
16
|
-
if (value) {
|
|
17
|
-
studio.state.inBeatSession[sessionType].add(index);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
studio.state.inBeatSession[sessionType].delete(index);
|
|
21
|
-
}
|
|
22
|
-
notifyBeatStateChange(studio, sessionType, index);
|
|
23
|
-
},
|
|
24
|
-
};
|
package/lib/tools/prompt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/tools/prompt.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
-
const __dirname = path.dirname(__filename);
|
|
6
|
-
const main = async () => {
|
|
7
|
-
const basePath = path.resolve(__dirname, "../../prompts/");
|
|
8
|
-
const ret = {};
|
|
9
|
-
fs.readdirSync(basePath).map((file) => {
|
|
10
|
-
const key = file.split(".")[0];
|
|
11
|
-
const content = fs.readFileSync(path.resolve(basePath, file), "utf-8");
|
|
12
|
-
ret[key] = content;
|
|
13
|
-
});
|
|
14
|
-
const code = ["// This file is auto-generated by src/tools/prompt.ts and Do not be edited manually.", `export const prompts = ${JSON.stringify(ret)};`].join("\n");
|
|
15
|
-
fs.writeFileSync(path.resolve(__dirname, "../../src/agents/prompts_data.ts"), code, "utf8");
|
|
16
|
-
// console.log(hoge);
|
|
17
|
-
};
|
|
18
|
-
main();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getHTMLFile } from "../file.js";
|
|
2
|
-
import { renderHTMLToImage, interpolate } from "../markdown.js";
|
|
3
|
-
export const imageType = "tailwind";
|
|
4
|
-
const processTailwind = async (params) => {
|
|
5
|
-
const { beat, imagePath, canvasSize } = params;
|
|
6
|
-
if (!beat.image || beat.image.type !== imageType)
|
|
7
|
-
return;
|
|
8
|
-
const html = Array.isArray(beat.image.html) ? beat.image.html.join("\n") : beat.image.html;
|
|
9
|
-
const template = getHTMLFile("tailwind");
|
|
10
|
-
const htmlData = interpolate(template, {
|
|
11
|
-
// style: textSlideStyle,
|
|
12
|
-
// width: Math.round(canvasSize.width * 0.625).toString(),
|
|
13
|
-
html_body: html,
|
|
14
|
-
});
|
|
15
|
-
await renderHTMLToImage(htmlData, imagePath, canvasSize.width, canvasSize.height);
|
|
16
|
-
return imagePath;
|
|
17
|
-
};
|
|
18
|
-
export const process = processTailwind;
|
package/lib/utils/pdf.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PDFFont } from "pdf-lib";
|
|
2
|
-
export declare const fontSize = 12;
|
|
3
|
-
export declare const textMargin = 6;
|
|
4
|
-
export declare const drawSize: (fitWidth: boolean, expectWidth: number, expectHeight: number, origWidth: number, origHeight: number) => {
|
|
5
|
-
containerWidth: number;
|
|
6
|
-
drawWidth: number;
|
|
7
|
-
drawHeight: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const wrapText: (text: string, font: PDFFont, fontSize: number, maxWidth: number) => string[];
|
package/lib/utils/pdf.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
export const fontSize = 12;
|
|
2
|
-
export const textMargin = 6;
|
|
3
|
-
export const drawSize = (fitWidth, expectWidth, expectHeight, origWidth, origHeight) => {
|
|
4
|
-
if (fitWidth) {
|
|
5
|
-
const drawWidth = expectWidth;
|
|
6
|
-
const scale = drawWidth / origWidth;
|
|
7
|
-
const drawHeight = origHeight * scale;
|
|
8
|
-
return {
|
|
9
|
-
containerWidth: expectWidth,
|
|
10
|
-
drawWidth,
|
|
11
|
-
drawHeight,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
const drawHeight = expectHeight;
|
|
15
|
-
const scale = drawHeight / origHeight;
|
|
16
|
-
const drawWidth = origWidth * scale;
|
|
17
|
-
return {
|
|
18
|
-
containerWidth: expectWidth,
|
|
19
|
-
drawWidth,
|
|
20
|
-
drawHeight,
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const isFullwidth = (char) => {
|
|
24
|
-
const code = char.charCodeAt(0);
|
|
25
|
-
return ((code >= 0x3000 && code <= 0x9fff) || // CJK, punctuation, kana
|
|
26
|
-
(code >= 0xff00 && code <= 0xffef) // Fullwidth ASCII
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
export const wrapText = (text, font, fontSize, maxWidth) => {
|
|
30
|
-
const lines = [];
|
|
31
|
-
for (const rawLine of text.split("\n")) {
|
|
32
|
-
let line = "";
|
|
33
|
-
let buffer = "";
|
|
34
|
-
for (let i = 0; i < rawLine.length; i++) {
|
|
35
|
-
const char = rawLine[i];
|
|
36
|
-
buffer += char;
|
|
37
|
-
const width = font.widthOfTextAtSize(line + buffer, fontSize);
|
|
38
|
-
const nextChar = rawLine[i + 1];
|
|
39
|
-
const currentIsFull = isFullwidth(char);
|
|
40
|
-
const nextIsFull = nextChar && isFullwidth(nextChar);
|
|
41
|
-
const isBreakable = currentIsFull || (!currentIsFull && (char === " " || nextChar === " " || nextIsFull));
|
|
42
|
-
if (width > maxWidth && line) {
|
|
43
|
-
lines.push(line);
|
|
44
|
-
line = buffer;
|
|
45
|
-
buffer = "";
|
|
46
|
-
}
|
|
47
|
-
if (isBreakable || i === rawLine.length - 1) {
|
|
48
|
-
line += buffer;
|
|
49
|
-
buffer = "";
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (line)
|
|
53
|
-
lines.push(line);
|
|
54
|
-
}
|
|
55
|
-
return lines;
|
|
56
|
-
};
|
|
57
|
-
/*
|
|
58
|
-
export const wrapText = (text: string, font: PDFFont, fontSize: number, maxWidth: number) => {
|
|
59
|
-
const words = text.split(" ");
|
|
60
|
-
const lines = [];
|
|
61
|
-
let currentLine = "";
|
|
62
|
-
|
|
63
|
-
for (const word of words) {
|
|
64
|
-
const nextLine = currentLine ? `${currentLine} ${word}` : word;
|
|
65
|
-
// console.log(nextLine);
|
|
66
|
-
const width = font.widthOfTextAtSize(nextLine ?? "", fontSize);
|
|
67
|
-
if (width <= maxWidth) {
|
|
68
|
-
currentLine = nextLine;
|
|
69
|
-
} else {
|
|
70
|
-
lines.push(currentLine);
|
|
71
|
-
currentLine = word;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (currentLine) lines.push(currentLine);
|
|
75
|
-
return lines;
|
|
76
|
-
};
|
|
77
|
-
*/
|