mulmocast 1.2.9 → 1.2.11

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.
@@ -6,7 +6,8 @@ import { ttsNijivoiceAgent, ttsOpenaiAgent, ttsGoogleAgent, ttsElevenlabsAgent,
6
6
  import { text2SpeechProviderSchema } from "../types/index.js";
7
7
  import { fileCacheAgentFilter, nijovoiceTextAgentFilter } from "../utils/filters.js";
8
8
  import { getAudioArtifactFilePath, getAudioFilePath, getOutputStudioFilePath, resolveDirPath, defaultBGMPath, mkdir, writingMessage } from "../utils/file.js";
9
- import { text2hash, localizedText, settings2GraphAIConfig } from "../utils/utils.js";
9
+ import { localizedText, settings2GraphAIConfig } from "../utils/utils.js";
10
+ import { text2hash } from "../utils/utils_node.js";
10
11
  import { provider2TTSAgent } from "../utils/provider2agent.js";
11
12
  import { MulmoPresentationStyleMethods } from "../methods/index.js";
12
13
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
@@ -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: "networkidle0" });
145
+ await page.setContent(html, { waitUntil: "domcontentloaded" });
146
+ await sleep(1000);
146
147
  await page.pdf({
147
148
  path: outputPdfPath,
148
149
  printBackground: true,
@@ -151,7 +151,7 @@ const translateGraph = {
151
151
  return tmp;
152
152
  }, {});
153
153
  return {
154
- version: "1.1",
154
+ version: currentMulmoScriptVersion,
155
155
  multiLingual: multiLingualObject,
156
156
  };
157
157
  },
@@ -2,3 +2,6 @@ export * from "./types/index.js";
2
2
  export * from "./utils/provider2agent.js";
3
3
  export * from "./utils/const.js";
4
4
  export * from "./utils/string.js";
5
+ export * from "./utils/utils.js";
6
+ export * from "./methods/mulmo_presentation_style.js";
7
+ export * from "./methods/mulmo_script.js";
@@ -3,3 +3,6 @@ export * from "./types/index.js";
3
3
  export * from "./utils/provider2agent.js";
4
4
  export * from "./utils/const.js";
5
5
  export * from "./utils/string.js";
6
+ export * from "./utils/utils.js";
7
+ export * from "./methods/mulmo_presentation_style.js";
8
+ export * from "./methods/mulmo_script.js";
@@ -1,4 +1,3 @@
1
- import "dotenv/config";
2
1
  import { MulmoCanvasDimension, MulmoBeat, Text2SpeechProvider, Text2ImageAgentInfo, Text2HtmlAgentInfo, BeatMediaType, MulmoPresentationStyle, SpeakerData, Text2ImageProvider, MulmoStudioContext } from "../types/index.js";
3
2
  export declare const MulmoPresentationStyleMethods: {
4
3
  getCanvasSize(presentationStyle: MulmoPresentationStyle): MulmoCanvasDimension;
@@ -1,4 +1,4 @@
1
- import "dotenv/config";
1
+ // node & browser
2
2
  import { isNull } from "graphai";
3
3
  import { userAssert } from "../utils/utils.js";
4
4
  import { text2ImageProviderSchema, text2HtmlImageProviderSchema, text2MovieProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema, } from "../types/schema.js";
@@ -1,3 +1,4 @@
1
+ // node & browser
1
2
  import { GraphAILogger } from "graphai";
2
3
  import { mulmoScriptSchema, mulmoStudioMultiLingualFileSchema } from "../types/index.js";
3
4
  import { beatId } from "../utils/utils.js";
@@ -0,0 +1 @@
1
+ export declare const beatId: (id: string | undefined, index: number) => string;
@@ -0,0 +1,4 @@
1
+ export const beatId = (id, index) => {
2
+ const key = id ?? `__index__${index}`;
3
+ return key;
4
+ };
@@ -4,7 +4,7 @@ import path from "path";
4
4
  import fsPromise from "fs/promises";
5
5
  import { GraphAILogger } from "graphai";
6
6
  import { writingMessage } from "./file.js";
7
- import { text2hash } from "./utils.js";
7
+ import { text2hash } from "./utils_node.js";
8
8
  import { MulmoStudioContextMethods } from "../methods/mulmo_studio_context.js";
9
9
  import { replacementsJa, replacePairsJa } from "../utils/string.js";
10
10
  export const nijovoiceTextAgentFilter = async (context, next) => {
@@ -1,6 +1,6 @@
1
1
  import type { ConfigDataDictionary, DefaultConfigData } from "graphai";
2
2
  import { MulmoBeat, MulmoStudioBeat, MulmoStudioMultiLingual, MulmoStudioMultiLingualData } from "../types/index.js";
3
- import type { LLM } from "./provider2agent.js";
3
+ import { type LLM } from "./provider2agent.js";
4
4
  export declare const llmPair: (_llm?: LLM, _model?: string) => {
5
5
  agent: "mediaMockAgent" | "openAIAgent" | "anthropicAgent" | "geminiAgent" | "groqAgent";
6
6
  model: string;
@@ -8,7 +8,6 @@ export declare const llmPair: (_llm?: LLM, _model?: string) => {
8
8
  };
9
9
  export declare const chunkArray: <T>(array: T[], size?: number) => T[][];
10
10
  export declare const isHttp: (fileOrUrl: string) => boolean;
11
- export declare const text2hash: (input: string) => string;
12
11
  export declare const localizedText: (beat: MulmoBeat, multiLingualData?: MulmoStudioMultiLingualData, targetLang?: string, defaultLang?: string) => string;
13
12
  export declare function userAssert(condition: boolean, message: string): asserts condition;
14
13
  export declare const settings2GraphAIConfig: (settings?: Record<string, string>, env?: Record<string, string | undefined>) => ConfigDataDictionary<DefaultConfigData>;
@@ -1,4 +1,4 @@
1
- import * as crypto from "crypto";
1
+ // node & browser
2
2
  import { provider2LLMAgent } from "./provider2agent.js";
3
3
  export const llmPair = (_llm, _model) => {
4
4
  const llmKey = _llm ?? "openai";
@@ -17,9 +17,6 @@ export const chunkArray = (array, size = 3) => {
17
17
  export const isHttp = (fileOrUrl) => {
18
18
  return /^https?:\/\//.test(fileOrUrl);
19
19
  };
20
- export const text2hash = (input) => {
21
- return crypto.createHash("sha256").update(input).digest("hex");
22
- };
23
20
  export const localizedText = (beat, multiLingualData, targetLang, defaultLang) => {
24
21
  if (targetLang === defaultLang) {
25
22
  return beat.text;
@@ -0,0 +1 @@
1
+ export declare const text2hash: (input: string) => string;
@@ -0,0 +1,4 @@
1
+ import * as crypto from "crypto";
2
+ export const text2hash = (input) => {
3
+ return crypto.createHash("sha256").update(input).digest("hex");
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",