send real id if conversation_id is 'new'
This commit is contained in:
parent
b0b5facced
commit
b8f7ce6ad7
2 changed files with 6 additions and 1 deletions
|
@ -49,7 +49,9 @@ function conversationUI(id: string) {
|
||||||
const scrolledToBottom =
|
const scrolledToBottom =
|
||||||
chatlog.scrollTop + 16 >= chatlog.scrollHeight - chatlog.clientHeight;
|
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>);
|
chatlog.append(<article className="user">{message.u}</article>);
|
||||||
} else if ("f" in message) {
|
} else if ("f" in message) {
|
||||||
chatlog.append(<article className="assistant">{message.f}</article>);
|
chatlog.append(<article className="assistant">{message.f}</article>);
|
||||||
|
|
|
@ -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({"u": response.prompt.prompt})) # user
|
||||||
await ws.send_text(json({"f": response.text_or_raise()})) # full
|
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():
|
async for message in ws.iter_text():
|
||||||
response = conversation.prompt(message, system=system_prompt, stream=True)
|
response = conversation.prompt(message, system=system_prompt, stream=True)
|
||||||
system_prompt = None
|
system_prompt = None
|
||||||
|
|
Loading…
Reference in a new issue