This topic describes the DingRTC Web AIAgent SDK interfaces.
Data types
Type | Description | Minimum supported version |
AIAgent status | 3.9.0 | |
AIAgent message struct | 3.9.0 |
API list
API | Description | Minimum supported version |
Notifies the agent that the local user started push-to-talk. | 3.9.0 | |
Notifies the agent that the local user stopped push-to-talk. | 3.9.0 | |
Notifies the agent that the local user canceled push-to-talk. | 3.9.0 | |
Interrupts the agent. | 3.9.0 |
Event list
DingRTC global events
Event | Callback type | Description | Version |
(messgae: AIAgentMessage) => void; | Notification for a published agent message. | 3.9.0 | |
(newStatus: AgentStatus) => void | Notification for an agent status change. | 3.9.0 |
Data types
AgentStatus
The current status of the agent. Type: string (enum-like)
Indicator | Description | Version |
'listening' | The agent is listening for user input. | 3.9.0 |
'thinking' | The agent is thinking. | 3.9.0 |
'responding' | The agent is sending a response. | 3.9.0 |
AIAgentMessage
The structure of an AIAgent message.
Property | Type | Description | Version |
message | Uint8Array | Message payload. | 3.9.0 |
uid | string | The UID of the publisher. | 3.9.0 |
reasoning | boolean | Indicates whether this is an inference procedure. | 3.9.0 |
userType | 'user' | 'agent' | The publisher type. | 3.9.0 |
end | boolean | Indicates whether the current sentence is complete. This is used for sentence segmentation. | 3.9.0 |
extra | string | Custom content for an inserted message. | 3.9.0 |
API details
startPushToTalk()
Notifies the agent that the local user has started push-to-talk.
Type signature
startPushToTalk():void;Back
void
stopPushToTalk()
Notifies the agent that the local user has stopped push-to-talk.
Type signature
stopPushToTalk(): void;
Returns
void
cancelPushToTalk()
Notifies the agent that the local user has canceled push-to-talk.
Type signature
cancelPushToTalk(): void;Returns
void
interrupt()
Interrupts the agent.
Type signature
interrupt(): void;Returns
void
Event details
"message"
Receive a message published remotely
Type signature
'message': (message: AIAgentMessage) => void;Example
rtm.on('message', (message) => {
console.log(message);
});"agent-status"
Agent status received
Type signature
'agent-status': (agentStatus: AgentStatus) => void;Example
rtm.on('agent-status', (status) => {
console.log(status);
});