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 :/
This commit is contained in:
parent
09f649ebad
commit
77e7e0b0cf
1 changed files with 3 additions and 2 deletions
|
|
@ -59,11 +59,12 @@ async def connect_to_conversation(ws: WebSocket):
|
||||||
if conversation_id == "new":
|
if conversation_id == "new":
|
||||||
await ws.send_text(json({"i": conversation.id}))
|
await ws.send_text(json({"i": conversation.id}))
|
||||||
|
|
||||||
|
first = True
|
||||||
async for message in ws.iter_text():
|
async for message in ws.iter_text():
|
||||||
if system_prompt:
|
if first:
|
||||||
await ws.send_text(json({"sys": system_prompt}))
|
await ws.send_text(json({"sys": system_prompt}))
|
||||||
response = conversation.prompt(message, system=system_prompt, stream=True)
|
response = conversation.prompt(message, system=system_prompt, stream=True)
|
||||||
system_prompt = None
|
first = False
|
||||||
|
|
||||||
response_tid = tid_now()
|
response_tid = tid_now()
|
||||||
await ws.send_text(json({"u": message}))
|
await ws.send_text(json({"u": message}))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue