Skip to content

fix(core): preserve multimodal content parts in DashScope tool result…#1213

Open
zhsnddn wants to merge 5 commits intoagentscope-ai:mainfrom
zhsnddn:fix/DashScope-Formatter
Open

fix(core): preserve multimodal content parts in DashScope tool result…#1213
zhsnddn wants to merge 5 commits intoagentscope-ai:mainfrom
zhsnddn:fix/DashScope-Formatter

Conversation

@zhsnddn
Copy link
Copy Markdown

@zhsnddn zhsnddn commented Apr 13, 2026

AgentScope-Java Version

1.0.12-SNAPSHOT

Description

fix issue#1153
Problem reproduction:
From the image, we can see that the current processing method converts all modalities into text format and then concatenates them. This causes an issue where image URLs cannot be extracted correctly from the same modality.
debug2

Comparison with the OpenAI approach:
In the OpenAI approach, a modality check is added before extraction. As shown in the image, different types can be separated, which makes it possible to extract image URLs.
debug1

Implementation and idea:
The implementation borrows from OpenAI’s approach by adding modality detection and separation before processing. Due to inconsistencies between the DTO formats and OpenAI, the final output is structured according to the DashScopeMessage DTO format.
image

debug3 Edge Cases Handled:

Due to structural adjustments, the input format of Tool result has been modified in DashScopeChatFormatterGroundTruthTest and DashScopeMultiAgentFormatterGroundTruthTest.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@zhsnddn zhsnddn requested a review from a team April 13, 2026 14:01
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 13, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 64.86486% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...formatter/dashscope/DashScopeMessageConverter.java 64.86% 10 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 工具返回多模态时Formatter不符合预期

2 participants