zetavg commited on
Commit
e3a5631
1 Parent(s): 883e16a

fix inference prompt preview not updated to the latest version

Browse files
Files changed (1) hide show
  1. llama_lora/ui/inference_ui.py +8 -2
llama_lora/ui/inference_ui.py CHANGED
@@ -655,9 +655,15 @@ def inference_ui():
655
  return function (...args) {
656
  const context = this;
657
  clearTimeout(timeout);
658
- timeout = setTimeout(() => {
 
 
 
 
 
659
  func.apply(context, args);
660
- }, wait);
 
661
  };
662
  }
663
 
 
655
  return function (...args) {
656
  const context = this;
657
  clearTimeout(timeout);
658
+ const fn = () => {
659
+ if (document.querySelector('#inference_preview_prompt > .wrap:not(.hide)')) {
660
+ // Preview request is still loading, wait for 10ms and try again.
661
+ timeout = setTimeout(fn, 10);
662
+ return;
663
+ }
664
  func.apply(context, args);
665
+ };
666
+ timeout = setTimeout(fn, wait);
667
  };
668
  }
669