mulmocast 0.0.24 → 0.0.25

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 CHANGED
@@ -103,6 +103,14 @@ GOOGLE_PROJECT_ID=your_google_project_id
103
103
 
104
104
  See also [pre-requisites for Google's image generation model](./docs/pre-requisites-google.md)
105
105
 
106
+ #### (Optional) For AI providers
107
+ ```bash
108
+ # For Anthropic Claude (htmlPrompt feature)
109
+ ANTHROPIC_API_TOKEN=your_anthropic_api_token
110
+ ```
111
+
112
+ For htmlPrompt configuration, see [docs/image.md](./docs/image.md#2-htmlprompt).
113
+
106
114
  #### (Optional) For Movie models
107
115
  ```bash
108
116
  REPLICATE_API_TOKEN=your_replicate_api_key
@@ -77,6 +77,9 @@ export const imagePluginAgent = async (namedInputs) => {
77
77
  };
78
78
  const htmlImageGeneratorAgent = async (namedInputs) => {
79
79
  const { html, file, canvasSize } = namedInputs;
80
+ // Save HTML file
81
+ const htmlFile = file.replace(/\.[^/.]+$/, ".html");
82
+ await fs.promises.writeFile(htmlFile, html, "utf8");
80
83
  await renderHTMLToImage(html, file, canvasSize.width, canvasSize.height);
81
84
  };
82
85
  const beat_graph_data = {
@@ -115,12 +118,13 @@ const beat_graph_data = {
115
118
  if: ":preprocessor.htmlPrompt",
116
119
  defaultValue: {},
117
120
  agent: ":htmlImageAgentInfo.agent",
118
- params: {
119
- mode: ":htmlImageAgentInfo.model",
120
- },
121
121
  inputs: {
122
122
  prompt: ":preprocessor.htmlPrompt",
123
123
  system: ":preprocessor.htmlImageSystemPrompt",
124
+ params: {
125
+ model: ":htmlImageAgentInfo.model",
126
+ max_tokens: ":htmlImageAgentInfo.max_tokens",
127
+ },
124
128
  },
125
129
  },
126
130
  htmlImageGenerator: {
@@ -16,7 +16,7 @@ export declare const builder: (yargs: Argv) => Argv<{
16
16
  } & {
17
17
  s: string;
18
18
  } & {
19
- llm: "anthropic" | "openAI" | "gemini" | "groq" | undefined;
19
+ llm: "openai" | "anthropic" | "gemini" | "groq" | undefined;
20
20
  } & {
21
21
  llm_model: string | undefined;
22
22
  }>;
@@ -10,7 +10,7 @@ export declare const builder: (yargs: Argv) => Argv<{
10
10
  } & {
11
11
  beats_per_scene: number;
12
12
  } & {
13
- llm: "anthropic" | "openAI" | "gemini" | "groq" | undefined;
13
+ llm: "openai" | "anthropic" | "gemini" | "groq" | undefined;
14
14
  } & {
15
15
  llm_model: string | undefined;
16
16
  } & {
@@ -1,5 +1,5 @@
1
1
  import "dotenv/config";
2
- import { userAssert } from "../utils/utils.js";
2
+ import { userAssert, llmConfig } from "../utils/utils.js";
3
3
  import { text2ImageProviderSchema, text2HtmlImageProviderSchema, text2SpeechProviderSchema, mulmoCanvasDimensionSchema } from "../types/schema.js";
4
4
  import { defaultOpenAIImageModel } from "../utils/const.js";
5
5
  const defaultTextSlideStyles = [
@@ -72,16 +72,13 @@ export const MulmoPresentationStyleMethods = {
72
72
  },
73
73
  getHtmlImageAgentInfo(presentationStyle) {
74
74
  const provider = text2HtmlImageProviderSchema.parse(presentationStyle.htmlImageParams?.provider);
75
- const agent = provider === "anthropic" ? "anthropicAgent" : "openAIAgent";
76
- const model = presentationStyle.htmlImageParams?.model
77
- ? presentationStyle.htmlImageParams?.model
78
- : provider === "anthropic"
79
- ? "claude-3-7-sonnet-20250219"
80
- : "gpt-4o-mini";
75
+ const defaultConfig = llmConfig[provider];
76
+ const model = presentationStyle.htmlImageParams?.model ? presentationStyle.htmlImageParams?.model : defaultConfig.defaultModel;
81
77
  return {
82
78
  provider,
83
- agent,
79
+ agent: defaultConfig.agent,
84
80
  model,
81
+ max_tokens: defaultConfig.max_tokens,
85
82
  };
86
83
  },
87
84
  getImageType(_, beat) {
@@ -83,6 +83,7 @@ export type Text2HtmlAgentInfo = {
83
83
  provider: Text2HtmlImageProvider;
84
84
  agent: string;
85
85
  model: string;
86
+ max_tokens: number;
86
87
  };
87
88
  export type BeatMediaType = "movie" | "image";
88
89
  export type StoryToScriptGenerateMode = (typeof storyToScriptGenerateMode)[keyof typeof storyToScriptGenerateMode];
@@ -128,7 +128,7 @@ export const htmlImageSystemPrompt = (canvasSize) => {
128
128
  return [
129
129
  "Based on the provided information, create a single slide HTML page using Tailwind CSS.",
130
130
  `The view port size is ${canvasSize.width}x${canvasSize.height}. Make sure the HTML fits within the view port.`,
131
- "If charts are needed, use Chart.js to present them in a clean and visually appealing way.",
131
+ "If charts are needed, use Chart.js to present them in a clean and visually appealing way (with animation:false to disable animation).",
132
132
  "Include a balanced mix of comments, graphs, and illustrations to enhance visual impact.",
133
133
  "Output only the HTML code. Do not include any comments, explanations, or additional information outside the HTML.",
134
134
  "If data is provided, use it effectively to populate the slide.",
@@ -1,6 +1,6 @@
1
1
  import { MulmoBeat, MulmoStudioMultiLingualData } from "../types/index.js";
2
2
  import type { ConfigDataDictionary, DefaultConfigData } from "graphai";
3
- export declare const llm: readonly ["openAI", "anthropic", "gemini", "groq"];
3
+ export declare const llm: readonly ["openai", "anthropic", "gemini", "groq"];
4
4
  export type LLM = (typeof llm)[number];
5
5
  export declare const llmConfig: Record<LLM, {
6
6
  agent: string;
@@ -1,7 +1,7 @@
1
1
  import * as crypto from "crypto";
2
- export const llm = ["openAI", "anthropic", "gemini", "groq"];
2
+ export const llm = ["openai", "anthropic", "gemini", "groq"];
3
3
  export const llmConfig = {
4
- openAI: {
4
+ openai: {
5
5
  agent: "openAIAgent",
6
6
  defaultModel: "gpt-4o",
7
7
  max_tokens: 8192,
@@ -23,10 +23,10 @@ export const llmConfig = {
23
23
  },
24
24
  };
25
25
  export const llmPair = (_llm, _model) => {
26
- const llmKey = _llm ?? "openAI";
27
- const agent = llmConfig[llmKey]?.agent ?? llmConfig.openAI.agent;
28
- const model = _model ?? llmConfig[llmKey]?.defaultModel ?? llmConfig.openAI.defaultModel;
29
- const max_tokens = llmConfig[llmKey]?.max_tokens ?? llmConfig.openAI.max_tokens;
26
+ const llmKey = _llm ?? "openai";
27
+ const agent = llmConfig[llmKey]?.agent ?? llmConfig.openai.agent;
28
+ const model = _model ?? llmConfig[llmKey]?.defaultModel ?? llmConfig.openai.defaultModel;
29
+ const max_tokens = llmConfig[llmKey]?.max_tokens ?? llmConfig.openai.max_tokens;
30
30
  return { agent, model, max_tokens };
31
31
  };
32
32
  export const chunkArray = (array, size = 3) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -68,22 +68,22 @@
68
68
  "@graphai/stream_agent_filter": "^2.0.2",
69
69
  "@graphai/vanilla": "^2.0.4",
70
70
  "@graphai/vanilla_node_agents": "^2.0.1",
71
- "@tavily/core": "^0.5.7",
72
- "canvas": "^3.1.0",
71
+ "@tavily/core": "^0.5.8",
72
+ "canvas": "^3.1.2",
73
73
  "clipboardy": "^4.0.0",
74
- "dotenv": "^16.4.7",
74
+ "dotenv": "^17.0.0",
75
75
  "fluent-ffmpeg": "^2.1.3",
76
76
  "google-auth-library": "^9.15.1",
77
77
  "graphai": "^2.0.9",
78
- "inquirer": "^12.6.1",
78
+ "inquirer": "^12.6.3",
79
79
  "marked": "^15.0.12",
80
80
  "ora": "^8.2.0",
81
- "puppeteer": "^24.10.2",
81
+ "puppeteer": "^24.11.0",
82
82
  "replicate": "^1.0.1",
83
83
  "yaml": "^2.8.0",
84
84
  "yargs": "^17.7.2",
85
85
  "zod": "^3.25.67",
86
- "zod-to-json-schema": "^3.24.5"
86
+ "zod-to-json-schema": "^3.24.6"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@anatine/zod-mock": "^3.14.0",
@@ -91,14 +91,14 @@
91
91
  "@receptron/test_utils": "^2.0.0",
92
92
  "@types/fluent-ffmpeg": "^2.1.26",
93
93
  "@types/yargs": "^17.0.33",
94
- "eslint": "^9.29.0",
94
+ "eslint": "^9.30.0",
95
95
  "eslint-config-prettier": "^10.1.5",
96
- "eslint-plugin-prettier": "^5.5.0",
97
- "prettier": "^3.3.3",
96
+ "eslint-plugin-prettier": "^5.5.1",
97
+ "prettier": "^3.6.2",
98
98
  "ts-node": "^10.9.2",
99
99
  "tsx": "^4.20.3",
100
100
  "typescript": "^5.7.3",
101
- "typescript-eslint": "^8.34.1"
101
+ "typescript-eslint": "^8.35.0"
102
102
  },
103
103
  "engines": {
104
104
  "node": ">=18.0.0"