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,
|
UPLOAD_DIR,
|
||||||
AppConfig,
|
AppConfig,
|
||||||
)
|
)
|
||||||
from utils.misc import calculate_sha256
|
from utils.misc import calculate_sha256, add_or_update_system_message
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
log.setLevel(SRC_LOG_LEVELS["OLLAMA"])
|
log.setLevel(SRC_LOG_LEVELS["OLLAMA"])
|
||||||
@ -834,17 +834,8 @@ async def generate_chat_completion(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if payload.get("messages"):
|
if payload.get("messages"):
|
||||||
for message in payload["messages"]:
|
payload["messages"] = add_or_update_system_message(
|
||||||
if message.get("role") == "system":
|
system, payload["messages"]
|
||||||
message["content"] = system + message["content"]
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
payload["messages"].insert(
|
|
||||||
0,
|
|
||||||
{
|
|
||||||
"role": "system",
|
|
||||||
"content": system,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if url_idx == None:
|
if url_idx == None:
|
||||||
|
@ -941,7 +941,7 @@
|
|||||||
|
|
||||||
chat_id: $chatId
|
chat_id: $chatId
|
||||||
},
|
},
|
||||||
`${OPENAI_API_BASE_URL}`
|
`${WEBUI_BASE_URL}/api`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Wait until history/message have been updated
|
// Wait until history/message have been updated
|
||||||
|
Loading…
Reference in New Issue
Block a user