Spaces:
Sleeping
Sleeping
修复最后一个完成的线程不更新状态的问题
Browse files
crazy_functions/crazy_utils.py
CHANGED
@@ -259,9 +259,6 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
|
|
259 |
time.sleep(refresh_interval)
|
260 |
cnt += 1
|
261 |
worker_done = [h.done() for h in futures]
|
262 |
-
if all(worker_done):
|
263 |
-
executor.shutdown()
|
264 |
-
break
|
265 |
# 更好的UI视觉效果
|
266 |
observe_win = []
|
267 |
# 每个线程都要“喂狗”(看门狗)
|
@@ -280,7 +277,10 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
|
|
280 |
# 在前端打印些好玩的东西
|
281 |
chatbot[-1] = [chatbot[-1][0], f'多线程操作已经开始,完成情况: \n\n{stat_str}' + ''.join(['.']*(cnt % 10+1))]
|
282 |
yield from update_ui(chatbot=chatbot, history=[]) # 刷新界面
|
283 |
-
|
|
|
|
|
|
|
284 |
# 异步任务结束
|
285 |
gpt_response_collection = []
|
286 |
for inputs_show_user, f in zip(inputs_show_user_array, futures):
|
|
|
259 |
time.sleep(refresh_interval)
|
260 |
cnt += 1
|
261 |
worker_done = [h.done() for h in futures]
|
|
|
|
|
|
|
262 |
# 更好的UI视觉效果
|
263 |
observe_win = []
|
264 |
# 每个线程都要“喂狗”(看门狗)
|
|
|
277 |
# 在前端打印些好玩的东西
|
278 |
chatbot[-1] = [chatbot[-1][0], f'多线程操作已经开始,完成情况: \n\n{stat_str}' + ''.join(['.']*(cnt % 10+1))]
|
279 |
yield from update_ui(chatbot=chatbot, history=[]) # 刷新界面
|
280 |
+
if all(worker_done):
|
281 |
+
executor.shutdown()
|
282 |
+
break
|
283 |
+
|
284 |
# 异步任务结束
|
285 |
gpt_response_collection = []
|
286 |
for inputs_show_user, f in zip(inputs_show_user_array, futures):
|