[Bugfix][Frontend] Only echo the assistant turn in batched chat completions (#52529)
Signed-off-by: Kaif <kaifkohari10@gmail.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
This commit is contained in:
co-authored by
Cyrus Leung
parent
5b0e5b69ac
commit
7fbfca2670
@@ -291,7 +291,11 @@ class OpenAIServingChatBatch(OpenAIServingChat):
|
||||
if request.echo:
|
||||
conversation = all_conversations[prompt_idx]
|
||||
last_msg_content: str | list[dict[str, str]] = ""
|
||||
if conversation and "content" in conversation[-1]:
|
||||
if (
|
||||
conversation
|
||||
and "content" in conversation[-1]
|
||||
and conversation[-1].get("role") == role
|
||||
):
|
||||
last_msg_content = conversation[-1]["content"] or ""
|
||||
if isinstance(last_msg_content, list):
|
||||
last_msg_content = "\n".join(
|
||||
|
||||
Reference in New Issue
Block a user