mulmocast 1.2.9 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions/pdf.js +3 -2
- package/lib/actions/translate.js +3 -2
- package/lib/index.common.d.ts +1 -0
- package/lib/index.common.js +1 -0
- package/lib/methods/mulmo_script.js +1 -1
- package/lib/methods/mulmo_studio_context.js +1 -1
- package/lib/utils/common.d.ts +1 -0
- package/lib/utils/common.js +4 -0
- package/lib/utils/context.js +2 -1
- package/lib/utils/utils.d.ts +0 -1
- package/lib/utils/utils.js +1 -4
- package/package.json +1 -1
package/lib/actions/pdf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import puppeteer from "puppeteer";
|
|
4
|
-
import { GraphAILogger } from "graphai";
|
|
4
|
+
import { GraphAILogger, sleep } from "graphai";
|
|
5
5
|
import { MulmoPresentationStyleMethods } from "../methods/index.js";
|
|
6
6
|
import { localizedText, isHttp } from "../utils/utils.js";
|
|
7
7
|
import { getOutputPdfFilePath, writingMessage, getHTMLFile } from "../utils/file.js";
|
|
@@ -142,7 +142,8 @@ const generatePDF = async (context, pdfMode, pdfSize) => {
|
|
|
142
142
|
});
|
|
143
143
|
try {
|
|
144
144
|
const page = await browser.newPage();
|
|
145
|
-
await page.setContent(html, { waitUntil: "
|
|
145
|
+
await page.setContent(html, { waitUntil: "domcontentloaded" });
|
|
146
|
+
await sleep(1000);
|
|
146
147
|
await page.pdf({
|
|
147
148
|
path: outputPdfPath,
|
|
148
149
|
printBackground: true,
|
package/lib/actions/translate.js
CHANGED
|
@@ -5,7 +5,8 @@ import * as agents from "@graphai/vanilla";
|
|
|
5
5
|
import { openAIAgent } from "@graphai/openai_agent";
|
|
6
6
|
import { fileWriteAgent } from "@graphai/vanilla_node_agents";
|
|
7
7
|
import { splitText } from "../utils/string.js";
|
|
8
|
-
import { settings2GraphAIConfig,
|
|
8
|
+
import { settings2GraphAIConfig, multiLingualObjectToArray } from "../utils/utils.js";
|
|
9
|
+
import { beatId } from "../utils/common.js";
|
|
9
10
|
import { getMultiLingual } from "../utils/context.js";
|
|
10
11
|
import { currentMulmoScriptVersion } from "../utils/const.js";
|
|
11
12
|
import { getOutputMultilingualFilePath, mkdir, writingMessage, hashSHA256 } from "../utils/file.js";
|
|
@@ -151,7 +152,7 @@ const translateGraph = {
|
|
|
151
152
|
return tmp;
|
|
152
153
|
}, {});
|
|
153
154
|
return {
|
|
154
|
-
version:
|
|
155
|
+
version: currentMulmoScriptVersion,
|
|
155
156
|
multiLingual: multiLingualObject,
|
|
156
157
|
};
|
|
157
158
|
},
|
package/lib/index.common.d.ts
CHANGED
package/lib/index.common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphAILogger } from "graphai";
|
|
2
2
|
import { mulmoScriptSchema, mulmoStudioMultiLingualFileSchema } from "../types/index.js";
|
|
3
|
-
import { beatId } from "../utils/
|
|
3
|
+
import { beatId } from "../utils/common.js";
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
5
|
const validate_1_0 = (script) => {
|
|
6
6
|
if (script.speechParams?.provider) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const beatId: (id: string | undefined, index: number) => string;
|
package/lib/utils/context.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GraphAILogger } from "graphai";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import { readMulmoScriptFile, fetchMulmoScriptFile } from "./file.js";
|
|
4
|
-
import {
|
|
4
|
+
import { multiLingualObjectToArray } from "./utils.js";
|
|
5
|
+
import { beatId } from "./common.js";
|
|
5
6
|
import { mulmoStudioSchema, mulmoCaptionParamsSchema, mulmoPresentationStyleSchema } from "../types/schema.js";
|
|
6
7
|
import { MulmoPresentationStyleMethods, MulmoScriptMethods, MulmoStudioMultiLingualMethod } from "../methods/index.js";
|
|
7
8
|
const mulmoCredit = (speaker) => {
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ type CleanableObject = {
|
|
|
19
19
|
[key: string]: CleanableValue;
|
|
20
20
|
};
|
|
21
21
|
export declare const deepClean: <T extends CleanableValue>(input: T) => T | undefined;
|
|
22
|
-
export declare const beatId: (id: string | undefined, index: number) => string;
|
|
23
22
|
export declare const multiLingualObjectToArray: (multiLingual: MulmoStudioMultiLingual | undefined, beats: MulmoStudioBeat[]) => {
|
|
24
23
|
multiLingualTexts: Record<string, {
|
|
25
24
|
text: string;
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
2
|
import { provider2LLMAgent } from "./provider2agent.js";
|
|
3
|
+
import { beatId } from "./common.js";
|
|
3
4
|
export const llmPair = (_llm, _model) => {
|
|
4
5
|
const llmKey = _llm ?? "openai";
|
|
5
6
|
const agent = provider2LLMAgent[llmKey]?.agentName ?? provider2LLMAgent.openai.agentName;
|
|
@@ -117,10 +118,6 @@ export const deepClean = (input) => {
|
|
|
117
118
|
}
|
|
118
119
|
return input;
|
|
119
120
|
};
|
|
120
|
-
export const beatId = (id, index) => {
|
|
121
|
-
const key = id ?? `__index__${index}`;
|
|
122
|
-
return key;
|
|
123
|
-
};
|
|
124
121
|
export const multiLingualObjectToArray = (multiLingual, beats) => {
|
|
125
122
|
return beats.map((beat, index) => {
|
|
126
123
|
const key = beatId(beat?.id, index);
|