dify icon indicating copy to clipboard operation
dify copied to clipboard

i use dify api and set "response_mode": "streaming" but the EventStream show all the message at same time

Open cskeqing opened this issue 10 months ago • 2 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.13

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

✔️ Expected Behavior

I'd like to be able to return data on a regular basis, rather than at the end like a block 。Image

❌ Actual Behavior

The data is loaded for a long time and the return doesn't meet my expectations for SSE

cskeqing avatar Feb 13 '25 15:02 cskeqing

@cskeqing Hello there! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's tackle this together!

I found some similar discussions that might be relevant to your issue:

  1. How to implement streaming response when a Dify agent invokes a workflow? - This discussion is still open and might provide insights into implementing streaming responses.

  2. When publishing Api, ''/chat-messages'' api responds slowly with data in streaming mode - This is another open discussion that addresses slow responses in streaming mode.

  3. How to make the conversational application created using dify use streaming output? - This discussion is also open and focuses on using streaming output in conversational applications.

Additionally, there was a closed issue where the solution involved disabling proxy buffering in nginx to ensure the streaming response flows character by character as expected [1].

For your specific case, ensure that your server configuration, such as nginx, is set up to support streaming by disabling proxy buffering. This can help in achieving the expected behavior of returning data incrementally rather than all at once.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other | Bug Report

dosubot[bot] avatar Feb 13 '25 15:02 dosubot[bot]

Dify version 0.15.3

cskeqing avatar Feb 13 '25 15:02 cskeqing

@cskeqing which llm model are you using? as i know, some of the llm model stream with a param named incremental that controls the sse behavior.

droxer avatar Feb 14 '25 01:02 droxer

you must configure streaming_function_call to support If it is openai api compatible and chat model.

Image

jiandanfeng avatar Feb 14 '25 02:02 jiandanfeng

@cskeqing which llm model are you using? as i know, some of the llm model stream with a param named incremental that controls the sse behavior.

ok, thanks。

cskeqing avatar Feb 15 '25 13:02 cskeqing