mol_plot_all 1.2.567 → 1.2.569

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/node.test.js CHANGED
@@ -9896,7 +9896,20 @@ var $;
9896
9896
  });
9897
9897
  function $mol_huggingface_run(space, method, ...data) {
9898
9898
  if (typeof method === 'number') {
9899
- return $mol_wire_sync(this).$mol_huggingface_async(space, method, ...data);
9899
+ while (true) {
9900
+ try {
9901
+ return $mol_wire_sync(this).$mol_huggingface_async(space, method, ...data);
9902
+ }
9903
+ catch (error) {
9904
+ if ($mol_promise_like(error))
9905
+ $mol_fail_hidden(error);
9906
+ if (error instanceof Error && error.message === `Queue full`) {
9907
+ $mol_fail_log(error);
9908
+ continue;
9909
+ }
9910
+ $mol_fail_hidden(error);
9911
+ }
9912
+ }
9900
9913
  }
9901
9914
  const response = $mol_fetch.json(`https://${space}.hf.space/run/${method}`, {
9902
9915
  method: 'post',
@@ -9924,6 +9937,8 @@ var $;
9924
9937
  case 'send_hash':
9925
9938
  return socket.send(JSON.stringify({ session_hash, fn_index }));
9926
9939
  case 'estimation': return;
9940
+ case 'queue_full':
9941
+ fail(new Error(`Queue full`));
9927
9942
  case 'send_data':
9928
9943
  return socket.send(JSON.stringify({ session_hash, fn_index, data }));
9929
9944
  case 'process_starts': return;
@@ -9951,7 +9966,12 @@ var $;
9951
9966
  var $;
9952
9967
  (function ($) {
9953
9968
  function $hyoo_lingua_translate(lang, text) {
9954
- return this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
9969
+ const cache_key = `$hyoo_lingua_translate(${JSON.stringify(lang)},${JSON.stringify(text)})`;
9970
+ const cached = this.$mol_state_local.value(cache_key);
9971
+ if (cached)
9972
+ return String(cached);
9973
+ const translated = this.$mol_huggingface_run('hyoo-translate', 0, lang, text)[0];
9974
+ return this.$mol_state_local.value(cache_key, translated);
9955
9975
  }
9956
9976
  $.$hyoo_lingua_translate = $hyoo_lingua_translate;
9957
9977
  })($ || ($ = {}));
@@ -9994,13 +10014,8 @@ var $;
9994
10014
  const en = this.texts('en')[key];
9995
10015
  if (!en)
9996
10016
  return key;
9997
- const cache_key = `$mol_locale.text(${JSON.stringify(key)}):${lang}`;
9998
- const cached = this.$.$mol_state_local.value(cache_key);
9999
- if (cached)
10000
- return cached;
10001
10017
  try {
10002
- const translated = $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
10003
- return this.$.$mol_state_local.value(cache_key, translated);
10018
+ return $mol_wire_sync($hyoo_lingua_translate).call(this.$, lang, en);
10004
10019
  }
10005
10020
  catch (error) {
10006
10021
  $mol_fail_log(error);