This commit is contained in:
parent
9cb53f50f6
commit
0b24f7e814
|
|
@ -117,13 +117,15 @@ def chat(
|
|||
|
||||
# threading.Thread(target=worker).start()
|
||||
thread = threading.Thread(target=worker, daemon=True)
|
||||
thread.start()
|
||||
yield "⏳ 正在生成中...", log_state
|
||||
|
||||
|
||||
while True:
|
||||
# ⚠️ 线程已结束且队列已空 → 直接 return 让生成器终止
|
||||
if not thread.is_alive() and result_q.empty():
|
||||
return # ← 新增这一行
|
||||
break
|
||||
# return # ← 新增这一行
|
||||
|
||||
try:
|
||||
result = result_q.get(timeout=0.1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue