AS AgentScopeAPI 手册 / API Reference

WeixinChannel

public final class WeixinChannel implements Channel
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:47–644

Weixin 渠道,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.weixin 包,实现 Channel。核心成员包括 fromProperties、create、channelId、config、init、start。

Personal Weixin adapter backed by Tencent's official iLink long-poll API.

字段摘要Field Summary

字段Field类型Type说明Description
TYPE
staticfinal
String
类型字段。
The TYPE field.

方法摘要Method Summary

方法Method说明Description
public static WeixinChannel fromProperties(String id, ChannelConfig c, Map<String, Object> props)
static
执行来自属性相关操作。
Performs the from properties operation.
public static WeixinChannel create(String id, ChannelConfig config, WeixinChannelProperties properties, WeixinCredentialProvider credentialProvider, WeixinStateStore stateStore, WeixinRuntimeListener runtimeListener)
static
创建并返回实例。
Constructs a channel with host-provided credentials, state, and runtime observations.
public String channelId()
返回渠道标识。
Returns the channel id.
public ChannelConfig config()
返回配置。
Returns the config.
public void init(Gateway g)
初始化 `WeixinChannel` 实例。
Creates a new instance.
public synchronized void start()
synchronized
执行启动相关操作。
Returns the start.
public void stop()
执行停止相关操作。
Returns the stop.
public Mono<Msg> dispatch(InboundMessage in)
设置该参数。
Performs the dispatch operation.
public Mono<String> deliverWithReceipt(OutboundAddress address, Msg message, String deliveryId)
执行 `deliverWithReceipt` 方法。
Sends one host-persisted reply and returns the provider's receipt.
public void deliver(OutboundAddress address, List<Msg> messages)
执行 `deliver` 方法。
Performs the deliver operation.

字段详情Field Detail

TYPE

public static final String TYPE
staticfinal

类型字段。声明为 public static final String TYPE。

The TYPE field.

源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:48

方法详情Method Detail

fromProperties

public static WeixinChannel fromProperties(String id, ChannelConfig c, Map<String, Object> props)
static

执行来自属性相关操作。

Performs the from properties operation.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
cChannelConfigc(类型 `ChannelConfig`)。The c.
propsMap<String, Object>props(类型 `Map`)。The props.
返回Returns WeixinChannel
返回WeixinChannel。Returns weixin channel.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:110–131

create

public static WeixinChannel create(String id, ChannelConfig config, WeixinChannelProperties properties, WeixinCredentialProvider credentialProvider, WeixinStateStore stateStore, WeixinRuntimeListener runtimeListener)
static

创建并返回实例。

Constructs a channel with host-provided credentials, state, and runtime observations.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
configChannelConfig配置对象(类型 `ChannelConfig`)。The config.
propertiesWeixinChannelProperties属性(类型 `WeixinChannelProperties`)。The properties.
credentialProviderWeixinCredentialProvider凭证提供者(类型 `WeixinCredentialProvider`)。The credential provider.
stateStoreWeixinStateStore状态存储(类型 `WeixinStateStore`)。The state store.
runtimeListenerWeixinRuntimeListener运行时监听器(类型 `WeixinRuntimeListener`)。The runtime listener.
返回Returns WeixinChannel
返回WeixinChannel。Returns weixin channel.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:134–148

channelId

public String channelId()

返回渠道标识。

Returns the channel id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:150–152

config

public ChannelConfig config()

返回配置。

Returns the config.

返回Returns ChannelConfig
返回ChannelConfig。Returns channel config.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:154–156

init

public void init(Gateway g)

初始化 WeixinChannel 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
gGatewayg(类型 `Gateway`)。The g.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:158–160

start

public synchronized void start()
synchronized

执行启动相关操作。

Returns the start.

源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:162–169

stop

public void stop()

执行停止相关操作。

Returns the stop.

源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:171–178

dispatch

public Mono<Msg> dispatch(InboundMessage in)

设置该参数。

Performs the dispatch operation.

参数Parameters
名称Name类型Type说明Description
inInboundMessagein(类型 `InboundMessage`)。The in.
返回Returns Mono<Msg>
返回Mono。Returns mono.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:180–182

deliverWithReceipt

public Mono<String> deliverWithReceipt(OutboundAddress address, Msg message, String deliveryId)

执行 deliverWithReceipt 方法。

Sends one host-persisted reply and returns the provider's receipt.

参数Parameters
名称Name类型Type说明Description
addressOutboundAddressaddress(类型 `OutboundAddress`)。The address.
messageMsg消息(类型 `Msg`)。The message.
deliveryIdStringdelivery 标识(类型 `String`)。The delivery id.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:234–247

deliver

public void deliver(OutboundAddress address, List<Msg> messages)

执行 deliver 方法。

Performs the deliver operation.

参数Parameters
名称Name类型Type说明Description
addressOutboundAddressaddress(类型 `OutboundAddress`)。The address.
messagesList<Msg>消息列表(类型 `List`)。The messages.
源码Source io/agentscope/extensions/channel/weixin/WeixinChannel.java:249–274

继承成员Inherited Members

继承自Methods inherited from Channel
基于官方固定版本源码静态生成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.