mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 00:59:52 +00:00
remove more nesting
This commit is contained in:
parent
32874a816d
commit
ce7a1a73ac
@ -680,7 +680,9 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
||||
]
|
||||
|
||||
response = await call_next(request)
|
||||
if isinstance(response, StreamingResponse):
|
||||
if not isinstance(response, StreamingResponse):
|
||||
return response
|
||||
|
||||
content_type = response.headers["Content-Type"]
|
||||
is_openai = "text/event-stream" 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 response
|
||||
|
||||
async def _receive(self, body: bytes):
|
||||
return {"type": "http.request", "body": body, "more_body": False}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user