fix(anthropic): remove non-standard 'data: [DONE]' from Anthropic streaming (#37510)

Signed-off-by: cdpath <cdpath@outlook.com>
This commit is contained in:
cdpath
2026-03-19 15:23:35 +08:00
committed by GitHub
parent d49f273144
commit 354cd580d5

View File

@@ -576,7 +576,6 @@ class AnthropicServingMessages(OpenAIServingChat):
exclude_unset=True, exclude_none=True
)
yield wrap_data_with_event(data, "message_stop")
yield "data: [DONE]\n\n"
else:
origin_chunk = ChatCompletionStreamResponse.model_validate_json(
data_str
@@ -773,7 +772,6 @@ class AnthropicServingMessages(OpenAIServingChat):
)
data = error_response.model_dump_json(exclude_unset=True)
yield wrap_data_with_event(data, "error")
yield "data: [DONE]\n\n"
except Exception as e:
logger.exception("Error in message stream converter.")
@@ -783,7 +781,6 @@ class AnthropicServingMessages(OpenAIServingChat):
)
data = error_response.model_dump_json(exclude_unset=True)
yield wrap_data_with_event(data, "error")
yield "data: [DONE]\n\n"
async def count_tokens(
self,