From 953beb369c4e08bf8fd3b35e13e130f80b72d783 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sat, 31 Aug 2024 15:15:21 +0100 Subject: [PATCH] fix: return proxied response headers during chat completion --- backend/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index 4b91cdc84..7a4100fe2 100644 --- a/backend/main.py +++ b/backend/main.py @@ -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}