[BUG] Directly Reply miss out some words or detials #13215

Closed
opened 2026-02-21 19:11:06 -05:00 by yindo · 4 comments
Owner

Originally created by @jason-lee-x on GitHub (Apr 22, 2025).

Self Checks

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

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I was doing this for ECharts display.

I found an issues,maybe a defects or bugs.

When markdown‘s tag on then same line with data,it cannot rendering ECharts.

eg:

echarts { "title": { "text": "库存数量最多的十个供应商", "left": "center" }, "tooltip": { "trigger": "item" }, "series": [ { "name": "库存数量", "type": "pie", "radius": "50%", "data": [ {"value": 130412, "name": "测试供应商"}, {"value": 51920, "name": "n测试供应商"}, {"value": 1466, "name": "广州宏闽电子商务有限公司"}, {"value": 1225, "name": "Future Smart HK Limited"}, {"value": 990, "name": "荣耀"}, {"value": 206, "name": "tang开发-测试供应商"}, {"value": 200, "name": "供应商测试客户"}, {"value": 20, "name": "测试供应商1"}, {"value": 17, "name": "盖亚"}, {"value": 16, "name": "大亚丰测试"} ], "emphasis": { "itemStyle": { "shadowBlur": 10, "shadowOffsetX": 0, "shadowColor": "rgba(0, 0, 0, 0.5)" } } } ] }

Image

So I try use Template Transform,to mannully add the tag (Cuz AI doesn't work well)

As you can see,the data down here,I added a \n ,But I using the node Directly Reply it will magiclly disappeared.

That cause the prob that the charts could been rendering well.

{
  "answer": "<div><b style=\"font-style: italic; color: gray; font-size: 12px;\">正在为您查询数据,请稍后~</b></div>\n``` echarts\n\n\n{\n  \"title\": {\n    \"text\": \"库存数量最多的十个供应商\",\n    \"left\": \"center\"\n  },\n  \"tooltip\": {\n    \"trigger\": \"item\"\n  },\n  \"series\": [\n    {\n      \"name\": \"库存数量\",\n      \"type\": \"pie\",\n      \"radius\": \"50%\",\n      \"data\": [\n        { \"value\": 130412, \"name\": \"测试供应商\" },\n        { \"value\": 51920, \"name\": \"n测试供应商\" },\n        { \"value\": 1466, \"name\": \"广州宏闽电子商务有限公司\" },\n        { \"value\": 1225, \"name\": \"Future Smart HK Limited\" },\n        { \"value\": 990, \"name\": \"荣耀\" },\n        { \"value\": 206, \"name\": \"tang开发-测试供应商\" },\n        { \"value\": 200, \"name\": \"供应商测试客户\" },\n        { \"value\": 20, \"name\": \"测试���应商1\" },\n        { \"value\": 17, \"name\": \"盖亚\" },\n        { \"value\": 16, \"name\": \"大亚丰测试\" }\n      ],\n      \"emphasis\": {\n        \"itemStyle\": {\n          \"shadowBlur\": 10,\n          \"shadowOffsetX\": 0,\n          \"shadowColor\": \"rgba(0, 0, 0, 0.5)\"\n        }\n      }\n    }\n  ]\n}\n\n\n```"
}

Image

✔️ Expected Behavior

Just output what I set.

Actual Behavior

Miss out the end of the markdown tag ```

Originally created by @jason-lee-x on GitHub (Apr 22, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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 submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I was doing this for ECharts display. I found an issues,maybe a defects or bugs. When markdown‘s tag on then same line with data,it cannot rendering ECharts. eg: ``` echarts { "title": { "text": "库存数量最多的十个供应商", "left": "center" }, "tooltip": { "trigger": "item" }, "series": [ { "name": "库存数量", "type": "pie", "radius": "50%", "data": [ {"value": 130412, "name": "测试供应商"}, {"value": 51920, "name": "n测试供应商"}, {"value": 1466, "name": "广州宏闽电子商务有限公司"}, {"value": 1225, "name": "Future Smart HK Limited"}, {"value": 990, "name": "荣耀"}, {"value": 206, "name": "tang开发-测试供应商"}, {"value": 200, "name": "供应商测试客户"}, {"value": 20, "name": "测试供应商1"}, {"value": 17, "name": "盖亚"}, {"value": 16, "name": "大亚丰测试"} ], "emphasis": { "itemStyle": { "shadowBlur": 10, "shadowOffsetX": 0, "shadowColor": "rgba(0, 0, 0, 0.5)" } } } ] } ``` ![Image](https://github.com/user-attachments/assets/33e7b96a-c9fc-4ac8-8de7-3e6552898e21) So I try use Template Transform,to mannully add the tag (Cuz AI doesn't work well) As you can see,the data down here,I added a ``` \n ``` ,But I using the node Directly Reply it will magiclly disappeared. That cause the prob that the charts could been rendering well. ``` json { "answer": "<div><b style=\"font-style: italic; color: gray; font-size: 12px;\">正在为您查询数据,请稍后~</b></div>\n``` echarts\n\n\n{\n \"title\": {\n \"text\": \"库存数量最多的十个供应商\",\n \"left\": \"center\"\n },\n \"tooltip\": {\n \"trigger\": \"item\"\n },\n \"series\": [\n {\n \"name\": \"库存数量\",\n \"type\": \"pie\",\n \"radius\": \"50%\",\n \"data\": [\n { \"value\": 130412, \"name\": \"测试供应商\" },\n { \"value\": 51920, \"name\": \"n测试供应商\" },\n { \"value\": 1466, \"name\": \"广州宏闽电子商务有限公司\" },\n { \"value\": 1225, \"name\": \"Future Smart HK Limited\" },\n { \"value\": 990, \"name\": \"荣耀\" },\n { \"value\": 206, \"name\": \"tang开发-测试供应商\" },\n { \"value\": 200, \"name\": \"供应商测试客户\" },\n { \"value\": 20, \"name\": \"测试���应商1\" },\n { \"value\": 17, \"name\": \"盖亚\" },\n { \"value\": 16, \"name\": \"大亚丰测试\" }\n ],\n \"emphasis\": {\n \"itemStyle\": {\n \"shadowBlur\": 10,\n \"shadowOffsetX\": 0,\n \"shadowColor\": \"rgba(0, 0, 0, 0.5)\"\n }\n }\n }\n ]\n}\n\n\n```" } ``` ![Image](https://github.com/user-attachments/assets/f7c77237-7bf2-41ea-947b-f255d78ee32f) ### ✔️ Expected Behavior Just output what I set. ### ❌ Actual Behavior Miss out the end of the markdown tag ```
yindo added the 🐞 bug label 2026-02-21 19:11:06 -05:00
yindo closed this issue 2026-02-21 19:11:06 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 22, 2025):

