Commit c689356b authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac

parent 015772ef
...@@ -53,7 +53,7 @@ from config import ( ...@@ -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,18 +834,9 @@ async def generate_chat_completion( ...@@ -834,18 +834,9 @@ 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:
if ":" not in payload["model"]: if ":" not in payload["model"]:
......
...@@ -941,7 +941,7 @@ ...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment