fix incomplete role handling for system and tool messages

This commit is contained in:
Shoubhit Dash 2025-10-28 00:03:32 +05:30
parent 550aa0e975
commit 817c319e38

View file

@ -69,7 +69,12 @@ def get_conversation_content(messages: List[ChatCompletionMessageParam]) -> str:
for message in messages:
role = message.get("role", "")
role_label = "User" if role == "user" else "Assistant"
role_label = {
"user": "User",
"assistant": "Assistant",
"system": "System",
"tool": "Tool"
}.get(role, "Unknown")
content = message.get("content")
if isinstance(content, str):