mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 02:15:22 -04:00
Empty reasoning_content chunks cause multiple <think> blocks / repeated Thoughts entries in chat UI
#70
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @utsumi-fj on GitHub (Jan 8, 2026).
Description
When an LLM response stream includes a chunk with an empty
reasoning_content, the Dify chat UI ends up rendering multiple<think>blocks. As a result, multipleThoughts (x.x s)entries are displayed.Screenshots:
Environment
openai/gpt-oss-20b(served via vLLM)Details
When sending a streaming request directly to the LiteLLM endpoint, the stream may include a chunk with an empty
reasoning_content:It looks like the Dify Plugin SDK closes the current
<think>block when it encounters a chunk like the following:However, an empty
reasoning_contentchunk does not indicate the end of reasoning. Treating it as a boundary causes the SDK/UI to start a new<think>block for subsequent reasoning tokens, which results in multipleThoughts (x.x s)entries.Expected behavior
reasoning_content(e.g."delta":{"reasoning_content":""}) should not close the current<think>block.<think>block should be closed only whenreasoning_contentis absent or null.