From e6f292c14bf171f671934c34d72420a01ec56214 Mon Sep 17 00:00:00 2001 From: qingxu fu <505030475@qq.com> Date: Thu, 25 May 2023 01:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AE=8C=E6=88=90=E7=9A=84=E7=BA=BF=E7=A8=8B=E4=B8=8D?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/crazy_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crazy_functions/crazy_utils.py b/crazy_functions/crazy_utils.py index e54136c..de205d7 100644 --- a/crazy_functions/crazy_utils.py +++ b/crazy_functions/crazy_utils.py @@ -259,9 +259,6 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency( time.sleep(refresh_interval) cnt += 1 worker_done = [h.done() for h in futures] - if all(worker_done): - executor.shutdown() - break # 更好的UI视觉效果 observe_win = [] # 每个线程都要“喂狗”(看门狗) @@ -280,7 +277,10 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency( # 在前端打印些好玩的东西 chatbot[-1] = [chatbot[-1][0], f'多线程操作已经开始,完成情况: \n\n{stat_str}' + ''.join(['.']*(cnt % 10+1))] yield from update_ui(chatbot=chatbot, history=[]) # 刷新界面 - + if all(worker_done): + executor.shutdown() + break + # 异步任务结束 gpt_response_collection = [] for inputs_show_user, f in zip(inputs_show_user_array, futures):