Skip to main content

工具服务

所有工具服务接口都需要有效的访问令牌。请在请求头中包含Bearer令牌。

工具服务概述

工具服务提供多种辅助功能:
  • 语音转换(文本转语音、语音识别)
  • 向量数据库操作(搜索、增删改查)
  • 主页内容管理
  • 外脑分析工具

语音服务

/tool/speech
语音服务支持文本转语音功能。

请求参数

参数名类型必选说明
convIdstring对话ID
msgIdstring消息ID
POST /tool/speech
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "convId": "conv123",
  "msgId": "msg456"
}
返回的音频数据为base64编码的MP3格式。支持中文语音合成,使用标准女声。

向量数据库工具

向量数据库功能

提供完整的向量数据库操作接口,支持:
  • 数据检索和向量搜索
  • 数据的增删改查
  • 批量操作
  • 条件过滤

获取数据列表

/tool/vdb/{className}
获取指定数据库的数据列表。

路径参数

参数名类型必选说明
classNamestring数据库名称

查询参数

参数名类型必选说明
limitnumber返回数量
skipnumber跳过数量
whereobject查询条件
GET /tool/vdb/wainao_chat?limit=10&skip=0
Authorization: Bearer YOUR_TOKEN

获取单条数据

/tool/vdb/{className}/{id}
获取指定ID的数据详情。

路径参数

参数名类型必选说明
classNamestring数据库名称
idstring数据ID
GET /tool/vdb/wainao_chat/doc123
Authorization: Bearer YOUR_TOKEN

创建数据

/tool/vdb/{className}
创建新的向量数据。

请求参数

参数名类型必选说明
contentstring内容文本
tagsarray标签列表
metadataobject元数据
POST /tool/vdb/wainao_chat
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "content": "新的文档内容",
  "tags": ["AI", "新文档"],
  "metadata": {
    "author": "用户名",
    "createTime": "2024-01-10"
  }
}

更新数据

/tool/vdb/{className}/{id}
更新指定ID的数据。

路径参数

参数名类型必选说明
classNamestring数据库名称
idstring数据ID
PATCH /tool/vdb/wainao_chat/doc789
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "content": "更新后的文档内容",
  "tags": ["AI", "更新文档"]
}

删除数据

/tool/vdb/{className}/{id}
删除指定ID的数据。

路径参数

参数名类型必选说明
classNamestring数据库名称
idstring数据ID
DELETE /tool/vdb/wainao_chat/doc789
Authorization: Bearer YOUR_TOKEN
删除操作不可恢复,请谨慎操作。

向量搜索

/tool/vdb/{className}/vector
基于内容进行向量相似度搜索。

路径参数

参数名类型必选说明
classNamestring数据库名称

请求参数

参数名类型必选说明
contentstring搜索内容
queryobject查询条件
POST /tool/vdb/wainao_chat/vector
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "content": "查找相似的AI文档",
  "query": {
    "filter": {
      "tags": ["AI"]
    },
    "limit": 10
  }
}
向量搜索支持基于内容的相似度匹配,可以通过query参数进行精确过滤。

错误码说明

错误码说明
400请求参数错误
404数据不存在
422数据处理错误
500服务器错误

地址解析工具

/tool/home/address
地址文本智能解析服务。

请求参数

参数名类型必选说明
addressstring地址文本
POST /tool/home/address
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "address": "张三 13800138000 浙江省杭州市西湖区文三路 443号"
}
支持智能识别收件人姓名、电话号码、省市区及详细地址。

OAuth认证服务

OAuth认证概述

提供完整的OAuth 2.0认证流程支持:
  • 匿名用户认证
  • 授权码模式
  • 令牌刷新

匿名认证

/tool/home/oauth/anonymous
创建匿名用户并获取访问令牌。

请求参数

参数名类型必选说明
anonymousstring匿名标识符
passwdstring密码
POST /tool/home/oauth/anonymous
Content-Type: application/json

{
  "anonymous": "anon_123",
  "passwd": "password123"
}
匿名用户令牌有效期为1小时,刷新令牌有效期为30天。

授权码换取令牌

/tool/home/oauth/token
使用授权码获取访问令牌。

请求参数

参数名类型必选说明
codestring授权码
client_idstring客户端ID
POST /tool/home/oauth/token
Content-Type: application/x-www-form-urlencoded

{
  "grant_type": "authorization_code",
  "code": "auth_code_123",
  "client_id": "client_123"
}

刷新访问令牌

/tool/home/oauth/rtoken
使用刷新令牌获取新的访问令牌。

请求参数

参数名类型必选说明
grant_typestringrefresh_token
refresh_tokenstring刷新令牌
client_idstring客户端ID
POST /tool/home/oauth/rtoken
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer OLD_ACCESS_TOKEN

{
  "grant_type": "refresh_token",
  "refresh_token": "ryJxx...",
  "client_id": "client_123"
}
刷新令牌仅可使用一次,使用后会自动失效并生成新的刷新令牌。

OAuth错误码说明

错误码说明
400请求参数错误
401未授权或令牌无效
403权限不足
500服务器错误