From b8f7ce6ad72cf86e96b5724eca83c66f6c1c5afb Mon Sep 17 00:00:00 2001 From: Charlotte Som Date: Wed, 26 Feb 2025 08:52:43 +0000 Subject: [PATCH] send real id if conversation_id is 'new' --- client/main.tsx | 4 +++- server/inference.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/main.tsx b/client/main.tsx index bb4263a..d813fef 100644 --- a/client/main.tsx +++ b/client/main.tsx @@ -49,7 +49,9 @@ function conversationUI(id: string) { const scrolledToBottom = chatlog.scrollTop + 16 >= chatlog.scrollHeight - chatlog.clientHeight; - if ("u" in message) { + if ("i" in message) { + window.history.replaceState(null, "", "#" + message.i); + } else if ("u" in message) { chatlog.append(
{message.u}
); } else if ("f" in message) { chatlog.append(
{message.f}
); diff --git a/server/inference.py b/server/inference.py index 46e75d9..332a2ba 100644 --- a/server/inference.py +++ b/server/inference.py @@ -42,6 +42,9 @@ async def connect_to_conversation(ws: WebSocket): await ws.send_text(json({"u": response.prompt.prompt})) # user await ws.send_text(json({"f": response.text_or_raise()})) # full + if conversation_id == "new": + await ws.send_text(json({"i": conversation.id})) + async for message in ws.iter_text(): response = conversation.prompt(message, system=system_prompt, stream=True) system_prompt = None