From 095311d016a04ff85551a1ec7b2fe0d30437fcf3 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 27 Jul 2025 18:53:06 +0800 Subject: [PATCH] . --- meta_ui.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta_ui.py b/meta_ui.py index 38754b8..fb51913 100644 --- a/meta_ui.py +++ b/meta_ui.py @@ -121,8 +121,12 @@ def chat( while True: try: result = result_q.get(timeout=0.1) + # ★ 不论 /generate(纯 str)还是 /v1/chat/completions(dict),都转成 {"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" )