remove more nesting
This commit is contained in:
1 parent
32874a816d
commit
ce7a1a73ac
1 file changed
+3
-3
+3
-3
@@ -680,7 +680,9 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
]
|
]
|
||||||
|
|
||||||
response = await call_next(request)
|
response = await call_next(request)
|
||||||
if isinstance(response, StreamingResponse):
|
if not isinstance(response, StreamingResponse):
|
||||||
|
return response
|
||||||
|
|
||||||
content_type = response.headers["Content-Type"]
|
content_type = response.headers["Content-Type"]
|
||||||
is_openai = "text/event-stream" in content_type
|
is_openai = "text/event-stream" in content_type
|
||||||
is_ollama = "application/x-ndjson" in content_type
|
is_ollama = "application/x-ndjson" in content_type
|
||||||
@@ -699,8 +701,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
|
|
||||||
return StreamingResponse(stream_wrapper(response.body_iterator, data_items))
|
return StreamingResponse(stream_wrapper(response.body_iterator, data_items))
|
||||||
|
|
||||||
return response
|
|
||||||
|
|
||||||
async def _receive(self, body: bytes):
|
async def _receive(self, body: bytes):
|
||||||
return {"type": "http.request", "body": body, "more_body": False}
|
return {"type": "http.request", "body": body, "more_body": False}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user