Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docs/xrobot/platform/websocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,41 @@ WebSocket 支持 **🎵 音频数据帧**(二进制方式)以及 **文本帧
}
```

##### 5. Hello 消息扩展:智能体提示词替换
此功能通过在 `hello` 消息中添加 `agent_params` 字段,允许设备端在建立连接时传递动态参数,用于替换智能体系统提示词中的占位符。

**使用示例:**
提示词配置参数:
```
你是{{assistant_name}},一个智能助手。
当前用户是{{user_name}},所在地点是{{location}}。
今天是{{date}},天气{{weather}}。
请根据这些信息与用户进行个性化交互。
```
hello消息(包含智能体提示词替换参数):
```json
{
"type": "hello",
"transport": "websocket",
"agent_params": {
"custom_replace_prompt": {
"assistant_name": "小牛牛",
"user_name": "张三",
"location": "北京",
"date": "2024年12月1日",
"weather": "晴天"
}
}
}
```
最终生成的系统提示词:
```
你是小牛牛,一个智能助手。
当前用户是张三,所在地点是北京。
今天是2024年12月1日,天气晴天。
请根据这些信息与用户进行个性化交互。
```

#### 服务端发送消息

##### 1. Hello 响应
Expand Down