You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i make a openai streaming service in fetch in workers, but the response in web client will always be not-streaming response , it will always return response after openai’s request totally finished. how can i make it return in stream ?
exportconstfetchTest=async()=>{conststreamApiUrl='/xxx/query'constresponse=awaitfetch(streamApiUrl,{method: 'POST',headers: {'Content-Type': 'application/json',},body: JSON.stringify({content: 'who are you'})})constbodyReader=response.body.getReader()while(true){const{ value, done }=awaitbodyReader.read()// it won't return like stream , it will return all data once and for all after request finishedif(done)breakconsole.log(value)}}fetchTest()
here's my chrome devtools screenshot:
The text was updated successfully, but these errors were encountered:
i make a openai streaming service in fetch in workers, but the response in web client will always be not-streaming response , it will always return response after openai’s request totally finished. how can i make it return in stream ?
here’s my test code in workers:
and here’s my web client code:
here's my chrome devtools screenshot:
The text was updated successfully, but these errors were encountered: