mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[Deepseek]: _clean_messages drops ToolPromptMessage with empty content, causing message corruption #971
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 @Nov1c444 on GitHub (Feb 10, 2026).
Originally assigned to: @Nov1c444 on GitHub.
Self Checks
Dify version
1.12.0
Plugin version
0.0.10
Cloud or Self Hosted
Self Hosted (Source)
Description
When a tool call returns successfully but produces no output (empty string content), the _clean_messages method in DeepseekLargeLanguageModel incorrectly filters it out. This happens because the empty-content check (line 45) executes before the ToolPromptMessage protection logic (line 49).
The removal of a ToolPromptMessage has two cascading effects:
Reproduction: Use DeepSeek in an agent workflow where a tool call succeeds with no stdout (e.g. a Python script that writes a file but prints nothing). The subsequent messages get merged and the structured tool-call flow is destroyed.
Fix: Move the ToolPromptMessage / SystemPromptMessage guard before the empty-content filter so these message types are always preserved regardless of content.