mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
refac
This commit is contained in:
parent
015772ef9a
commit
c689356b31
@ -53,7 +53,7 @@ from config import (
|
||||
UPLOAD_DIR,
|
||||
AppConfig,
|
||||
)
|
||||
from utils.misc import calculate_sha256
|
||||
from utils.misc import calculate_sha256, add_or_update_system_message
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(SRC_LOG_LEVELS["OLLAMA"])
|
||||
@ -834,17 +834,8 @@ async def generate_chat_completion(
|
||||
)
|
||||
|
||||
if payload.get("messages"):
|
||||
for message in payload["messages"]:
|
||||
if message.get("role") == "system":
|
||||
message["content"] = system + message["content"]
|
||||
break
|
||||
else:
|
||||
payload["messages"].insert(
|
||||
0,
|
||||
{
|
||||
"role": "system",
|
||||
"content": system,
|
||||
},
|
||||
payload["messages"] = add_or_update_system_message(
|
||||
system, payload["messages"]
|
||||
)
|
||||
|
||||
if url_idx == None:
|
||||
|
@ -941,7 +941,7 @@
|
||||
|
||||
chat_id: $chatId
|
||||
},
|
||||
`${OPENAI_API_BASE_URL}`
|
||||
`${WEBUI_BASE_URL}/api`
|
||||
);
|
||||
|
||||
// Wait until history/message have been updated
|
||||
|
Loading…
Reference in New Issue
Block a user