From b2e682e2635db9a801cd54969e6713410c784fad Mon Sep 17 00:00:00 2001 From: Peter De-Ath Date: Mon, 26 Aug 2024 21:25:57 +0100 Subject: [PATCH] fix: stop system prompt being duplicated --- backend/utils/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/utils/misc.py b/backend/utils/misc.py index 2eed58f41..df35732c0 100644 --- a/backend/utils/misc.py +++ b/backend/utils/misc.py @@ -82,7 +82,7 @@ def add_or_update_system_message(content: str, messages: list[dict]): """ 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: # Insert at the beginning messages.insert(0, {"role": "system", "content": content})