-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
Assume partial responses with websocket connection mode #112
Comments
Btw, I could help implementing / fixing this with some pointers from where to start! |
Hi @alexeyeryshev. There is a number of ways you can tackle this:
Could you change the code to avoid the chunking or build the complete text using
You can change the
Let me know if you need any further assistance. Thanks! |
Hey, @OvidijusParsiunas, thanks for your swift response!
I believe, conceptually, it should not matter from which protocol you get your events (SSE, websockets, sockets.io, ...), the deep-chat could treat them as complete or partial, allowing a stream-like experience. Thanks again for your guidance! |
Hi @alexeyeryshev. I thought about this a little further, and whilst there are a couple of workarounds to achieve streaming via websockets - I guess this can be a rather common use-case for some apps. In the light of this I have made a slight change to the API to facilitate it. You would first connect to the websocket API as normal, and additionally to let Deep Chat know that this is a stream - I have made a change to the Example:
In the example above - the stream for each message will end when the server sends I have also made a change to allow files in streams, so you will be able to respond with any content you need. All of these changes are available in Let me know if this works for you. Thanks! |
This has now been deployed in Deep Chat version |
Hey @OvidijusParsiunas, thank you for doing this; it looks very cool!
While playing with some examples, I noticed some unexpected behavior (issue?) with the websocket connection mode.
It doesn't look like websocket handler can assume "partial responses" as streaming mode does.
I have the following server code in FastAPI
and the following client
Example of messages that server is sending
When sending partial websocket messages, I would assume that they would simply add to the same message bubble, however every new message seems to be converted to a new one. Please see a demo below:
Screen.Recording.2024-02-03.at.22.32.36.mov
The text was updated successfully, but these errors were encountered: