七鱼开发文档中心
总览服务端 APIWebiOSAndroid鸿蒙Uniapp微信小程序插件三方接入
在线机器人机器人知识库

新增知识

新增知识。

接口级参数规则:新增时 name、answer、categoryId、robotId 必填;编辑时 id 必填;similars 最多 200 个;effectiveTime 与 failureTime 必须同时为空或同时存在。

请求字段限制:

  • id:选填,知识 ID,仅编辑时必填
  • robotId:必填,机器人 ID
  • name:必填,标准问
  • similars:选填,数组
  • answer:必填,答案内容,支持现有富文本协议
  • categoryId:必填,分类 ID,0 表示根分类
  • effectiveTime:选填,生效时间,毫秒时间戳;与 failureTime 必须同时为空或同时存在
  • failureTime:选填,失效时间,毫秒时间戳;不得小于 effectiveTime
  • validitySwitch:必填,有效期设置:0-无效,1-有效
  • isRich:选填,答案是否富文本,不传默认 1,默认值:1
  • connectedIdList:选填,数组

请求参数

名称类型必填描述示例值
appKeystring是应用 AppKey1c088a89de51d0af457616605f28390f
timeint64是请求时间戳(秒);与服务器时间误差超过 10 分钟会鉴权失败1511832531
checksumstring是请求签名校验和f570a5eb049eb803b086e45829b07e48
checksumAlgorithmint32否签名算法:0-SHA-1,1-SHA-256;不传默认为 0(SHA-1)0

请求体

名称类型必填描述示例值
idint64否知识 ID,仅编辑时必填10000001
robotIdint64是机器人 ID123456
namestring是标准问订单什么时候发货
similarsstring[]否
answerstring是答案内容,支持现有富文本协议一般 48 小时内发货
categoryIdint64是分类 ID,0 表示根分类0
effectiveTimeint64否生效时间,毫秒时间戳;与 failureTime 必须同时为空或同时存在1700000000000
failureTimeint64否失效时间,毫秒时间戳;不得小于 effectiveTime1700100000000
validitySwitchint32是有效期设置:0-无效,1-有效1
isRichint32否答案是否富文本,不传默认 11
connectedIdListint64[]否

返回参数

名称类型描述示例值
codeint32业务状态码,200 表示成功200
messagestring响应消息success
dataint64
totalint32分页总数,分页接口返回100
requestIdstring链路请求 ID0a1b2c3d4e5f
resultobject部分历史接口使用 result 字段承载业务数据

错误码

状态码描述
14001AppKey 缺失或不存在
14002checksum 校验失败
14003请求时间戳与服务器时间误差超过 10 分钟
14004请求体不是合法 JSON 对象,或参数缺失、格式非法
14009频控限制:接口调用超过限流阈值
14500服务内部错误
14501数据查询范围超出限制
14515当前 AppKey 无接口或资源访问权限
postEndpoint
/openapi/ai/knowledge/addKnowledge
POST
/openapi/ai/knowledge/addKnowledge
curl -X POST "https://qiyukf.com/openapi/ai/knowledge/addKnowledge?appKey=1c088a89de51d0af457616605f28390f&time=1511832531&checksum=f570a5eb049eb803b086e45829b07e48" \  -H "Content-Type: application/json" \  -d '{    "answer": "一般 48 小时内发货",    "similars": [      "什么时候发货"    ],    "name": "订单什么时候发货",    "validitySwitch": 1,    "robotId": 123456,    "categoryId": 0  }'
{
  "code": 200,
  "data": {},
  "message": "success"
}
{
  "code": 14001,
  "message": "AppKey not exists"
}
{
  "code": 14002,
  "message": "Bad checksum"
}
{
  "code": 14003,
  "message": "Bad time"
}
{
  "code": 14004,
  "message": "body内容json解析错误"
}
{
  "code": 14009,
  "message": "单位时间内请求过于频繁"
}
{
  "code": 14500,
  "message": "Internal error"
}
{
  "code": 14501,
  "message": "Data limit exceeded"
}
{
  "code": 14515,
  "message": "未开通机器人服务"
}

这篇文档有帮助吗?