Conversational AI Status Callback
Tencent RTC conversational AI offers a rich set of status callback features. These status callbacks are sent through Tencent RTC's custom-defined messages, enabling easy implementation of various status switches on the client side, such as "Listening", "Thinking", "Speaking", and other states.
Through the Tencent RTC SDK Receive Custom Messages feature, you can listen for callbacks on the client to receive real-time AI status data. cmdID is fixed at 1.
Features
1. Real-time performance: Status changes can be transmitted to all participants in real-time.
2. Flexibility: Using custom message formats makes it easy to integrate and extend.
3. Multi-status Support: Includes multiple statuses such as listening, thinking, speaking, and being interrupted.
Message Format
Status callback messages use JSON format. The specific fields are as follows:
Field | Type | Description |
type | Number | Message type, 10001 indicates bot status |
sender | String | Sender's `userid`, which is the bot's ID |
receiver | Array | List of recipient `userid`s, this message is actually broadcast in the room |
payload | Object | Message payload, containing detailed status information |
The payload object contains the following fields:
Field | Type | Description |
roundid | String | Unique ID identifying a single conversation |
timestamp | Number | Timestamp, indicating the specific time of status change |
state | Number | Current status code of the robot |
Status codes description:
Status Code | Description |
1 | Listening |
2 | Thinking |
3 | Speaking |
4 | Interrupted |
Sample message
{"type": 10001,"sender": "ai_assistant_001","receiver": [],"payload": {"roundid": "conversation_789012","timestamp": 1629384755,"state": 2}}
Use cases
1. UI feedback: Display corresponding interface elements based on different states, such as the "Listening" animation.
2. Interaction control: Disable certain user inputs when the AI is thinking or speaking to avoid interruptions.
3. Debug and analysis: Utilize state information for Conversation Analytics to optimize user experience.