This commit is contained in:
hailin 2025-08-01 10:32:10 +08:00
parent 0b2a49fe2c
commit 342727753a
1 changed files with 2 additions and 4 deletions

View File

@ -172,7 +172,7 @@ def chat(
# yield result, log_state # 第一次真正把模型回复丢给前端
if api_suffix == "/v1/chat/completions":
history.append({"role": "assistant", "content": result["text"]})
yield result["text"], history
yield history, log_state
else:
yield result["text"], log_state
@ -200,14 +200,12 @@ with gr.Blocks(title="调试界面") as demo:
dbg_chk = gr.Checkbox(label="📜 显示 Debug 面板", value=False)
log_box = gr.Textbox(label="实时日志", lines=20, interactive=False, visible=False)
chatbot_box = gr.Chatbot(label="Chat") # 添加这一行
chat = gr.ChatInterface(
fn=chat,
additional_inputs=[max_new, temp, top_p, top_k,
rep_pen, pres_pen, stop_txt,
api_choice, log_state],
additional_outputs=[chatbot_box, log_state],
additional_outputs=[log_state],
type="messages"
)