Repository navigation
fix(agui): preserve URL media alongside reasoning - #4009
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
return splitReasoningMessage(msg, toSingleAguiMessage(msg)); |
|
Thanks for the suggestion. Addressed in bda01f0: Reran |
…nversation lifecycle (#3979) ## Description ### What changed 1. **`fix(core): preserve document references in text sinks`** — new `DocumentReferenceRenderer` renders a document as a one-line reference (name, MIME type, URL/provider file id, or an inline-size description that never leaks base64 or a local temp path). Memory flushing, compaction, subagent/task results, session exports, public events, telemetry redaction, control-plane and admin projections now keep that reference instead of losing the attachment. 2. **`fix(model): preserve documents across provider formatting`** — Ollama, OpenAI (and the GLM/DeepSeek/Kimi/MiniMax compat formatters), OpenAI Official Responses, and Gemini keep documents through formatting and merging; the text extractor contract is "text without document references", and each converter renders references where documents can appear, so an assistant-carried document yields exactly one reference line. Gemini maps accepted MIME types (aligned with the GenerateContent reference) to its native file data and degrades the rest. 3. **`feat(protocol): preserve documents through AG-UI and A2A`** — AG-UI gains a document content type with URL / inline-data / provider-file sources. Documents serialize on every role alongside the URL media support from #4003 and compose with the reasoning-plus-media split from #4009; only a source the protocol cannot express falls back to a text reference. A2A file parts parse back into `DocumentBlock`s with framework metadata markers taking precedence over user keys. 4. **`feat(dashscope): support document inputs and PPT skills`** — closes #3943: URL documents map to the native `doc_url` content part (count and streaming validation), file-id documents keep the `fileid://` channel, `file_parsing_strategy` is honored, and the PPT `skill` parameter (template and creative mode) streams outline/pages through thinking blocks with the download URL in the final text content and a typed `dashscope.skill` metadata marker. Multimodal example and zh/en docs included. 5. **`fix(core,protocol,model): degrade unsupported documents instead of failing`** — a document block stays in the conversation history, so a formatter that throws on a source it cannot deliver breaks every later turn of that session. DashScope now emits a text reference for Base64 payloads and file ids issued by another provider (AG-UI accepts both on input), references say `unnamed` instead of leaking the block's internal UUID, A2A leaves `FilePart.name` unset instead of shipping a UUID as the attachment name, and the A2A file parser validates the MIME type before a document marker can route around it. Co-authored-by: jujn <[email protected]>
AgentScope-Java Version
2.1.0-SNAPSHOT, based on main
dc077e7abfc4b2dd1062f2279dad48382256b819.Description
Fixes #4008.
An assistant message with a
ThinkingBlockand supported URL media, but no text/tool call, currently converts to just a reasoning message.toSingleAguiMessagecollects the media, then its old reasoning-only fast path returns before emitting it. This also loses media whentoAguiMessageListconverts a conversation.Build reasoning and standard content together in
buildAguiMessages, as suggested in review. Collect thinking, text, tool calls/results and media in one content traversal, then emit the reasoning message and any remaining content. The reasoning-only return requires the collected media list to be empty, so mixed messages retain their assistantMessageContent.Blocks. This removestoSingleAguiMessage,splitReasoningMessageand the separate thinking scan while retaining public entry points, message order and multiple-tool-result expansion. The change builds on outbound media support in #4003 and is separate from inbound document handling in #3392.The regression covers all supported URL media categories (image, audio, video, document, and image/document
DataBlockrouting), checking the serialized type, URL and MIME type plus distinct generated message IDs. A conversation-list case verifies media serialization and preservation of the following user message; a reasoning-only control still yields one reasoning message. EN/ZH protocol docs describe the mixed case.Validation
Windows, Java 17.0.15, Maven 3.9.12;
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8. All Maven commands ran from the repository root with-B -T1C.mvn -B -T1C -pl :agentscope-extensions-agui -am -Dtest=AguiReasoningMediaTest,AguiMessageConverterTest -Dsurefire.failIfNoSpecifiedTests=false test: 82 passed, zero failures/errors/skips.mvn -B -T1C -pl :agentscope-extensions-agui -am -DskipTests clean install: passed, building dependencies from this checkout; tests were skipped for this dependency build.mvn -B -T1C -pl :agentscope-extensions-agui clean verify: 563 passed, zero failures/errors/skips. Spotless, Javadoc and packaging passed.docs/:npm ci --ignore-scripts,npm test(13 passed) andnpm run validate: passed.npm run broken-linksreports 2,224 links in 328 files on both this change and pristine main; the ordered file/target lists are identical.git diff --check: passed. Upstream main was fetched again before submission and remained at the stated base.bda01f03: reranmvn -B -T1C -pl :agentscope-extensions-agui clean verifyafter consolidating the builder: 563 passed, zero failures/errors/skips; Spotless, Javadoc, packaging andgit diff --checkpassed. Existing regression assertions were unchanged. The original pre-refactor head passed both Ubuntu and Windows CI; the updated head must run CI again.This is an offline public-converter and JSON-serialization regression, not a live model, generated-media download or frontend integration test. It does not expand Base64 support or inbound assistant structured-content support. Full-repository tests were not run and no coverage percentage is claimed.
AI assistance was used for investigation, implementation, tests and diff review. The reported checks were executed locally.
Checklist
mvn testwas not run.