I found a similar unsolved discussion regarding JSON parsing issues that lead to ECharts rendering errors [1]. Additionally, there was a closed issue related to markdown format output, which was resolved by a pull request addressing long table scroll issues in workflows [2].

For your specific issue, it seems that the problem might be related to how newline characters are handled in markdown or JSON data. This can affect the rendering of ECharts when markdown tags are on the same line as data. You might want to check if the preprocessThinkTag function in web/app/components/base/markdown.tsx is involved, as it handles markdown rendering and might need adjustments to correctly process newline characters [3].

If the issue persists, consider reviewing the renderCodeContent logic in the same file, which deals with ECharts integration within markdown [4]. Adjusting how newline characters are managed in these functions might help resolve the rendering issue.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Apr 22, 2025): <!-- Answer --> I found a similar unsolved discussion regarding JSON parsing issues that lead to ECharts rendering errors <sup>[[1]](https://github.com/langgenius/dify/discussions/15943)</sup>. Additionally, there was a closed issue related to markdown format output, which was resolved by a pull request addressing long table scroll issues in workflows <sup>[[2]](https://github.com/langgenius/dify/issues/17343)</sup>. For your specific issue, it seems that the problem might be related to how newline characters are handled in markdown or JSON data. This can affect the rendering of ECharts when markdown tags are on the same line as data. You might want to check if the `preprocessThinkTag` function in `web/app/components/base/markdown.tsx` is involved, as it handles markdown rendering and might need adjustments to correctly process newline characters <sup>[[3]](https://github.com/langgenius/dify/issues/14594)</sup>. If the issue persists, consider reviewing the `renderCodeContent` logic in the same file, which deals with ECharts integration within markdown <sup>[[4]](https://github.com/langgenius/dify/blob/main/web/app/components/base/markdown.tsx)</sup>. Adjusting how newline characters are managed in these functions might help resolve the rendering issue. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/4abb94d4-6fb2-4a2b-b798-73e3b88e6ead?feedback_type=other)</sup>
Author
Owner

@jason-lee-x commented on GitHub (Apr 22, 2025):

@dosu

THX robot dude
I checked them all,but none of them are the same prob with me

@jason-lee-x commented on GitHub (Apr 22, 2025): @dosu THX robot dude I checked them all,but none of them are the same prob with me
Author
Owner

@dosubot[bot] commented on GitHub (Apr 22, 2025):

It seems like the issue might be related to how the markdown processor handles newline characters, especially when they are used within JSON data for ECharts. You could try explicitly adding newline characters in your JSON configuration using \\n instead of \n to see if that resolves the issue. Additionally, ensure that the markdown processor or any related functions are correctly interpreting these characters.

If the problem persists, consider checking the configuration settings for the markdown processor or any custom rendering logic that might be affecting how markdown tags and JSON data are processed. Adjusting these settings or logic might help in maintaining the integrity of your markdown tags and ensuring proper rendering of ECharts.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Apr 22, 2025): <!-- Answer --> It seems like the issue might be related to how the markdown processor handles newline characters, especially when they are used within JSON data for ECharts. You could try explicitly adding newline characters in your JSON configuration using `\\n` instead of `\n` to see if that resolves the issue. Additionally, ensure that the markdown processor or any related functions are correctly interpreting these characters. If the problem persists, consider checking the configuration settings for the markdown processor or any custom rendering logic that might be affecting how markdown tags and JSON data are processed. Adjusting these settings or logic might help in maintaining the integrity of your markdown tags and ensuring proper rendering of ECharts. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0666416f-642b-425b-a877-ae26e1b1376f?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (May 22, 2025):

