The chat_messages api did not return the correct JSON object when object is ping. #1075

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

Originally created by @fogdragon on GitHub (Feb 21, 2024).

Self Checks

Dify version

0.5.6

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I provided the API to the application used dify, the application provided feedback on an object error message like this:
image
This error appears to be due to the application not correctly recognizing the returned "event: ping". application expects is a JSON object.
So I check related codes: generate_task_pipeline.py find this:
yield "event: ping\n\n"

✔️ Expected Behavior

suggested code:
response = {"event: ping\n\n"} yield self._yield_response(response)

Actual Behavior

image
Originally created by @fogdragon on GitHub (Feb 21, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Dify version 0.5.6 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I provided the API to the application used dify, the application provided feedback on an object error message like this: ![image](https://github.com/langgenius/dify/assets/5158337/9c587845-f197-4704-b5e0-5ead0b0cd117) This error appears to be due to the application not correctly recognizing the returned "event: ping". application expects is a JSON object. So I check related codes: generate_task_pipeline.py find this: yield "event: ping\n\n" ### ✔️ Expected Behavior suggested code: `response = {"event: ping\n\n"} yield self._yield_response(response)` ### ❌ Actual Behavior <img width="637" alt="image" src="https://github.com/langgenius/dify/assets/5158337/5a2aa0f2-afe2-4297-b1d0-b08fa2cdd081">
yindo added the 🐞 bug label 2026-02-21 17:29:51 -05:00
yindo closed this issue 2026-02-21 17:29:51 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 21, 2024):

🤖

It's great that you've identified the issue and even suggested a code change! Your proposed solution looks like a step in the right direction. I encourage you to go ahead and create a pull request with your proposed code changes. This will allow the maintainers to review your solution and consider merging it into the repository. Thank you for your contribution!

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Feb 21, 2024): _🤖_ <!-- Answer --> It's great that you've identified the issue and even suggested a code change! Your proposed solution looks like a step in the right direction. I encourage you to go ahead and create a pull request with your proposed code changes. This will allow the maintainers to review your solution and consider merging it into the repository. Thank you for your contribution! <!-- Dosu Comment Footer --> <details open> <summary> #### About Dosu </summary> This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. </details>
Author
Owner

@crazywoola commented on GitHub (Feb 21, 2024):

Please ignore this event in your program. This event ensures the connection is alive when responding.

@crazywoola commented on GitHub (Feb 21, 2024): Please ignore this event in your program. This event ensures the connection is alive when responding.
Author
Owner

@fogdragon commented on GitHub (Feb 21, 2024):

I know we can ignore this event.
But the application insists that I must modify it. They make this question difficult for me:"If you don't modify this issue, we won't go online."
So i had to change the code and mount this file into docker_api_1 to resolve it.
sad...

@fogdragon commented on GitHub (Feb 21, 2024): I know we can ignore this event. But the application insists that I must modify it. They make this question difficult for me:"If you don't modify this issue, we won't go online." So i had to change the code and mount this file into docker_api_1 to resolve it. sad...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1075