Streaming mode not working as expected #679

Closed
opened 2026-02-21 17:28:00 -05:00 by yindo · 3 comments
Owner

Originally created by @AmoonPod on GitHub (Nov 9, 2023).

Dify version

0.3.29

Cloud or Self Hosted

Cloud

Steps to reproduce

Call Dify API with vanilla JS or something like Insomnia, setting
"response_mode": "streaming"

✔️ Expected Behavior

I was expecting the client to stream the response

Actual Behavior

I get the response only when the call is finished, as if the response mode was set to "blocking". The streaming response style is retrieved correctly with all its data "segments".

Originally created by @AmoonPod on GitHub (Nov 9, 2023). ### Dify version 0.3.29 ### Cloud or Self Hosted Cloud ### Steps to reproduce Call Dify API with vanilla JS or something like Insomnia, setting `"response_mode": "streaming"` ### ✔️ Expected Behavior I was expecting the client to stream the response ### ❌ Actual Behavior I get the response only when the call is finished, as if the response mode was set to "blocking". The streaming response style is retrieved correctly with all its data "segments".
yindo added the 🐞 bug label 2026-02-21 17:28:00 -05:00
yindo closed this issue 2026-02-21 17:28:00 -05:00
Author
Owner

@crazywoola commented on GitHub (Nov 10, 2023):

Can you provide the code you sent to the api?

curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer app-key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": {},
    "query": "hello",
    "response_mode": "streaming",
    "conversation_id": "",
    "user": "test console"
}'

Can reproduce this I think.

@crazywoola commented on GitHub (Nov 10, 2023): Can you provide the code you sent to the api? ```bash curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \ --header 'Authorization: Bearer app-key' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "hello", "response_mode": "streaming", "conversation_id": "", "user": "test console" }' ``` Can reproduce this I think.
Author
Owner

@AndryHTC commented on GitHub (Nov 10, 2023):

Can you provide the code you sent to the api?

curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer app-key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": {},
    "query": "hello",
    "response_mode": "streaming",
    "conversation_id": "",
    "user": "test console"
}'

Can reproduce this I think.

I've just tried it, as reported by @AmoonPod it acts like blocking (waits until the request is finished before retrieving the response) with "streaming" content style. I don't honestly understand why you set it as completed

@AndryHTC commented on GitHub (Nov 10, 2023): > Can you provide the code you sent to the api? > > ```shell > curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \ > --header 'Authorization: Bearer app-key' \ > --header 'Content-Type: application/json' \ > --data-raw '{ > "inputs": {}, > "query": "hello", > "response_mode": "streaming", > "conversation_id": "", > "user": "test console" > }' > ``` > > Can reproduce this I think. I've just tried it, as reported by @AmoonPod it acts like blocking (waits until the request is finished before retrieving the response) with "streaming" content style. I don't honestly understand why you set it as completed
Author
Owner

@AmoonPod commented on GitHub (Nov 10, 2023):

Can you provide the code you sent to the api?

curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer app-key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inputs": {},
    "query": "hello",
    "response_mode": "streaming",
    "conversation_id": "",
    "user": "test console"
}'

Can reproduce this I think.

Why you set this issue to completed?

I tried with your example, and it's still not working as a streaming. It takes 15 seconds to complete the call, and then retrieve me the response.

data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": "", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"}

data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": "Once", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"}

data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": " upon", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"}

data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": " a", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"}

I get these responses and many more...

This is what I send to the API:

{
    "inputs": {},
    "query": "hello tell me a story",
    "response_mode": "streaming",
    "conversation_id": "",
    "user": "test console"
}
@AmoonPod commented on GitHub (Nov 10, 2023): > Can you provide the code you sent to the api? > > ```shell > curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \ > --header 'Authorization: Bearer app-key' \ > --header 'Content-Type: application/json' \ > --data-raw '{ > "inputs": {}, > "query": "hello", > "response_mode": "streaming", > "conversation_id": "", > "user": "test console" > }' > ``` > > Can reproduce this I think. Why you set this issue to completed? I tried with your example, and it's still not working as a streaming. It takes 15 seconds to complete the call, and then retrieve me the response. ``` data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": "", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"} data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": "Once", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"} data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": " upon", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"} data: {"event": "message", "task_id": "04ffdd51-3ed9-4b15-b4a6-63e3d57c3d43", "id": "533d9f7a-5ef2-4c3c-8dc1-6c2862e8dd04", "answer": " a", "created_at": 1699614853, "conversation_id": "6bee3ba8-4daa-4681-81c9-6b9181988def"} ``` I get these responses and many more... This is what I send to the API: ``` { "inputs": {}, "query": "hello tell me a story", "response_mode": "streaming", "conversation_id": "", "user": "test console" } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#679