mirror of
https://github.com/open-webui/open-webui
synced 2024-11-28 15:05:07 +00:00
cleanup
This commit is contained in:
parent
589efcdc5f
commit
23f1bee7bd
@ -677,7 +677,8 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
if len(contexts) > 0:
|
if len(contexts) > 0:
|
||||||
context_string = "/n".join(contexts).strip()
|
context_string = "/n".join(contexts).strip()
|
||||||
prompt = get_last_user_message(body["messages"])
|
prompt = get_last_user_message(body["messages"])
|
||||||
|
if prompt is None:
|
||||||
|
raise Exception("No user message found")
|
||||||
# Workaround for Ollama 2.0+ system prompt issue
|
# Workaround for Ollama 2.0+ system prompt issue
|
||||||
# TODO: replace with add_or_update_system_message
|
# TODO: replace with add_or_update_system_message
|
||||||
if model["owned_by"] == "ollama":
|
if model["owned_by"] == "ollama":
|
||||||
@ -722,9 +723,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
|||||||
self.ollama_stream_wrapper(response.body_iterator, data_items),
|
self.ollama_stream_wrapper(response.body_iterator, data_items),
|
||||||
)
|
)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
else:
|
|
||||||
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}
|
||||||
|
Loading…
Reference in New Issue
Block a user