This commit is contained in:
hailin 2025-08-01 09:36:07 +08:00
parent 26f8dc9ab5
commit 7c375562cd
1 changed files with 3 additions and 3 deletions

View File

@ -105,6 +105,9 @@ def chat(
): ):
from queue import Queue, Empty 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 # 构造 OpenAI 风格 messages仅用于 /v1/chat/completions
if api_suffix == "/v1/chat/completions": if api_suffix == "/v1/chat/completions":
messages = [] messages = []
@ -118,9 +121,6 @@ def chat(
else: else:
prompt_input = user # 原来的单轮文本 prompt 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 stop = [s.strip() for s in stop_raw.split(",") if s.strip()] or None
samp = { samp = {
("max_tokens" if api_suffix == "/v1/completions" else "max_new_tokens"): int(max_new), ("max_tokens" if api_suffix == "/v1/completions" else "max_new_tokens"): int(max_new),