BaseMediaBlockParser
public abstract class BaseMediaBlockParser<T extends ContentBlock> implements ContentBlockParser<T>
io/agentscope/core/a2a/agent/message/BaseMediaBlockParser.java:56–114基类 Media 块解析器,支持智能体之间的发现、委派与协作。位于 io.agentscope.core.a2a.agent.message 包,实现 ContentBlockParser<T>。核心成员包括 getMediaType、parseSource、log。
Abstract base parser for media content blocks to FilePart.
Provides common functionality for parsing Source to FileContent with type:
-
Convert
Base64SourcetoFileWithBytes -
Convert
URLSourcetoFileWithUri
Due to all FileContent should include FileContent#mimeType(),
but Source only Base64Source has Base64Source#getMediaType(),
So For URLSource we need to parse URLSource#getUrl() to get FileContent#mimeType().
Source doesn't define name field, so we need to generate a random
name set to FileContent#name(). Current use UUID to generate a random name.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
logfinal | Logger | 日志字段。 The log field. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
protected abstract String getMediaType()abstract | 获取 `getMediaType`。 Get the media type for the content block. |
protected Part<?> parseSource(Source source) | 解析来源。 Parse the source from content block to a FilePart. |
字段详情Field Detail
log
protected final Logger log
日志字段。声明为 protected final Logger log。
The log field.
io/agentscope/core/a2a/agent/message/BaseMediaBlockParser.java:59方法详情Method Detail
getMediaType
protected abstract String getMediaType()
获取 getMediaType。
Get the media type for the content block.
Stringio/agentscope/core/a2a/agent/message/BaseMediaBlockParser.java:66parseSource
protected Part<?> parseSource(Source source)
解析来源。
Parse the source from content block to a FilePart.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
source | Source | 来源到解析。the source to parse |
Part<?>io/agentscope/core/a2a/agent/message/BaseMediaBlockParser.java:76–87