Merge pull request #5060 from cheahjs/fix/missing-chat-completion-response-headers

fix: return proxied response headers during chat completion
This commit is contained in:
Timothy Jaeryang Baek 2024-08-31 20:08:22 +02:00 committed by GitHub
commit a8c15e1b54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -628,7 +628,10 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
async for data in original_generator:
yield data
return StreamingResponse(stream_wrapper(response.body_iterator, data_items))
return StreamingResponse(
stream_wrapper(response.body_iterator, data_items),
headers=dict(response.headers),
)
async def _receive(self, body: bytes):
return {"type": "http.request", "body": body, "more_body": False}