[gpt-oss] Fix harmony parser in streaming responses (#30205)

Signed-off-by: AlonKejzman <alonkeizman@gmail.com>
This commit is contained in:
AlonKejzman 2025-12-22 14:56:06 +02:00 committed by GitHub
parent 256a33ecb4
commit bd6d5a7475
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -811,6 +811,11 @@ class OpenAIServingChat(OpenAIServing):
delta_text += harmony_parser.last_content_delta or ""
cur_channel = harmony_parser.current_channel
cur_recipient = harmony_parser.current_recipient
# handle the case where several tokens where generated at once
# including the final token, leading to a delta in the text
# but the current channel to be empty (start state)
if not cur_channel and delta_text:
cur_channel = "final"
else:
delta_text = output.text