mulmocast 1.2.59 → 1.2.60

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.
@@ -457,26 +457,41 @@ export const images = async (context, args) => {
457
457
  };
458
458
  // public api
459
459
  export const generateBeatImage = async (inputs) => {
460
- const { index, context, args } = inputs;
461
- const { settings, callbacks, forceMovie, forceImage, forceLipSync, forceSoundEffect } = args ?? {};
462
- const options = await graphOption(context, settings);
463
- const injections = await prepareGenerateImages(context);
464
- const graph = new GraphAI(beat_graph_data, defaultAgents, options);
465
- Object.keys(injections).forEach((key) => {
466
- if ("outputStudioFilePath" !== key) {
467
- graph.injectValue(key, injections[key]);
468
- }
469
- });
470
- graph.injectValue("__mapIndex", index);
471
- graph.injectValue("beat", context.studio.script.beats[index]);
472
- graph.injectValue("forceMovie", forceMovie ?? false);
473
- graph.injectValue("forceImage", forceImage ?? false);
474
- graph.injectValue("forceLipSync", forceLipSync ?? false);
475
- graph.injectValue("forceSoundEffect", forceSoundEffect ?? false);
476
- if (callbacks) {
477
- callbacks.forEach((callback) => {
478
- graph.registerCallback(callback);
460
+ try {
461
+ const { index, context, args } = inputs;
462
+ const { settings, callbacks, forceMovie, forceImage, forceLipSync, forceSoundEffect } = args ?? {};
463
+ const options = await graphOption(context, settings);
464
+ const injections = await prepareGenerateImages(context);
465
+ const graph = new GraphAI(beat_graph_data, defaultAgents, options);
466
+ Object.keys(injections).forEach((key) => {
467
+ if ("outputStudioFilePath" !== key) {
468
+ graph.injectValue(key, injections[key]);
469
+ }
479
470
  });
471
+ graph.injectValue("__mapIndex", index);
472
+ graph.injectValue("beat", context.studio.script.beats[index]);
473
+ graph.injectValue("forceMovie", forceMovie ?? false);
474
+ graph.injectValue("forceImage", forceImage ?? false);
475
+ graph.injectValue("forceLipSync", forceLipSync ?? false);
476
+ graph.injectValue("forceSoundEffect", forceSoundEffect ?? false);
477
+ if (callbacks) {
478
+ callbacks.forEach((callback) => {
479
+ graph.registerCallback(callback);
480
+ });
481
+ }
482
+ await graph.run();
483
+ }
484
+ catch (error) {
485
+ if (error instanceof AuthenticationError) {
486
+ throw new Error("Failed to generate image: 401 Incorrect API key provided with OpenAI", {
487
+ cause: agentIncorrectAPIKeyError("openaiAgent", imageAction, imageFileTarget),
488
+ });
489
+ }
490
+ if (error instanceof RateLimitError) {
491
+ throw new Error("You exceeded your current quota", {
492
+ cause: agentAPIRateLimitError("openaiAgent", imageAction, imageFileTarget),
493
+ });
494
+ }
495
+ throw error;
480
496
  }
481
- await graph.run();
482
497
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "1.2.59",
3
+ "version": "1.2.60",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",