AS AgentScopeAPI 手册 / API Reference

A2uiOperations

public final class A2uiOperations
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:31–194

A 2 ui Operations,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.examples.copilotkit.a2ui 包。核心成员包括 createSurface、updateDataModel、updateComponents、component、countComponents、surfaceIdOf。

Builders and structural checks for A2UI v0.9 server-to-client messages.

The checks here are intentionally structural (surface consistency, a resolvable root, known component names).

方法摘要Method Summary

方法Method说明Description
public static Map<String, Object> createSurface(String surfaceId)
static
创建 `createSurface`。
Creates the surface.
public static Map<String, Object> updateDataModel(String surfaceId, Map<String, Object> value)
static
更新数据模型。
Updates the data model.
public static Map<String, Object> updateComponents(String surfaceId, List<Map<String, Object>> components)
static
更新 `updateComponents`。
Updates the components.
public static Map<String, Object> component(String id, String component, Map<String, Object> props)
static
执行 `component` 方法。
Performs the component operation.
public static int countComponents(List<Map<String, Object>> operations)
static
设置该参数。
Counts the components declared across every `updateComponents` message.
public static String surfaceIdOf(List<Map<String, Object>> operations)
static
设置该参数。
Returns the surface id referenced by the first operation that declares one.
public static List<Map<String, Object>> normalize(List<?> rawOperations, String surfaceId)
static
执行 `normalize` 方法。
Normalises model output into a renderable operation list.

方法详情Method Detail

createSurface

public static Map<String, Object> createSurface(String surfaceId)
static

创建 createSurface。

Creates the surface.

参数Parameters
名称Name类型Type说明Description
surfaceIdStringsurface 标识(类型 `String`)。The surface id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:35–40

updateDataModel

public static Map<String, Object> updateDataModel(String surfaceId, Map<String, Object> value)
static

更新数据模型。

Updates the data model.

参数Parameters
名称Name类型Type说明Description
surfaceIdStringsurface 标识(类型 `String`)。The surface id.
valueMap<String, Object>值(类型 `Map`)。The value.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:42–48

updateComponents

public static Map<String, Object> updateComponents(String surfaceId, List<Map<String, Object>> components)
static

更新 updateComponents。

Updates the components.

参数Parameters
名称Name类型Type说明Description
surfaceIdStringsurface 标识(类型 `String`)。The surface id.
componentsList<Map<String, Object>>components(类型 `List >`)。The components.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:50–56

component

public static Map<String, Object> component(String id, String component, Map<String, Object> props)
static

执行 component 方法。

Performs the component operation.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
componentStringcomponent(类型 `String`)。The component.
propsMap<String, Object>props(类型 `Map`)。The props.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:58–70

countComponents

public static int countComponents(List<Map<String, Object>> operations)
static

设置该参数。

Counts the components declared across every updateComponents message.

参数Parameters
名称Name类型Type说明Description
operationsList<Map<String, Object>>operations(类型 `List >`)。The operations.
返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:80–90

surfaceIdOf

public static String surfaceIdOf(List<Map<String, Object>> operations)
static

设置该参数。

Returns the surface id referenced by the first operation that declares one.

参数Parameters
名称Name类型Type说明Description
operationsList<Map<String, Object>>operations(类型 `List >`)。The operations.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:93–103

normalize

public static List<Map<String, Object>> normalize(List<?> rawOperations, String surfaceId)
static

执行 normalize 方法。

Normalises model output into a renderable operation list.

参数Parameters
名称Name类型Type说明Description
rawOperationsList<?>原始 Operations(类型 `List`)。The raw operations.
surfaceIdStringsurface 标识(类型 `String`)。The surface id.
返回Returns List<Map<String, Object>>
返回列出>。Returns list.
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。when the payload cannot be repaired into a valid surface
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiOperations.java:113–153
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.