support baidu/ERNIE-4.5-21B-A3B-Thinking ENDTHINKFLAG #662

Closed
opened 2026-02-16 10:20:06 -05:00 by yindo · 2 comments
Owner

Originally created by @medisean on GitHub (Sep 21, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.8.1

Cloud or Self Hosted

Cloud

Steps to reproduce

not support model on huggingface: baidu:ERNIE-4.5-21B-A3B-Thinking

Demo:

input: 你好

output:

用户现在发来了“你好”,我需要回应他。首先,用户可能是在打招呼,我需要友好地回应,同时保持亲切。用户可能是任何场景,比如日常聊天、寻求帮助或者只是想闲聊。所以回应要温暖,鼓励用户继续交流。

首先,我应该用同样的礼貌方式回应,比如“你好呀~有什么需要帮忙的,或者想聊的,我都在这儿哦~”这样既回应了问候,又表达了愿意陪伴的态度。同时保持语气亲切,让用户感到被重视。

另外,用户可能希望得到进一步的互动,所以需要保持开放,邀请用户分享更多。这样用户会更愿意继续交流。需要避免过于正式,保持自然,符合日常对话的风格。

总结来说,回应需要友好、温暖,鼓励用户继续沟通。所以合适的回答应该是“你好呀~今天有什么特别的事情想聊吗?或者有什么需要我帮忙的,尽管说~”这样既回应了问候,又提供了帮助的意愿,符合用户可能的需求。
[ENDTHINKFLAG]

你好呀~今天有什么想分享的,或者需要帮忙的,随时告诉我哦~🌹

problem:

before ENDTHINKFLAG content not fold

✔️ Expected Behavior

before ENDTHINKFLAG content can fold

Actual Behavior

before ENDTHINKFLAG content not fold

Originally created by @medisean on GitHub (Sep 21, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.8.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce not support model on huggingface: baidu:ERNIE-4.5-21B-A3B-Thinking Demo: input: 你好 output: 用户现在发来了“你好”,我需要回应他。首先,用户可能是在打招呼,我需要友好地回应,同时保持亲切。用户可能是任何场景,比如日常聊天、寻求帮助或者只是想闲聊。所以回应要温暖,鼓励用户继续交流。 首先,我应该用同样的礼貌方式回应,比如“你好呀~有什么需要帮忙的,或者想聊的,我都在这儿哦~”这样既回应了问候,又表达了愿意陪伴的态度。同时保持语气亲切,让用户感到被重视。 另外,用户可能希望得到进一步的互动,所以需要保持开放,邀请用户分享更多。这样用户会更愿意继续交流。需要避免过于正式,保持自然,符合日常对话的风格。 总结来说,回应需要友好、温暖,鼓励用户继续沟通。所以合适的回答应该是“你好呀~今天有什么特别的事情想聊吗?或者有什么需要我帮忙的,尽管说~”这样既回应了问候,又提供了帮助的意愿,符合用户可能的需求。 [ENDTHINKFLAG] 你好呀~今天有什么想分享的,或者需要帮忙的,随时告诉我哦~🌹 problem: before ENDTHINKFLAG content not fold ### ✔️ Expected Behavior before ENDTHINKFLAG content can fold ### ❌ Actual Behavior before ENDTHINKFLAG content not fold
yindo added the bug label 2026-02-16 10:20:06 -05:00
yindo closed this issue 2026-02-16 10:20:06 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 21, 2025):

Dify's folding (collapsing) behavior for model output is currently implemented for <think> tags in the frontend, using the preprocessThinkTag function and a custom ThinkBlock component that renders collapsible sections via HTML <details> tags. There is no built-in support for folding content based on custom markers like ENDTHINKFLAG—the code does not recognize or process this marker for folding, so content before ENDTHINKFLAG will not be collapsed by default in the UI [source].

To achieve folding for sections before ENDTHINKFLAG, you would need to add custom logic to the frontend Markdown rendering component to detect this marker and wrap the relevant content in a collapsible block, similar to how <think> tags are handled. The backend does not perform any folding/collapsing for this marker; it's a frontend concern.

Recent updates have focused on reasoning format options for <think> tags, but there is no mention of support for ENDTHINKFLAG or the baidu/ERNIE-4.5-21B-A3B-Thinking model in the latest pull requests [source].

If you need folding for custom markers, consider extending the frontend logic to support it, using the existing <think> tag handling as a template.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 21, 2025): <!-- Answer --> Dify's folding (collapsing) behavior for model output is currently implemented for `<think>` tags in the frontend, using the `preprocessThinkTag` function and a custom `ThinkBlock` component that renders collapsible sections via HTML `<details>` tags. There is no built-in support for folding content based on custom markers like `ENDTHINKFLAG`—the code does not recognize or process this marker for folding, so content before `ENDTHINKFLAG` will not be collapsed by default in the UI [[source]](https://github.com/langgenius/dify/blob/8c38363038f39c818e30f4be55023598b8f42b65/web/app/components/base/markdown/index.tsx). To achieve folding for sections before `ENDTHINKFLAG`, you would need to add custom logic to the frontend Markdown rendering component to detect this marker and wrap the relevant content in a collapsible block, similar to how `<think>` tags are handled. The backend does not perform any folding/collapsing for this marker; it's a frontend concern. Recent updates have focused on reasoning format options for `<think>` tags, but there is no mention of support for `ENDTHINKFLAG` or the baidu/ERNIE-4.5-21B-A3B-Thinking model in the latest pull requests [[source]](https://github.com/langgenius/dify/pull/23313). If you need folding for custom markers, consider extending the frontend logic to support it, using the existing `<think>` tag handling as a template. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bdc4e17f-c135-4160-93c9-4e363c4efa41?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/26021)
Author
Owner

@dosubot[bot] commented on GitHub (Sep 21, 2025):

Dify's folding/collapsing feature in the chat UI is currently limited to recognized tags like <think> and <details>. Custom markers such as ENDTHINKFLAG are not supported for folding by default. The folding logic is implemented in the frontend (web/app/components/base/markdown.tsx) using regex and custom React components to wrap content between these tags in collapsible panels.

To support folding for ENDTHINKFLAG, the frontend code would need to be updated to recognize this marker and wrap the preceding content in a collapsible container, similar to how it handles <think> or <details> tags. This change is technically straightforward due to the plugin-based architecture of the markdown rendering logic.

There are no existing workarounds or configuration options for folding with custom markers, so code modification is required for this feature. If you need this urgently, you can consider preprocessing the model output to replace your custom marker with a supported tag like <details> as a temporary workaround.

For more details on how folding is handled and the relevant code location, see this discussion.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 21, 2025): <!-- Answer --> Dify's folding/collapsing feature in the chat UI is currently limited to recognized tags like `<think>` and `<details>`. Custom markers such as `ENDTHINKFLAG` are not supported for folding by default. The folding logic is implemented in the frontend (`web/app/components/base/markdown.tsx`) using regex and custom React components to wrap content between these tags in collapsible panels. To support folding for `ENDTHINKFLAG`, the frontend code would need to be updated to recognize this marker and wrap the preceding content in a collapsible container, similar to how it handles `<think>` or `<details>` tags. This change is technically straightforward due to the plugin-based architecture of the markdown rendering logic. There are no existing workarounds or configuration options for folding with custom markers, so code modification is required for this feature. If you need this urgently, you can consider preprocessing the model output to replace your custom marker with a supported tag like `<details>` as a temporary workaround. For more details on how folding is handled and the relevant code location, see [this discussion](https://github.com/langgenius/dify-official-plugins/issues/849). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e2ce18e9-921e-4eb1-9ac7-ec004b3ab878?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1746)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#662