Enhance API documentation by adding new endpoints for ASR preview, assistant configuration retrieval, and knowledge base management. Update existing assistant and tool definitions for improved clarity and functionality. Remove outdated sections from history records documentation, ensuring a streamlined reference for users.
This commit is contained in:
@@ -15,14 +15,23 @@
|
||||
|
||||
系统内置以下工具:
|
||||
|
||||
| 工具ID | 名称 | 说明 |
|
||||
|--------|------|------|
|
||||
| search | 网络搜索 | 搜索互联网获取最新信息 |
|
||||
| calculator | 计算器 | 执行数学计算 |
|
||||
| weather | 天气查询 | 查询指定城市的天气 |
|
||||
| translate | 翻译 | 翻译文本到指定语言 |
|
||||
| knowledge | 知识库查询 | 从知识库中检索相关信息 |
|
||||
| code_interpreter | 代码执行 | 安全地执行Python代码 |
|
||||
| 工具ID | 名称 | 类别 | 说明 |
|
||||
|--------|------|------|------|
|
||||
| calculator | 计算器 | query | 执行数学计算 |
|
||||
| code_interpreter | 代码执行 | query | 安全地执行Python代码 |
|
||||
| current_time | 当前时间 | query | 获取当前本地时间 |
|
||||
| turn_on_camera | 打开摄像头 | system | 执行打开摄像头命令 |
|
||||
| turn_off_camera | 关闭摄像头 | system | 执行关闭摄像头命令 |
|
||||
| increase_volume | 调高音量 | system | 提升设备音量 |
|
||||
| decrease_volume | 调低音量 | system | 降低设备音量 |
|
||||
| voice_message_prompt | 语音消息提示 | system | 播报一条语音提示消息 |
|
||||
| text_msg_prompt | 文本消息提示 | system | 显示一条文本弹窗提示 |
|
||||
| voice_choice_prompt | 语音选项提示 | system | 播报问题并展示可选项,等待用户选择 |
|
||||
| text_choice_prompt | 文本选项提示 | system | 显示文本选项弹窗并等待用户选择 |
|
||||
|
||||
**类别说明:**
|
||||
- `query`: 查询类工具,需要配置 HTTP URL
|
||||
- `system`: 系统类工具,直接在客户端执行
|
||||
|
||||
---
|
||||
|
||||
@@ -169,6 +178,132 @@ GET /api/v1/tools/health
|
||||
|
||||
---
|
||||
|
||||
### 4. 获取工具资源列表
|
||||
|
||||
```http
|
||||
GET /api/v1/tools/resources
|
||||
```
|
||||
|
||||
**Query Parameters:**
|
||||
|
||||
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
||||
|------|------|------|--------|------|
|
||||
| category | string | 否 | - | 过滤类别: "query" \| "system" |
|
||||
| enabled | boolean | 否 | - | 过滤启用状态 |
|
||||
| include_system | boolean | 否 | true | 是否包含系统工具 |
|
||||
| page | int | 否 | 1 | 页码 |
|
||||
| limit | int | 否 | 100 | 每页数量 |
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"total": 15,
|
||||
"page": 1,
|
||||
"limit": 100,
|
||||
"list": [
|
||||
{
|
||||
"id": "calculator",
|
||||
"user_id": 1,
|
||||
"name": "计算器",
|
||||
"description": "执行数学计算",
|
||||
"category": "query",
|
||||
"icon": "Terminal",
|
||||
"http_method": "GET",
|
||||
"http_url": null,
|
||||
"http_timeout_ms": 10000,
|
||||
"parameter_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"expression": {"type": "string", "description": "数学表达式"}
|
||||
},
|
||||
"required": ["expression"]
|
||||
},
|
||||
"parameter_defaults": {},
|
||||
"wait_for_response": false,
|
||||
"enabled": true,
|
||||
"is_system": true,
|
||||
"created_at": "2024-01-15T10:30:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5. 获取工具资源详情
|
||||
|
||||
```http
|
||||
GET /api/v1/tools/resources/{id}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 6. 创建工具资源
|
||||
|
||||
```http
|
||||
POST /api/v1/tools/resources
|
||||
```
|
||||
|
||||
**Request Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "订单查询",
|
||||
"description": "查询用户订单信息",
|
||||
"category": "query",
|
||||
"icon": "Search",
|
||||
"http_method": "POST",
|
||||
"http_url": "https://api.example.com/orders",
|
||||
"http_headers": {"Authorization": "Bearer {api_key}"},
|
||||
"http_timeout_ms": 10000,
|
||||
"parameter_schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"order_id": {"type": "string", "description": "订单ID"}
|
||||
},
|
||||
"required": ["order_id"]
|
||||
},
|
||||
"enabled": true
|
||||
}
|
||||
```
|
||||
|
||||
**Fields 说明:**
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| id | string | 否 | 工具ID,默认自动生成 |
|
||||
| name | string | 是 | 工具名称 |
|
||||
| description | string | 否 | 工具描述 |
|
||||
| category | string | 是 | 类别: "query" \| "system" |
|
||||
| icon | string | 否 | 图标名称 |
|
||||
| http_method | string | 否 | HTTP 方法,默认 GET |
|
||||
| http_url | string | 否* | HTTP 请求地址 (query 类必填) |
|
||||
| http_headers | object | 否 | HTTP 请求头 |
|
||||
| http_timeout_ms | int | 否 | 超时时间(毫秒),默认 10000 |
|
||||
| parameter_schema | object | 否 | 参数 JSON Schema |
|
||||
| parameter_defaults | object | 否 | 默认参数值 |
|
||||
| wait_for_response | boolean | 否 | 是否等待响应 (仅 system 类) |
|
||||
| enabled | boolean | 否 | 是否启用,默认 true |
|
||||
|
||||
---
|
||||
|
||||
### 7. 更新工具资源
|
||||
|
||||
```http
|
||||
PUT /api/v1/tools/resources/{id}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 8. 删除工具资源
|
||||
|
||||
```http
|
||||
DELETE /api/v1/tools/resources/{id}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 自动测试 (Autotest)
|
||||
|
||||
### 4. 运行完整自动测试
|
||||
|
||||
Reference in New Issue
Block a user