This commit is contained in:
Michael Poluektov 2024-08-10 12:11:41 +01:00
parent 589efcdc5f
commit 23f1bee7bd

View File

@ -677,7 +677,8 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
if len(contexts) > 0:
context_string = "/n".join(contexts).strip()
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
# TODO: replace with add_or_update_system_message
if model["owned_by"] == "ollama":
@ -723,8 +724,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
)
return response
else:
return response
async def _receive(self, body: bytes):
return {"type": "http.request", "body": body, "more_body": False}