被动回调 & 响应 API
被动回调 & 响应 API
回调/响应对照表
| 回调类 | 响应类 | onRequest 签名 |
|---|---|---|
Audio2LlmCallback | Audio2LlmResponse | (agentId, eventId, flag, buf, param, response) |
Audio2TtsCallback | Audio2TtsResponse | (agentId, eventId, itemId, flag, buf, param, response) |
Asr2LlmCallback | Asr2LlmResponse | (agentId, eventId, text, param, response) |
Asr2TtsCallback | Asr2TtsResponse | (agentId, eventId, text, param, response) |
AsrVideo2VlmCallback | AsrVideo2VlmResponse | (agentId, eventId, flag, text, video, param, response) |
AsrVideo2TtsCallback | AsrVideo2TtsResponse | (agentId, eventId, flag, text, video, param, response) |
AudioVideo2VlmCallback | AudioVideo2VlmResponse | (agentId, eventId, flag, data, param, response) |
AudioVideo2TtsCallback | AudioVideo2TtsResponse | (agentId, eventId, flag, data, param, response) |
各 Response 可用方法
| Response | ASR | LLM | VLM | TTS | Skill | Interrupt |
|---|---|---|---|---|---|---|
| Audio2LlmResponse | ✓ | ✓ | ✓ | ✓ | ||
| Audio2TtsResponse | ✓ | ✓ | ✓ | ✓ | ✓ | |
| Asr2LlmResponse | ✓ | ✓ | ✓ | |||
| Asr2TtsResponse | ✓ | ✓ | ✓ | ✓ | ||
| AsrVideo2VlmResponse | ✓ | ✓ | ✓ | |||
| AsrVideo2TtsResponse | ✓ | ✓ | ✓ | ✓ | ||
| AudioVideo2VlmResponse | ✓ | ✓ | ✓ | ✓ | ||
| AudioVideo2TtsResponse | ✓ | ✓ | ✓ | ✓ | ✓ |
所有 Response 均支持 onError(eventId, errorCode, errorMsg)。
基类共享方法(PassiveCallback)
每个回调类都继承自 PassiveCallback,下列方法可按需重载(不重载使用默认日志实现):
| 方法 | 触发时机 |
|---|---|
onRobotOnline(agentId, agentMeta) | 机器人上线 |
onRobotOffline(agentId) | 机器人下线 |
onFaceInfo(agentId, eventId, param) | 识别到人脸 / 声纹 UID(v1.4.0 开放) |
onVideoFrame(agentId, eventId, flag, buf, isKeyFrame, localTs, param) | 透传视频帧(flag=2 H264,flag=3 图片) |
onGreetSignal(agentId, eventId, param, GreetResponse response) | 打招呼信令(v1.4.0 合并) |
onState(agentId, eventId, stateName, stateValue) | 机器人状态推送(v1.4.0 合并);模块全集见 机器人端侧状态参考 |
GreetResponse 方法
| 方法 | 说明 |
|---|---|
onGreetVlmDelta(eventId, text) | VLM 流式片段 |
onGreetVlmDone(eventId) | VLM 流式结束 |
onGreetTtsDelta(eventId, audioBase64) | TTS 音频流式片段——audioBase64 是合成音频字节经 base64 编码后的字符串 |
onGreetTtsDone(eventId) | TTS 音频输出结束 |
onError(eventId, code, msg) | 应答异常 |