justinmahar/openai-ext

Streaming from backend to the client

gordicaleksa opened this issue · 2 comments

Hi, thanks a lot for writing this!

I'm curious (and not that experienced in building web apps esp. when it comes to streaming):
How does one send the data from the backend to the front instead of console logging as you're currently doing it in the handler?

Isn't that the main use case for streaming? I saw you are sharing the key on the front end - I assume it's just for playing around? :))

Hi, and you're welcome! Those implementation details are up to the developer depending on what they're trying to do.

This library only handles streaming from openai to node or the browser. You could use an EC2 server or cloud function to send the stream from server to client, but that's outside the scope of this library. If you do come up with a viable solution, I'd be happy to link to it from the README

My use case for building this was actually to develop my own chatgpt clone. Check out https://github.com/deiucanta/chatpad for an example, this library is used in that project.