From 77e7e0b0cff2f99acc8d3d1337f9c09ebaca71aa Mon Sep 17 00:00:00 2001 From: Charlotte Som Date: Wed, 26 Mar 2025 20:55:58 +0000 Subject: [PATCH] dont clear the system prompt actually simonw plugins (e.g. llm-anthropic, llm-gemini) don't send the system prompt as a {role: system} message in build_messages, so the model will 'forget' its system intsructions if it's not retransmitted every time :/ --- server/inference.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/inference.py b/server/inference.py index 76792fe..08e775b 100644 --- a/server/inference.py +++ b/server/inference.py @@ -59,11 +59,12 @@ async def connect_to_conversation(ws: WebSocket): if conversation_id == "new": await ws.send_text(json({"i": conversation.id})) + first = True async for message in ws.iter_text(): - if system_prompt: + if first: await ws.send_text(json({"sys": system_prompt})) response = conversation.prompt(message, system=system_prompt, stream=True) - system_prompt = None + first = False response_tid = tid_now() await ws.send_text(json({"u": message}))