[Bugfix] Return HTTP 400 instead of 501 for unknown chat roles in DeepSeek encoders (#53071)

Signed-off-by: JC-ut0 <809602657@qq.com>
This commit is contained in:
JC-ut0
2026-08-20 09:23:41 +00:00
committed by GitHub
parent c8de519917
commit 38e9cefdef
4 changed files with 29 additions and 2 deletions
+1 -1
View File
@@ -353,7 +353,7 @@ def render_message(
tool_calls=tc_content,
)
else:
raise NotImplementedError(f"Unknown role: {role}")
raise ValueError(f"Invalid role: {role}")
# Append transition tokens based on what follows
if index + 1 < len(messages) and messages[index + 1].get("role") not in ["assistant", "latest_reminder"]: