diff --git a/meta_ui.py b/meta_ui.py index 2405165..23a7a75 100644 --- a/meta_ui.py +++ b/meta_ui.py @@ -105,6 +105,9 @@ def chat( ): from queue import Queue, Empty + # 解析传入的 ChatInput 格式 + user = user_msg["text"] if isinstance(user_msg, dict) and "text" in user_msg else user_msg + # 构造 OpenAI 风格 messages,仅用于 /v1/chat/completions if api_suffix == "/v1/chat/completions": messages = [] @@ -118,9 +121,6 @@ def chat( else: prompt_input = user # 原来的单轮文本 prompt - # 解析传入的 ChatInput 格式 - user = user_msg["text"] if isinstance(user_msg, dict) and "text" in user_msg else user_msg - stop = [s.strip() for s in stop_raw.split(",") if s.strip()] or None samp = { ("max_tokens" if api_suffix == "/v1/completions" else "max_new_tokens"): int(max_new),