Worker response not streaming

Hey, I am attempting to get an OpenAI assistant response stream from my cloudflare worker. It seems to be working in my http client. The data is received in chunks. However, using a basic html page is showing that the response is coming in one massive chunk. I am very frustrated and I would appreciate some guidance. Here is my code with only the relevant stuff: https://paste.ofcode.org/wq6cTB2cYZE2GTstWH4uc8. When I receive content, the console is correctly filled with the openai response. The chunks in Insomnia (my http client) match this. However, my stream implementation is quite sketchy. Am I doing it correctly? Thanks.
1 Reply
Codename_A
Codename_AOP3w ago
The response appears incrementally when using the following command.
curl --no-buffer -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-d '{
"username": "demo",
"password": "demo",
"userThread": [{"role": "user", "content": "What are you?"}]
}'
curl --no-buffer -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-d '{
"username": "demo",
"password": "demo",
"userThread": [{"role": "user", "content": "What are you?"}]
}'
Want results from more Discord servers?
Add your server