mol_plot_all 1.2.566 → 1.2.568

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mol_plot_all",
3
- "version": "1.2.566",
3
+ "version": "1.2.568",
4
4
  "exports": {
5
5
  "node": {
6
6
  "import": "./node.mjs",
package/web.test.js CHANGED
@@ -3487,7 +3487,20 @@ var $;
3487
3487
  });
3488
3488
  function $mol_huggingface_run(space, method, ...data) {
3489
3489
  if (typeof method === 'number') {
3490
- return $mol_wire_sync(this).$mol_huggingface_async(space, method, ...data);
3490
+ while (true) {
3491
+ try {
3492
+ return $mol_wire_sync(this).$mol_huggingface_async(space, method, ...data);
3493
+ }
3494
+ catch (error) {
3495
+ if ($mol_promise_like(error))
3496
+ $mol_fail_hidden(error);
3497
+ if (error instanceof Error && error.message === `Queue full`) {
3498
+ $mol_fail_log(error);
3499
+ continue;
3500
+ }
3501
+ $mol_fail_hidden(error);
3502
+ }
3503
+ }
3491
3504
  }
3492
3505
  const response = $mol_fetch.json(`https://${space}.hf.space/run/${method}`, {
3493
3506
  method: 'post',
@@ -3515,6 +3528,8 @@ var $;
3515
3528
  case 'send_hash':
3516
3529
  return socket.send(JSON.stringify({ session_hash, fn_index }));
3517
3530
  case 'estimation': return;
3531
+ case 'queue_full':
3532
+ fail(new Error(`Queue full`));
3518
3533
  case 'send_data':
3519
3534
  return socket.send(JSON.stringify({ session_hash, fn_index, data }));
3520
3535
  case 'process_starts': return;
@@ -3542,7 +3557,12 @@ var $;
3542
3557
  var $;
3543
3558
  (function ($) {
3544
3559
  function $hyoo_lingua_translate(lang, text) {
3545
- return this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
3560
+ const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
3561
+ const cached = this.$mol_state_local.value(cache_key);
3562
+ if (cached)
3563
+ return String(cached);
3564
+ const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
3565
+ return this.$mol_state_local.value(cache_key, translated);
3546
3566
  }
3547
3567
  $.$hyoo_lingua_translate = $hyoo_lingua_translate;
3548
3568
  })($ || ($ = {}));
@@ -3585,13 +3605,8 @@ var $;
3585
3605
  const en = this.texts('en')[key];
3586
3606
  if (!en)
3587
3607
  return key;
3588
- const cache_key = `$mol_locale.text(${JSON.stringify(key)}):${lang}`;
3589
- const cached = this.$.$mol_state_local.value(cache_key);
3590
- if (cached)
3591
- return cached;
3592
3608
  try {
3593
- const translated = $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
3594
- return this.$.$mol_state_local.value(cache_key, translated);
3609
+ return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
3595
3610
  }
3596
3611
  catch (error) {
3597
3612
  $mol_fail_log(error);