send real id if conversation_id is 'new'

This commit is contained in:
Charlotte Som 2025-02-26 08:52:43 +00:00
parent b0b5facced
commit b8f7ce6ad7
2 changed files with 6 additions and 1 deletions

View file

@ -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(<article className="user">{message.u}</article>);
} else if ("f" in message) {
chatlog.append(<article className="assistant">{message.f}</article>);

View file

@ -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