-
Notifications
You must be signed in to change notification settings - Fork 138
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
React is jumbling up a websocket stream of data #247
Comments
Can you give me an example of your top level application specifically how/where you are using
It looks to me like you are asking the bot the same question twice? Though it's also strange that in both of your examples, the "actual" rendered answer has typos/incorrect grammar... There's also a few things that stand out to me in your code:
While you created a shallow clone of your
My suggestions to debug this would be to start from the basics -- instead of going straight for a I'd also add a
This will allow you to see the order in which the messages are being passed in, without worrying about bugs that might be introduced when you add complexity like Also, instead of your
That callback is invoked directly from the websocket message callback, and so it's closer to the source than |
Hello, I'm seeking help on why data is being jumbled, missed, and dropped when rendering from a websocket. I want to try making a ai chatbot for fun and learn about how websockets and SSE work. I have been banging my head for a few hours now because data is not appearing at it should.
Example
I have a fast api and is streaming data from openai api and sending it to a website. i have confirmed with backend logs and with the firefox websocket network tab that the data is getting to the website in order and all intact.
For example:
Q: what is your favorite color?
Expected A: "I don't have personal preferences, but I can help you find information about colors or suggest color schemes if you need assistance with that!"
Rendered A: "I have preferences but I help you find about or color schemes you need with"
Q: Tell me a joke
Expected A: "Sure, here's a joke for you:\n\nWhy couldn't the bicycle stand up by itself?\n\nBecause it was two tired!"
Rendered A: "Sure's for couldn stand by it was"
Code
I'm just streaming data token by token from the open api chat in a
content
payload. then i tried to fix it by adding asummary
payload which sends the entire message once it's all done. But that is not helping.The text was updated successfully, but these errors were encountered: