fix: stop replaying OpenAI stream text
Avoid replaying buffered text at the end of OpenAI streams so text-only responses are emitted once while forced tool fallback behavior stays intact. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -650,9 +650,7 @@ async def v1_chat_completions(req: ChatCompletionsRequest, request: Request):
|
||||
buffered_text_parts.clear()
|
||||
yield f"data: {json.dumps(payload, ensure_ascii=False)}\n\n"
|
||||
|
||||
if buffered_text_parts:
|
||||
for buffered_text in buffered_text_parts:
|
||||
yield _text_payload(buffered_text)
|
||||
if buffered_text_parts and forced_tool_name and saw_tool_call:
|
||||
buffered_text_parts.clear()
|
||||
|
||||
done_payload = {
|
||||
|
||||
Reference in New Issue
Block a user