-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic collaborative chat #58
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlqqq
Thanks for making these changes. The request/reply design looks great, left some comments about some redundant code.
One consideration to keep in mind is that the initial version relied on hydrating the chat history from the conversation memory. With the new changes, this is no longer the case, so for instance, if we decide to use persistent memory it will not align with the chat history in the UI as these two are handled separately now. Let me know if I missed anything, and that's not the case.
Yes, this is technically an instance of duplicate state. However, I would think of When you parallelize model execution, you may run into issues with this strategy regarding process safety; feel free to change it as much as you'd like. |
@dlqqq |
* add .jupyter_ystore.db to .gitignore * connect chat UI to use websockets handlers * remove old Chat REST API * remove console logs * do not use identity provider username for client ID * remove old messages property
* add .jupyter_ystore.db to .gitignore * connect chat UI to use websockets handlers * remove old Chat REST API * remove console logs * do not use identity provider username for client ID * remove old messages property
Description
Enables collaborative chat by migrating to the new Chat WebSockets API implemented in #40.
Correctly handles selection inclusion + replacement. 😁
Demo (collaborative: false)
Screen.Recording.2023-04-12.at.4.06.00.PM.mov
Demo (collaborative: true)
Screen.Recording.2023-04-12.at.4.18.50.PM.mov
Backend changes
ConnectionMessage
: sent after a WebSocket connection is opened, providing the client with their client IDHumanChatMessage
: broadcast by server after receiving aChatRequest
. this is now broadcast to all clients, so that the sending client can also verify that the server received the message.AgentChatMessage
: broadcast by server after agent responds to aHumanChatMessage
. Thereply_to
field stores the message ID of theHumanChatMessage
it is replying toFrontend changes
ChatHandler
class has a new interface:async initialize()
: must be awaited prior to usageasync send()
: send a message and return a Promise. The Promise resolves when server acknowledges receipt by broadcasting the message back.async replyFor(messageId: string)
: return a Promise that resolves when an agent replies to a message with IDmessageId
In summary, this adds an awaitable fetch-like API for sending chats and waiting for agent replies. This is extremely powerful, and allowed me to implement this while making minimal changes to the Chat components 😁
Next steps