mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 13:55:19 +00:00
Merge pull request #4924 from Peter-De-Ath/fix-duplicate-system-prompt
fix: stop system prompt being duplicated
This commit is contained in:
commit
7c841c9f63
1 changed files with 1 additions and 1 deletions
|
|
@ -82,7 +82,7 @@ def add_or_update_system_message(content: str, messages: list[dict]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if messages and messages[0].get("role") == "system":
|
if messages and messages[0].get("role") == "system":
|
||||||
messages[0]["content"] += f"{content}\n{messages[0]['content']}"
|
messages[0]["content"] = f"{content}\n{messages[0]['content']}"
|
||||||
else:
|
else:
|
||||||
# Insert at the beginning
|
# Insert at the beginning
|
||||||
messages.insert(0, {"role": "system", "content": content})
|
messages.insert(0, {"role": "system", "content": content})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue