This commit is contained in:
hailin 2025-07-27 18:53:06 +08:00
parent f904c754e2
commit 095311d016
1 changed files with 5 additions and 1 deletions

View File

@ -121,8 +121,12 @@ def chat(
while True:
try:
result = result_q.get(timeout=0.1)
# ★ 不论 /generate纯 str还是 /v1/chat/completionsdict都转成 {"text": ...}
if isinstance(result, str):
result = {"text": result}
elif not isinstance(result, dict) or "text" not in result:
result = {"text": str(result)}
yield result, log_state
except Empty:
continue
@ -155,7 +159,7 @@ with gr.Blocks(title="调试界面") as demo:
additional_inputs=[max_new, temp, top_p, top_k,
rep_pen, pres_pen, stop_txt,
api_choice, log_state],
additional_outputs=[],
additional_outputs=[log_state],
type="messages"
)