Skip to content

fix(formatter): preserve multimodal DataBlock handling#1815

Open
guslegend0510 wants to merge 8 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1782-multimodal
Open

fix(formatter): preserve multimodal DataBlock handling#1815
guslegend0510 wants to merge 8 commits into
agentscope-ai:mainfrom
guslegend0510:fix/issue-1782-multimodal

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.0-SNAPSHOT

Description

Background

In the multimodal message pipeline, DataBlock(image/png) could be normalized incorrectly and end up being treated as plain text, which breaks legacy media block handling for providers.

Changes

  • Added unified media normalization in MediaUtils.
  • Updated formatter/converter logic for OpenAI, Anthropic, DashScope, Gemini, and Ollama to preserve multimodal DataBlock handling.
  • Adjusted base formatter media detection to use the unified media kind logic.
  • Added/updated regression tests for media normalization and Ollama/DashScope formatter paths.

Testing

  • mvn -pl agentscope-core -Dtest=OllamaMessageConverterTest,OllamaChatFormatterTest,OllamaConversationMergerTest,OllamaMultiAgentFormatterTest test

Related Issues

Checklist

  • 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

@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/core/model Model providers and formatters labels Jun 18, 2026

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

@chickenlj

Copy link
Copy Markdown
Collaborator

Please check the CI failures.

@guslegend0510

Copy link
Copy Markdown
Contributor Author

@chickenlj CI 已经通过了,麻烦审核一下,谢谢您

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

Labels

area/core/model Model providers and formatters bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Multimodal messages are not recognized by the model

4 participants