이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

AI 대화 상태 콜백

Tencent Real-Time Communication (TRTC) AI conversation offers a rich set of status callback features. These status callbacks are sent through TRTC's custom messages, enabling easy implementation of various switches between states such as "listening", "thinking", and "speaking" on the client.

Characteristics

1. Real-time: Status changes can be transmitted to all participants in real time.
2. Flexible: Custom message formats are used, making it easy to integrate and extend.
3. Multi-state support: Multiple states such as listening, thinking, speaking, and interrupted are included.

Message Format

Status callback messages are in the format of JSON. The specific fields are as follows:
Field
Type
Description
type
Number
Message type. 10001 indicates bot status.
sender
String
The userID of the sender, which is the bot's ID.
receiver
Array
The list of receiver userIDs. This message is actually broadcast within a room.
payload
Object
Message payload, containing detailed status information.
The payload object contains the following fields:
Field
Type
Description
roundid
String
Unique ID for a round of conversation.
timestamp
Number
Timestamp, indicating the specific time of status change.
state
Number
Current status code of the robot.
Status code 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 } }

Application Scenario

1. UI feedback: Corresponding interface elements are displayed based on different states, such as the animation for "listening".
2. Interaction control: When the AI is thinking or speaking, certain user inputs can be disabled to avoid interruptions.
3. Debugging and analysis: State information is used for conversation analysis to optimize user experiences.