mulmocast 1.2.17 → 1.2.18
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/images.js
CHANGED
|
@@ -190,7 +190,8 @@ const beat_graph_data = {
|
|
|
190
190
|
return { hasMovieAudio: true };
|
|
191
191
|
}
|
|
192
192
|
const sourceFile = namedInputs.movieFile || namedInputs.imageFile;
|
|
193
|
-
if (!sourceFile
|
|
193
|
+
if (!sourceFile) {
|
|
194
|
+
// no need to check if the file exists (ffmpegGetMediaDuration will check it if it is local file)
|
|
194
195
|
return { hasMovieAudio: false };
|
|
195
196
|
}
|
|
196
197
|
const { hasAudio } = await ffmpegGetMediaDuration(sourceFile);
|
package/lib/actions/translate.js
CHANGED
|
@@ -68,10 +68,9 @@ const beatGraph = {
|
|
|
68
68
|
// for cache
|
|
69
69
|
multiLingual: {
|
|
70
70
|
agent: (namedInputs) => {
|
|
71
|
-
const { multiLinguals, beatIndex, text
|
|
72
|
-
const key = beatId(beat?.id, beatIndex);
|
|
71
|
+
const { multiLinguals, beatIndex, text } = namedInputs;
|
|
73
72
|
const cacheKey = hashSHA256(text ?? "");
|
|
74
|
-
const multiLingual = multiLinguals?.[
|
|
73
|
+
const multiLingual = multiLinguals?.[beatIndex];
|
|
75
74
|
if (!multiLingual) {
|
|
76
75
|
return { cacheKey, multiLingualTexts: {} };
|
|
77
76
|
}
|
|
@@ -87,7 +86,6 @@ const beatGraph = {
|
|
|
87
86
|
},
|
|
88
87
|
inputs: {
|
|
89
88
|
text: ":beat.text",
|
|
90
|
-
beat: ":beat",
|
|
91
89
|
beatIndex: ":__mapIndex",
|
|
92
90
|
multiLinguals: ":context.multiLingual",
|
|
93
91
|
},
|
|
@@ -199,14 +197,17 @@ const localizedTextCacheAgentFilter = async (context, next) => {
|
|
|
199
197
|
}
|
|
200
198
|
// same language
|
|
201
199
|
if (targetLang === lang) {
|
|
200
|
+
GraphAILogger.log(`translate: ${beatIndex} same lang`);
|
|
202
201
|
return { text: beat.text };
|
|
203
202
|
}
|
|
204
203
|
// The original text is unchanged and the target language text is present
|
|
205
204
|
if (multiLingual.cacheKey === multiLingual.multiLingualTexts[targetLang]?.cacheKey) {
|
|
205
|
+
GraphAILogger.log(`translate: ${beatIndex} cache hit`);
|
|
206
206
|
return { text: multiLingual.multiLingualTexts[targetLang].text };
|
|
207
207
|
}
|
|
208
208
|
try {
|
|
209
209
|
MulmoStudioContextMethods.setBeatSessionState(mulmoContext, "multiLingual", beatIndex, beat.id, true);
|
|
210
|
+
GraphAILogger.log(`translate: ${beatIndex} run`);
|
|
210
211
|
return await next(context);
|
|
211
212
|
}
|
|
212
213
|
finally {
|
|
@@ -64,7 +64,9 @@ export const ffmpegGetMediaDuration = (filePath) => {
|
|
|
64
64
|
return new Promise((resolve, reject) => {
|
|
65
65
|
// Only check file existence for local paths, not URLs
|
|
66
66
|
if (!filePath.startsWith("http://") && !filePath.startsWith("https://") && !fs.existsSync(filePath)) {
|
|
67
|
-
reject
|
|
67
|
+
// NOTE: We don't reject here for scripts/test/test_hello_image.json, which uses mock image agent.
|
|
68
|
+
// reject(new Error(`File not found: ${filePath}`));
|
|
69
|
+
resolve({ duration: 0, hasAudio: false });
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
ffmpeg.ffprobe(filePath, (err, metadata) => {
|