Image

I have tested with the following content in linked PR, it seems working as expected.

{
  "answer": "<div><b style=\"font-style: italic; color: gray; font-size: 12px;\">正在为您查询数据,请稍后~</b></div>\n``` echarts\n\n\n{\n  \"title\": {\n    \"text\": \"库存数量最多的十个供应商\",\n    \"left\": \"center\"\n  },\n  \"tooltip\": {\n    \"trigger\": \"item\"\n  },\n  \"series\": [\n    {\n      \"name\": \"库存数量\",\n      \"type\": \"pie\",\n      \"radius\": \"50%\",\n      \"data\": [\n        { \"value\": 130412, \"name\": \"测试供应商\" },\n        { \"value\": 51920, \"name\": \"n测试供应商\" },\n        { \"value\": 1466, \"name\": \"广州宏闽电子商务有限公司\" },\n        { \"value\": 1225, \"name\": \"Future Smart HK Limited\" },\n        { \"value\": 990, \"name\": \"荣耀\" },\n        { \"value\": 206, \"name\": \"tang开发-测试供应商\" },\n        { \"value\": 200, \"name\": \"供应商测试客户\" },\n        { \"value\": 20, \"name\": \"测试供应商1\" },\n        { \"value\": 17, \"name\": \"盖亚\" },\n        { \"value\": 16, \"name\": \"大亚丰测试\" }\n      ],\n      \"emphasis\": {\n        \"itemStyle\": {\n          \"shadowBlur\": 10,\n          \"shadowOffsetX\": 0,\n          \"shadowColor\": \"rgba(0, 0, 0, 0.5)\"\n        }\n      }\n    }\n  ]\n}\n\n\n```"
}
@crazywoola commented on GitHub (May 22, 2025): <img width="926" alt="Image" src="https://github.com/user-attachments/assets/52ded6bd-9dac-4f3c-86d4-5eb3872d1262" /> I have tested with the following content in linked PR, it seems working as expected. ``` { "answer": "<div><b style=\"font-style: italic; color: gray; font-size: 12px;\">正在为您查询数据,请稍后~</b></div>\n``` echarts\n\n\n{\n \"title\": {\n \"text\": \"库存数量最多的十个供应商\",\n \"left\": \"center\"\n },\n \"tooltip\": {\n \"trigger\": \"item\"\n },\n \"series\": [\n {\n \"name\": \"库存数量\",\n \"type\": \"pie\",\n \"radius\": \"50%\",\n \"data\": [\n { \"value\": 130412, \"name\": \"测试供应商\" },\n { \"value\": 51920, \"name\": \"n测试供应商\" },\n { \"value\": 1466, \"name\": \"广州宏闽电子商务有限公司\" },\n { \"value\": 1225, \"name\": \"Future Smart HK Limited\" },\n { \"value\": 990, \"name\": \"荣耀\" },\n { \"value\": 206, \"name\": \"tang开发-测试供应商\" },\n { \"value\": 200, \"name\": \"供应商测试客户\" },\n { \"value\": 20, \"name\": \"测试供应商1\" },\n { \"value\": 17, \"name\": \"盖亚\" },\n { \"value\": 16, \"name\": \"大亚丰测试\" }\n ],\n \"emphasis\": {\n \"itemStyle\": {\n \"shadowBlur\": 10,\n \"shadowOffsetX\": 0,\n \"shadowColor\": \"rgba(0, 0, 0, 0.5)\"\n }\n }\n }\n ]\n}\n\n\n```" } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13215