mirror of
https://github.com/open-webui/open-webui
synced 2024-11-27 06:20:01 +00:00
fix
This commit is contained in:
parent
cac27b2730
commit
bedcb6cce8
@ -566,16 +566,13 @@ async def handle_streaming_response(request: Request, response: Response,
|
|||||||
|
|
||||||
async def handle_nonstreaming_response(request: Request, response: Response,
|
async def handle_nonstreaming_response(request: Request, response: Response,
|
||||||
tools: dict, user: UserModel, data_items: list) -> JSONResponse:
|
tools: dict, user: UserModel, data_items: list) -> JSONResponse:
|
||||||
# It only should be one response ince we are in the non streaming scenario
|
# It only should be one response since we are in the non streaming scenario
|
||||||
async for data in response.body_iterator:
|
async for data in response.body_iterator:
|
||||||
content = data
|
content = data
|
||||||
citations = []
|
citations = []
|
||||||
response_dict = json.loads(content)
|
response_dict = json.loads(content)
|
||||||
body = json.loads(request._body)
|
body = json.loads(request._body)
|
||||||
|
|
||||||
content_type = response.headers["Content-Type"]
|
|
||||||
is_openai = "text/event-stream" in content_type
|
|
||||||
is_ollama = "application/x-ndjson" in content_type
|
|
||||||
|
|
||||||
while response_dict["choices"][0]["finish_reason"] == "tool_calls":
|
while response_dict["choices"][0]["finish_reason"] == "tool_calls":
|
||||||
body["messages"].append(response_dict["choices"][0]["message"])
|
body["messages"].append(response_dict["choices"][0]["message"])
|
||||||
|
Loading…
Reference in New Issue
Block a user