mulmocast 2.1.24 → 2.1.26
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 +134 -8
- package/lib/actions/captions.js +13 -7
- package/lib/cli/commands/tool/complete/builder.d.ts +10 -0
- package/lib/cli/commands/tool/complete/builder.js +29 -0
- package/lib/cli/commands/tool/complete/handler.d.ts +9 -0
- package/lib/cli/commands/tool/complete/handler.js +46 -0
- package/lib/cli/commands/tool/complete/index.d.ts +4 -0
- package/lib/cli/commands/tool/complete/index.js +4 -0
- package/lib/cli/commands/tool/index.js +2 -1
- package/lib/data/styles.d.ts +255 -0
- package/lib/data/styles.js +284 -0
- package/lib/tools/complete_script.d.ts +52 -0
- package/lib/tools/complete_script.js +118 -0
- package/lib/tools/create_mulmo_script_from_url.js +5 -3
- package/lib/tools/create_mulmo_script_interactively.js +3 -2
- package/lib/tools/story_to_script.js +3 -2
- package/lib/types/schema.d.ts +9 -9
- package/lib/types/schema.js +1 -1
- package/lib/utils/context.d.ts +5 -5
- package/package.json +2 -2
- package/scripts/test/minimum_beats_completed.json +45 -0
- package/scripts/test/test_caption_split_patterns.json +244 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
export const styles = [
|
|
2
|
+
{
|
|
3
|
+
filename: 'akira_comic',
|
|
4
|
+
presentationStyle: {
|
|
5
|
+
'$mulmocast': {
|
|
6
|
+
credit: 'closing',
|
|
7
|
+
version: '1.1'
|
|
8
|
+
},
|
|
9
|
+
canvasSize: {
|
|
10
|
+
height: 1024,
|
|
11
|
+
width: 1536
|
|
12
|
+
},
|
|
13
|
+
imageParams: {
|
|
14
|
+
images: {
|
|
15
|
+
girl: {
|
|
16
|
+
source: {
|
|
17
|
+
kind: 'url',
|
|
18
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/akira_presenter.png'
|
|
19
|
+
},
|
|
20
|
+
type: 'image'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
style: '<style>AKIRA aesthetic.</style>'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
filename: 'ani',
|
|
29
|
+
presentationStyle: {
|
|
30
|
+
'$mulmocast': {
|
|
31
|
+
credit: 'closing',
|
|
32
|
+
version: '1.1'
|
|
33
|
+
},
|
|
34
|
+
audioParams: {
|
|
35
|
+
bgm: {
|
|
36
|
+
kind: 'url',
|
|
37
|
+
url: 'https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/morning001.mp3'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
canvasSize: {
|
|
41
|
+
height: 1536,
|
|
42
|
+
width: 1024
|
|
43
|
+
},
|
|
44
|
+
imageParams: {
|
|
45
|
+
images: {
|
|
46
|
+
ani: {
|
|
47
|
+
source: {
|
|
48
|
+
kind: 'url',
|
|
49
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/ani.png'
|
|
50
|
+
},
|
|
51
|
+
type: 'image'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
model: 'gemini-2.5-flash-image',
|
|
55
|
+
provider: 'google',
|
|
56
|
+
style: '<style>A highly polished 2D digital illustration in anime and manga style, featuring clean linework, soft shading, vivid colors, and expressive facial detailing. The composition emphasizes clarity and visual impact with a minimalistic background and a strong character focus. The lighting is even and bright, giving the image a crisp and energetic feel, reminiscent of high-quality character art used in Japanese visual novels or mobile games.</style>'
|
|
57
|
+
},
|
|
58
|
+
movieParams: {
|
|
59
|
+
model: 'bytedance/seedance-1-lite',
|
|
60
|
+
provider: 'replicate'
|
|
61
|
+
},
|
|
62
|
+
speechParams: {
|
|
63
|
+
speakers: {
|
|
64
|
+
Presenter: {
|
|
65
|
+
provider: 'gemini',
|
|
66
|
+
speechOptions: {
|
|
67
|
+
instruction: 'Speak in a slightly high-pitched, curt tone with sudden flustered shifts—like a tsundere anime girl.'
|
|
68
|
+
},
|
|
69
|
+
voiceId: 'Leda'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
filename: 'children_book',
|
|
77
|
+
presentationStyle: {
|
|
78
|
+
'$mulmocast': {
|
|
79
|
+
credit: 'closing',
|
|
80
|
+
version: '1.1'
|
|
81
|
+
},
|
|
82
|
+
canvasSize: {
|
|
83
|
+
height: 1024,
|
|
84
|
+
width: 1536
|
|
85
|
+
},
|
|
86
|
+
imageParams: {
|
|
87
|
+
style: 'A hand-drawn style illustration with a warm, nostalgic atmosphere. The background is rich with natural scenery—lush forests, cloudy skies, and traditional Japanese architecture. Characters have expressive eyes, soft facial features, and are portrayed with gentle lighting and subtle shading. The color palette is muted yet vivid, using earthy tones and watercolor-like textures. The overall scene feels magical and peaceful, with a sense of quiet wonder and emotional depth, reminiscent of classic 1980s and 1990s Japanese animation.'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
filename: 'comic_strips',
|
|
93
|
+
presentationStyle: {
|
|
94
|
+
'$mulmocast': {
|
|
95
|
+
credit: 'closing',
|
|
96
|
+
version: '1.1'
|
|
97
|
+
},
|
|
98
|
+
canvasSize: {
|
|
99
|
+
height: 1024,
|
|
100
|
+
width: 1536
|
|
101
|
+
},
|
|
102
|
+
imageParams: {
|
|
103
|
+
style: '<style>A multi panel comic strips. 1990s American workplace humor. Clean, minimalist line art with muted colors. One character is a nerdy office worker with glasses</style>'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
filename: 'drslump_comic',
|
|
109
|
+
presentationStyle: {
|
|
110
|
+
'$mulmocast': {
|
|
111
|
+
credit: 'closing',
|
|
112
|
+
version: '1.1'
|
|
113
|
+
},
|
|
114
|
+
canvasSize: {
|
|
115
|
+
height: 1024,
|
|
116
|
+
width: 1536
|
|
117
|
+
},
|
|
118
|
+
imageParams: {
|
|
119
|
+
images: {
|
|
120
|
+
girl: {
|
|
121
|
+
source: {
|
|
122
|
+
kind: 'url',
|
|
123
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/slump_presenter.png'
|
|
124
|
+
},
|
|
125
|
+
type: 'image'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
style: '<style>Dragon Ball/Dr. Slump aesthetic.</style>'
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
filename: 'ghibli_comic',
|
|
134
|
+
presentationStyle: {
|
|
135
|
+
'$mulmocast': {
|
|
136
|
+
credit: 'closing',
|
|
137
|
+
version: '1.1'
|
|
138
|
+
},
|
|
139
|
+
canvasSize: {
|
|
140
|
+
height: 1024,
|
|
141
|
+
width: 1536
|
|
142
|
+
},
|
|
143
|
+
imageParams: {
|
|
144
|
+
images: {
|
|
145
|
+
presenter: {
|
|
146
|
+
source: {
|
|
147
|
+
kind: 'url',
|
|
148
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/ghibli_presenter.png'
|
|
149
|
+
},
|
|
150
|
+
type: 'image'
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
style: '<style>Ghibli style</style>'
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
filename: 'ghibli_shorts',
|
|
159
|
+
presentationStyle: {
|
|
160
|
+
'$mulmocast': {
|
|
161
|
+
credit: 'closing',
|
|
162
|
+
version: '1.1'
|
|
163
|
+
},
|
|
164
|
+
canvasSize: {
|
|
165
|
+
height: 1536,
|
|
166
|
+
width: 1024
|
|
167
|
+
},
|
|
168
|
+
imageParams: {
|
|
169
|
+
images: {
|
|
170
|
+
presenter: {
|
|
171
|
+
source: {
|
|
172
|
+
kind: 'url',
|
|
173
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/ghibli_presenter.jpg'
|
|
174
|
+
},
|
|
175
|
+
type: 'image'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
style: '<style>Ghibli style</style>'
|
|
179
|
+
},
|
|
180
|
+
speechParams: {
|
|
181
|
+
provider: 'openai',
|
|
182
|
+
speakers: {
|
|
183
|
+
Presenter: {
|
|
184
|
+
speechOptions: {
|
|
185
|
+
instruction: 'speak very fast'
|
|
186
|
+
},
|
|
187
|
+
voiceId: 'shimmer'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
filename: 'ghost_comic',
|
|
195
|
+
presentationStyle: {
|
|
196
|
+
'$mulmocast': {
|
|
197
|
+
credit: 'closing',
|
|
198
|
+
version: '1.1'
|
|
199
|
+
},
|
|
200
|
+
canvasSize: {
|
|
201
|
+
height: 1024,
|
|
202
|
+
width: 1536
|
|
203
|
+
},
|
|
204
|
+
imageParams: {
|
|
205
|
+
images: {
|
|
206
|
+
optimus: {
|
|
207
|
+
source: {
|
|
208
|
+
kind: 'url',
|
|
209
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/optimus.png'
|
|
210
|
+
},
|
|
211
|
+
type: 'image'
|
|
212
|
+
},
|
|
213
|
+
presenter: {
|
|
214
|
+
source: {
|
|
215
|
+
kind: 'url',
|
|
216
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/ghost_presenter.png'
|
|
217
|
+
},
|
|
218
|
+
type: 'image'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
style: '<style>Ghost in the shell aesthetic.</style>'
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
filename: 'leda',
|
|
227
|
+
presentationStyle: {
|
|
228
|
+
'$mulmocast': {
|
|
229
|
+
credit: 'closing',
|
|
230
|
+
version: '1.1'
|
|
231
|
+
},
|
|
232
|
+
audioParams: {
|
|
233
|
+
bgm: {
|
|
234
|
+
kind: 'url',
|
|
235
|
+
url: 'https://github.com/receptron/mulmocast-media/raw/refs/heads/main/bgms/morning001.mp3'
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
canvasSize: {
|
|
239
|
+
height: 1536,
|
|
240
|
+
width: 1024
|
|
241
|
+
},
|
|
242
|
+
imageParams: {
|
|
243
|
+
model: 'gemini-2.5-flash-image',
|
|
244
|
+
provider: 'google'
|
|
245
|
+
},
|
|
246
|
+
speechParams: {
|
|
247
|
+
speakers: {
|
|
248
|
+
Presenter: {
|
|
249
|
+
provider: 'gemini',
|
|
250
|
+
speechOptions: {
|
|
251
|
+
instruction: 'Speak like a professional news presenter.'
|
|
252
|
+
},
|
|
253
|
+
voiceId: 'Leda'
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
filename: 'onepiece_comic',
|
|
261
|
+
presentationStyle: {
|
|
262
|
+
'$mulmocast': {
|
|
263
|
+
credit: 'closing',
|
|
264
|
+
version: '1.1'
|
|
265
|
+
},
|
|
266
|
+
canvasSize: {
|
|
267
|
+
height: 1024,
|
|
268
|
+
width: 1536
|
|
269
|
+
},
|
|
270
|
+
imageParams: {
|
|
271
|
+
images: {
|
|
272
|
+
presenter: {
|
|
273
|
+
source: {
|
|
274
|
+
kind: 'url',
|
|
275
|
+
url: 'https://raw.githubusercontent.com/receptron/mulmocast-media/refs/heads/main/characters/onepiece_presenter.png'
|
|
276
|
+
},
|
|
277
|
+
type: 'image'
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
style: '<style>One Piece aesthetic.</style>'
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ZodSafeParseResult } from "zod";
|
|
2
|
+
import type { MulmoScript } from "../types/type.js";
|
|
3
|
+
type PartialMulmoScript = Record<string, unknown>;
|
|
4
|
+
/**
|
|
5
|
+
* Add $mulmocast version if not present
|
|
6
|
+
*/
|
|
7
|
+
export declare const addMulmocastVersion: (data: PartialMulmoScript) => PartialMulmoScript;
|
|
8
|
+
/**
|
|
9
|
+
* Merge base with override (override takes precedence)
|
|
10
|
+
*/
|
|
11
|
+
export declare const mergeScripts: (base: PartialMulmoScript, override: PartialMulmoScript) => PartialMulmoScript;
|
|
12
|
+
/**
|
|
13
|
+
* Get style by name or file path
|
|
14
|
+
*/
|
|
15
|
+
export declare const getStyle: (style: string) => PartialMulmoScript | undefined;
|
|
16
|
+
export type CompleteScriptResult = ZodSafeParseResult<MulmoScript>;
|
|
17
|
+
type CompleteScriptOptions = {
|
|
18
|
+
templateName?: string;
|
|
19
|
+
styleName?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Complete a partial MulmoScript with schema defaults, optional style or template
|
|
23
|
+
*
|
|
24
|
+
* @param data - Partial MulmoScript to complete (highest precedence)
|
|
25
|
+
* @param options - Optional template or style to use as base
|
|
26
|
+
* @param options.templateName - Template name (e.g., "children_book"). Mutually exclusive with styleName.
|
|
27
|
+
* @param options.styleName - Style name or file path. Mutually exclusive with templateName.
|
|
28
|
+
* @returns Zod safe parse result with completed MulmoScript or validation errors
|
|
29
|
+
* @throws Error if both templateName and styleName are specified
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // With template
|
|
33
|
+
* completeScript(data, { templateName: "children_book" })
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // With style
|
|
37
|
+
* completeScript(data, { styleName: "ghibli_comic" })
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // With style from file
|
|
41
|
+
* completeScript(data, { styleName: "./my-style.json" })
|
|
42
|
+
*/
|
|
43
|
+
export declare const completeScript: (data: PartialMulmoScript, options?: CompleteScriptOptions) => CompleteScriptResult;
|
|
44
|
+
/**
|
|
45
|
+
* Check if template exists
|
|
46
|
+
*/
|
|
47
|
+
export declare const templateExists: (templateName: string) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Check if style exists (by name or file path)
|
|
50
|
+
*/
|
|
51
|
+
export declare const styleExists: (style: string) => boolean;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { mulmoScriptSchema } from "../types/schema.js";
|
|
4
|
+
import { getScriptFromPromptTemplate } from "../utils/file.js";
|
|
5
|
+
import { currentMulmoScriptVersion } from "../types/const.js";
|
|
6
|
+
import { promptTemplates } from "../data/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Add $mulmocast version if not present
|
|
9
|
+
*/
|
|
10
|
+
export const addMulmocastVersion = (data) => {
|
|
11
|
+
if (data.$mulmocast) {
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
...data,
|
|
16
|
+
$mulmocast: { version: currentMulmoScriptVersion },
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const deepMergeKeys = ["speechParams", "imageParams", "movieParams", "audioParams"];
|
|
20
|
+
/**
|
|
21
|
+
* Merge base with override (override takes precedence)
|
|
22
|
+
*/
|
|
23
|
+
export const mergeScripts = (base, override) => {
|
|
24
|
+
const merged = { ...base, ...override };
|
|
25
|
+
deepMergeKeys.forEach((key) => {
|
|
26
|
+
if (base[key] && override[key]) {
|
|
27
|
+
merged[key] = { ...base[key], ...override[key] };
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return merged;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Check if style specifier is a file path
|
|
34
|
+
*/
|
|
35
|
+
const isFilePath = (style) => {
|
|
36
|
+
return style.endsWith(".json") || style.includes("/") || style.includes("\\");
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Get style by name from promptTemplates
|
|
40
|
+
*/
|
|
41
|
+
const getStyleByName = (styleName) => {
|
|
42
|
+
const template = promptTemplates.find((t) => t.filename === styleName);
|
|
43
|
+
return template?.presentationStyle;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Get style from file path
|
|
47
|
+
*/
|
|
48
|
+
const getStyleFromFile = (filePath) => {
|
|
49
|
+
const resolvedPath = path.resolve(filePath);
|
|
50
|
+
if (!existsSync(resolvedPath)) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const content = readFileSync(resolvedPath, "utf-8");
|
|
54
|
+
return JSON.parse(content);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get style by name or file path
|
|
58
|
+
*/
|
|
59
|
+
export const getStyle = (style) => {
|
|
60
|
+
return isFilePath(style) ? getStyleFromFile(style) : getStyleByName(style);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Complete a partial MulmoScript with schema defaults, optional style or template
|
|
64
|
+
*
|
|
65
|
+
* @param data - Partial MulmoScript to complete (highest precedence)
|
|
66
|
+
* @param options - Optional template or style to use as base
|
|
67
|
+
* @param options.templateName - Template name (e.g., "children_book"). Mutually exclusive with styleName.
|
|
68
|
+
* @param options.styleName - Style name or file path. Mutually exclusive with templateName.
|
|
69
|
+
* @returns Zod safe parse result with completed MulmoScript or validation errors
|
|
70
|
+
* @throws Error if both templateName and styleName are specified
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* // With template
|
|
74
|
+
* completeScript(data, { templateName: "children_book" })
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // With style
|
|
78
|
+
* completeScript(data, { styleName: "ghibli_comic" })
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // With style from file
|
|
82
|
+
* completeScript(data, { styleName: "./my-style.json" })
|
|
83
|
+
*/
|
|
84
|
+
export const completeScript = (data, options = {}) => {
|
|
85
|
+
const { templateName, styleName } = options;
|
|
86
|
+
// template and style are mutually exclusive
|
|
87
|
+
if (templateName && styleName) {
|
|
88
|
+
throw new Error("Cannot specify both templateName and styleName. They are mutually exclusive.");
|
|
89
|
+
}
|
|
90
|
+
// Get base config from template or style
|
|
91
|
+
const getBase = () => {
|
|
92
|
+
if (templateName) {
|
|
93
|
+
return getScriptFromPromptTemplate(templateName);
|
|
94
|
+
}
|
|
95
|
+
if (styleName) {
|
|
96
|
+
return getStyle(styleName);
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
};
|
|
100
|
+
const base = getBase();
|
|
101
|
+
// Merge base with input data (input data has highest precedence)
|
|
102
|
+
const merged = base ? mergeScripts(base, data) : data;
|
|
103
|
+
// Add version if not present
|
|
104
|
+
const withVersion = addMulmocastVersion(merged);
|
|
105
|
+
return mulmoScriptSchema.safeParse(withVersion);
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Check if template exists
|
|
109
|
+
*/
|
|
110
|
+
export const templateExists = (templateName) => {
|
|
111
|
+
return getScriptFromPromptTemplate(templateName) !== undefined;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Check if style exists (by name or file path)
|
|
115
|
+
*/
|
|
116
|
+
export const styleExists = (style) => {
|
|
117
|
+
return getStyle(style) !== undefined;
|
|
118
|
+
};
|
|
@@ -14,7 +14,7 @@ import { browserlessCacheGenerator } from "../utils/filters.js";
|
|
|
14
14
|
import { mulmoScriptSchema, urlsSchema } from "../types/schema.js";
|
|
15
15
|
import { cliLoadingPlugin } from "../utils/plugins.js";
|
|
16
16
|
import { graphDataScriptFromUrlPrompt } from "../utils/prompt.js";
|
|
17
|
-
import { llmPair } from "../utils/utils.js";
|
|
17
|
+
import { llmPair, settings2GraphAIConfig } from "../utils/utils.js";
|
|
18
18
|
import { readFileSync } from "fs";
|
|
19
19
|
dotenv.config({ quiet: true });
|
|
20
20
|
const vanillaAgents = agents.default ?? agents;
|
|
@@ -220,6 +220,7 @@ export const createMulmoScriptFromUrl = async ({ urls, templateName, outDirPath,
|
|
|
220
220
|
},
|
|
221
221
|
];
|
|
222
222
|
const { agent, model, max_tokens } = llmPair(llm, llm_model);
|
|
223
|
+
const config = settings2GraphAIConfig(undefined, process.env);
|
|
223
224
|
const graph = new GraphAI(graphData, {
|
|
224
225
|
...vanillaAgents,
|
|
225
226
|
openAIAgent,
|
|
@@ -229,7 +230,7 @@ export const createMulmoScriptFromUrl = async ({ urls, templateName, outDirPath,
|
|
|
229
230
|
browserlessAgent,
|
|
230
231
|
validateSchemaAgent,
|
|
231
232
|
fileWriteAgent,
|
|
232
|
-
}, { agentFilters });
|
|
233
|
+
}, { agentFilters, config });
|
|
233
234
|
graph.injectValue("urls", parsedUrls);
|
|
234
235
|
graph.injectValue("systemPrompt", readTemplatePrompt(templateName));
|
|
235
236
|
graph.injectValue("outdir", outDirPath);
|
|
@@ -251,6 +252,7 @@ export const createMulmoScriptFromFile = async (fileName, { templateName, outDir
|
|
|
251
252
|
const filePath = path.resolve(process.cwd(), fileName);
|
|
252
253
|
const text = readFileSync(filePath, "utf-8");
|
|
253
254
|
const { agent, model, max_tokens } = llmPair(llm, llm_model);
|
|
255
|
+
const config = settings2GraphAIConfig(undefined, process.env);
|
|
254
256
|
const graph = new GraphAI(graphDataText, {
|
|
255
257
|
...vanillaAgents,
|
|
256
258
|
openAIAgent,
|
|
@@ -259,7 +261,7 @@ export const createMulmoScriptFromFile = async (fileName, { templateName, outDir
|
|
|
259
261
|
groqAgent,
|
|
260
262
|
validateSchemaAgent,
|
|
261
263
|
fileWriteAgent,
|
|
262
|
-
});
|
|
264
|
+
}, { config });
|
|
263
265
|
graph.injectValue("sourceText", { text });
|
|
264
266
|
graph.injectValue("systemPrompt", readTemplatePrompt(templateName));
|
|
265
267
|
graph.injectValue("outdir", outDirPath);
|
|
@@ -13,7 +13,7 @@ import { browserlessCacheGenerator } from "../utils/filters.js";
|
|
|
13
13
|
import { mulmoScriptSchema } from "../types/index.js";
|
|
14
14
|
import { browserlessAgent } from "@graphai/browserless_agent";
|
|
15
15
|
import validateSchemaAgent from "../agents/validate_schema_agent.js";
|
|
16
|
-
import { llmPair } from "../utils/utils.js";
|
|
16
|
+
import { llmPair, settings2GraphAIConfig } from "../utils/utils.js";
|
|
17
17
|
import { interactiveClarificationPrompt, prefixPrompt } from "../utils/prompt.js";
|
|
18
18
|
// import { cliLoadingPlugin } from "../utils/plugins.js";
|
|
19
19
|
dotenv.config({ quiet: true });
|
|
@@ -231,7 +231,8 @@ export const createMulmoScriptInteractively = async ({ outDirPath, cacheDirPath,
|
|
|
231
231
|
nodeIds: ["chatAgent"],
|
|
232
232
|
},
|
|
233
233
|
];
|
|
234
|
-
const
|
|
234
|
+
const config = settings2GraphAIConfig(undefined, process.env);
|
|
235
|
+
const graph = new GraphAI(graphData, { ...vanillaAgents, anthropicAgent, geminiAgent, groqAgent, openAIAgent, textInputAgent, fileWriteAgent, validateSchemaAgent }, { agentFilters, config });
|
|
235
236
|
const prompt = readTemplatePrompt(templateName);
|
|
236
237
|
graph.injectValue("messages", [
|
|
237
238
|
{
|
|
@@ -9,7 +9,7 @@ import * as agents from "@graphai/vanilla";
|
|
|
9
9
|
import { graphDataScriptGeneratePrompt, sceneToBeatsPrompt, storyToScriptInfoPrompt, storyToScriptPrompt } from "../utils/prompt.js";
|
|
10
10
|
import { fileWriteAgent } from "@graphai/vanilla_node_agents";
|
|
11
11
|
import validateSchemaAgent from "../agents/validate_schema_agent.js";
|
|
12
|
-
import { llmPair } from "../utils/utils.js";
|
|
12
|
+
import { llmPair, settings2GraphAIConfig } from "../utils/utils.js";
|
|
13
13
|
import { storyToScriptGenerateMode } from "../types/const.js";
|
|
14
14
|
import { cliLoadingPlugin } from "../utils/plugins.js";
|
|
15
15
|
const vanillaAgents = agents.default ?? agents;
|
|
@@ -255,7 +255,8 @@ export const storyToScript = async ({ story, beatsPerScene, templateName, outdir
|
|
|
255
255
|
const scriptInfoPrompt = await generateScriptInfoPrompt(template, story);
|
|
256
256
|
const scriptPrompt = await generateScriptPrompt(template, beatsPerScene, story);
|
|
257
257
|
const graphData = generateMode === storyToScriptGenerateMode.stepWise ? stepWiseGraphData : oneStepGraphData;
|
|
258
|
-
const
|
|
258
|
+
const config = settings2GraphAIConfig(undefined, process.env);
|
|
259
|
+
const graph = new GraphAI(graphData, { ...vanillaAgents, openAIAgent, anthropicAgent, geminiAgent, groqAgent, fileWriteAgent, validateSchemaAgent }, { config });
|
|
259
260
|
if (generateMode === storyToScriptGenerateMode.stepWise) {
|
|
260
261
|
graph.injectValue("scenes", story.scenes);
|
|
261
262
|
graph.injectValue("beatsPrompt", beatsPrompt);
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -216,7 +216,7 @@ export declare const textSplitSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
216
216
|
}, z.core.$strip>], "type">;
|
|
217
217
|
export declare const mulmoCaptionParamsSchema: z.ZodObject<{
|
|
218
218
|
lang: z.ZodOptional<z.ZodString>;
|
|
219
|
-
styles: z.
|
|
219
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
220
220
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
221
221
|
none: "none";
|
|
222
222
|
estimate: "estimate";
|
|
@@ -1180,7 +1180,7 @@ export declare const mulmoBeatSchema: z.ZodObject<{
|
|
|
1180
1180
|
}, z.core.$strict>>;
|
|
1181
1181
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
1182
1182
|
lang: z.ZodOptional<z.ZodString>;
|
|
1183
|
-
styles: z.
|
|
1183
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1184
1184
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
1185
1185
|
none: "none";
|
|
1186
1186
|
estimate: "estimate";
|
|
@@ -1555,7 +1555,7 @@ export declare const mulmoPresentationStyleSchema: z.ZodObject<{
|
|
|
1555
1555
|
}, z.core.$strict>>;
|
|
1556
1556
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
1557
1557
|
lang: z.ZodOptional<z.ZodString>;
|
|
1558
|
-
styles: z.
|
|
1558
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1559
1559
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
1560
1560
|
none: "none";
|
|
1561
1561
|
estimate: "estimate";
|
|
@@ -1926,7 +1926,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
1926
1926
|
}, z.core.$strict>>;
|
|
1927
1927
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
1928
1928
|
lang: z.ZodOptional<z.ZodString>;
|
|
1929
|
-
styles: z.
|
|
1929
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1930
1930
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
1931
1931
|
none: "none";
|
|
1932
1932
|
estimate: "estimate";
|
|
@@ -2364,7 +2364,7 @@ export declare const mulmoScriptSchema: z.ZodObject<{
|
|
|
2364
2364
|
}, z.core.$strict>>;
|
|
2365
2365
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
2366
2366
|
lang: z.ZodOptional<z.ZodString>;
|
|
2367
|
-
styles: z.
|
|
2367
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2368
2368
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
2369
2369
|
none: "none";
|
|
2370
2370
|
estimate: "estimate";
|
|
@@ -2814,7 +2814,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
2814
2814
|
}, z.core.$strict>>;
|
|
2815
2815
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
2816
2816
|
lang: z.ZodOptional<z.ZodString>;
|
|
2817
|
-
styles: z.
|
|
2817
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2818
2818
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
2819
2819
|
none: "none";
|
|
2820
2820
|
estimate: "estimate";
|
|
@@ -3252,7 +3252,7 @@ export declare const mulmoStudioSchema: z.ZodObject<{
|
|
|
3252
3252
|
}, z.core.$strict>>;
|
|
3253
3253
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
3254
3254
|
lang: z.ZodOptional<z.ZodString>;
|
|
3255
|
-
styles: z.
|
|
3255
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3256
3256
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
3257
3257
|
none: "none";
|
|
3258
3258
|
estimate: "estimate";
|
|
@@ -3638,7 +3638,7 @@ export declare const mulmoPromptTemplateSchema: z.ZodObject<{
|
|
|
3638
3638
|
}, z.core.$strict>>;
|
|
3639
3639
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
3640
3640
|
lang: z.ZodOptional<z.ZodString>;
|
|
3641
|
-
styles: z.
|
|
3641
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3642
3642
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
3643
3643
|
none: "none";
|
|
3644
3644
|
estimate: "estimate";
|
|
@@ -4003,7 +4003,7 @@ export declare const mulmoPromptTemplateFileSchema: z.ZodObject<{
|
|
|
4003
4003
|
}, z.core.$strict>>;
|
|
4004
4004
|
captionParams: z.ZodOptional<z.ZodObject<{
|
|
4005
4005
|
lang: z.ZodOptional<z.ZodString>;
|
|
4006
|
-
styles: z.
|
|
4006
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4007
4007
|
captionSplit: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
4008
4008
|
none: "none";
|
|
4009
4009
|
estimate: "estimate";
|
package/lib/types/schema.js
CHANGED
|
@@ -132,7 +132,7 @@ export const textSplitSchema = z.discriminatedUnion("type", [
|
|
|
132
132
|
export const mulmoCaptionParamsSchema = z
|
|
133
133
|
.object({
|
|
134
134
|
lang: langSchema.optional(),
|
|
135
|
-
styles: z.array(z.string()).optional()
|
|
135
|
+
styles: z.array(z.string()).optional(), // css styles
|
|
136
136
|
captionSplit: captionSplitSchema.optional(), // how to determine caption timing
|
|
137
137
|
textSplit: textSplitSchema.optional(), // how to split text into segments (default: none)
|
|
138
138
|
})
|
package/lib/utils/context.d.ts
CHANGED
|
@@ -570,8 +570,8 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
570
570
|
cssStyles: string | string[];
|
|
571
571
|
} | undefined;
|
|
572
572
|
captionParams?: {
|
|
573
|
-
styles: string[];
|
|
574
573
|
lang?: string | undefined;
|
|
574
|
+
styles?: string[] | undefined;
|
|
575
575
|
captionSplit?: "none" | "estimate" | undefined;
|
|
576
576
|
textSplit?: {
|
|
577
577
|
type: "none";
|
|
@@ -605,8 +605,8 @@ export declare const createStudioData: (_mulmoScript: MulmoScript, fileName: str
|
|
|
605
605
|
cssStyles: string | string[];
|
|
606
606
|
} | undefined;
|
|
607
607
|
captionParams?: {
|
|
608
|
-
styles: string[];
|
|
609
608
|
lang?: string | undefined;
|
|
609
|
+
styles?: string[] | undefined;
|
|
610
610
|
captionSplit?: "none" | "estimate" | undefined;
|
|
611
611
|
textSplit?: {
|
|
612
612
|
type: "none";
|
|
@@ -1226,8 +1226,8 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
1226
1226
|
cssStyles: string | string[];
|
|
1227
1227
|
} | undefined;
|
|
1228
1228
|
captionParams?: {
|
|
1229
|
-
styles: string[];
|
|
1230
1229
|
lang?: string | undefined;
|
|
1230
|
+
styles?: string[] | undefined;
|
|
1231
1231
|
captionSplit?: "none" | "estimate" | undefined;
|
|
1232
1232
|
textSplit?: {
|
|
1233
1233
|
type: "none";
|
|
@@ -1261,8 +1261,8 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
1261
1261
|
cssStyles: string | string[];
|
|
1262
1262
|
} | undefined;
|
|
1263
1263
|
captionParams?: {
|
|
1264
|
-
styles: string[];
|
|
1265
1264
|
lang?: string | undefined;
|
|
1265
|
+
styles?: string[] | undefined;
|
|
1266
1266
|
captionSplit?: "none" | "estimate" | undefined;
|
|
1267
1267
|
textSplit?: {
|
|
1268
1268
|
type: "none";
|
|
@@ -1584,8 +1584,8 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
1584
1584
|
cssStyles: string | string[];
|
|
1585
1585
|
} | undefined;
|
|
1586
1586
|
captionParams?: {
|
|
1587
|
-
styles: string[];
|
|
1588
1587
|
lang?: string | undefined;
|
|
1588
|
+
styles?: string[] | undefined;
|
|
1589
1589
|
captionSplit?: "none" | "estimate" | undefined;
|
|
1590
1590
|
textSplit?: {
|
|
1591
1591
|
type: "none";
|