[PR #27706] fix agent putout the output of workflow-tool twice (#26835) #31838

Closed
opened 2026-02-21 20:50:14 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/27706

State: closed
Merged: Yes


Refactor tool response handling to use lists for parts and JSON messages. Ensure proper concatenation and avoid duplication of messages.

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Previously, there would be repeated output text. Now, regardless of whether the tool's response is in plain text, pure JSON format, or text+JSON format, it can output as expected.

close #26835

I noticed a discussion and code improvement regarding this issue in # 27087. This code may serve as a reference for code improvement.

Screenshots

| Before | After |
|--------|
微信图片_20251031185112_337_32
|
| ... |
微信图片_20251031185205_338_32
|
| ... |
微信图片_20251031185421_339_32
|

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/27706 **State:** closed **Merged:** Yes --- Refactor tool response handling to use lists for parts and JSON messages. Ensure proper concatenation and avoid duplication of messages. > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary Previously, there would be repeated output text. Now, regardless of whether the tool's response is in plain text, pure JSON format, or text+JSON format, it can output as expected. close #26835 **I noticed a discussion and code improvement regarding this issue in # 27087. This code may serve as a reference for code improvement.** ## Screenshots | Before | After | |--------| <img width="849" height="264" alt="微信图片_20251031185112_337_32" src="https://github.com/user-attachments/assets/8680403e-8286-4171-975b-8997e4b84cc7" /> | | ... | <img width="864" height="201" alt="微信图片_20251031185205_338_32" src="https://github.com/user-attachments/assets/3f4b2472-17c0-4a93-9ead-88ae2a0f8ba2" /> | | ... | <img width="854" height="309" alt="微信图片_20251031185421_339_32" src="https://github.com/user-attachments/assets/4eb1684b-0ea0-4335-970f-31e8821886e5" /> | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:50:14 -05:00
yindo closed this issue 2026-02-21 20:50:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31838