diff options
author | siutin <osiutino@gmail.com> | 2023-03-28 16:17:19 +0000 |
---|---|---|
committer | siutin <osiutino@gmail.com> | 2023-03-30 09:20:09 +0000 |
commit | 70ab21e67d128b953fbf4a360e02ac783f40dd55 (patch) | |
tree | ddbe1095cef2b99c46957a90885475c58a582b51 | |
parent | 90366b8d8564c6fcbf5899fb31e426b68b04eb7b (diff) | |
download | stable-diffusion-webui-gfx803-70ab21e67d128b953fbf4a360e02ac783f40dd55.tar.gz stable-diffusion-webui-gfx803-70ab21e67d128b953fbf4a360e02ac783f40dd55.tar.bz2 stable-diffusion-webui-gfx803-70ab21e67d128b953fbf4a360e02ac783f40dd55.zip |
keep randomId simpler
-rw-r--r-- | javascript/progressbar.js | 4 | ||||
-rw-r--r-- | javascript/ui.js | 10 | ||||
-rw-r--r-- | modules/progress.py | 4 |
3 files changed, 6 insertions, 12 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js index 7ba14192..4ac9b8db 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -59,8 +59,8 @@ function setTitle(progress){ } -function randomId(prefix=null){ - return "task(" + (prefix == null ? "" : prefix + "_") + Math.random().toString(36).slice(2, 7) + Math.random().toString(36).slice(2, 7) + Math.random().toString(36).slice(2, 7)+")" +function randomId(){ + return "task(" + Math.random().toString(36).slice(2, 7) + Math.random().toString(36).slice(2, 7) + Math.random().toString(36).slice(2, 7)+")" } // starts sending progress requests to "/internal/progress" uri, creating progressbar above progressbarContainer element and diff --git a/javascript/ui.js b/javascript/ui.js index 9fe884c0..c9df066d 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -163,7 +163,7 @@ function submit(){ rememberGallerySelection('txt2img_gallery') showSubmitButtons('txt2img', false) - var id = randomId("txt2img") + var id = randomId() requestProgress(id, gradioApp().getElementById('txt2img_gallery_container'), gradioApp().getElementById('txt2img_gallery'), function(){ showSubmitButtons('txt2img', true) @@ -180,7 +180,7 @@ function submit_img2img(){ rememberGallerySelection('img2img_gallery') showSubmitButtons('img2img', false) - var id = randomId("img2img") + var id = randomId() requestProgress(id, gradioApp().getElementById('img2img_gallery_container'), gradioApp().getElementById('img2img_gallery'), function(){ showSubmitButtons('img2img', true) }) @@ -367,12 +367,6 @@ function restoreProgress (task_tag) { if (task_tag) { let successHandler = ({ current_task }) => { if (current_task) { - let _task_tag = ["txt2img", "img2img"].find(t => current_task.startsWith(`task(${t}_`) && current_task.endsWith(")")) - if (!_task_tag) { - console.warn(`task tag ${current_task} not implemented yet`) - return - } - if (task_tag != _task_tag) return showSubmitButtons(task_tag, false) requestProgress(current_task, gradioApp().getElementById(`${task_tag}_gallery_container`), gradioApp().getElementById(`${task_tag}_gallery`), function(){ showSubmitButtons(task_tag, true) diff --git a/modules/progress.py b/modules/progress.py index 1947c0fd..e99267f5 100644 --- a/modules/progress.py +++ b/modules/progress.py @@ -49,8 +49,8 @@ def set_last_task_result(id_job, result): last_task_result = result
-def restore_progress_call(task_tag):
- if current_task is None or not current_task[5:-1].startswith(task_tag):
+def restore_progress_call():
+ if current_task is None:
# image, generation_info, html_info, html_log
return tuple(list([None, None, None, None]))
|