skip sending previous context if we're continuing a connection

This commit is contained in:
Charlotte Som 2025-02-26 04:33:57 +00:00
parent deb2f6e8e5
commit 2e828600ea

View file

@ -14,6 +14,7 @@ async def list_conversations(request: Request):
girlypop_prompt = llm.cli.load_template("girlypop").system girlypop_prompt = llm.cli.load_template("girlypop").system
async def connect_to_conversation(ws: WebSocket): async def connect_to_conversation(ws: WebSocket):
continuing = bool(ws.query_params["continue"])
conversation_id = ws.path_params["conversation"] conversation_id = ws.path_params["conversation"]
if conversation_id == "new": if conversation_id == "new":
conversation = llm.AsyncConversation(llm.get_async_model()) conversation = llm.AsyncConversation(llm.get_async_model())
@ -31,6 +32,7 @@ async def connect_to_conversation(ws: WebSocket):
# only send the system prompt at the start of a conversation # only send the system prompt at the start of a conversation
system_prompt = girlypop_prompt system_prompt = girlypop_prompt
if not continuing:
for response in conversation.responses: for response in conversation.responses:
response: llm.AsyncResponse = response response: llm.AsyncResponse = response
if not response._done: continue if not response._done: continue