知识库管理
创建知识库分类
Chatbot#command("POST", "/faq/categories", body)
body / JSON Object
{
"label": "{{categoryText}}"
}
result/ JSON Object
{
"rc": 0,
"data": {
"value": "{{categoryId}}",
"categories": [
{
"value": "{{categoryId}}",
"label": "{{categoryText}}",
"children": [
{
"value": "I7vfx47i5I",
"label": "二级分类名"
}
]
},
{
"value": "{{categoryId}}",
"label": "x2"
}
]
}
}
获取知识库分类信息
Chatbot#command("GET", "/faq/categories")
result / JSON Object
{
"rc": 0,
"data": [
{
"value": "{{categoryId}}",
"label": "{{categoryText}}",
"children": [
{
"value": "{{categoryId}}",
"label": "{{categoryText}}"
}
]
}
]
}
更新知识库分类
Chatbot#command("", "/faq/categories", body)
body / JSON Object
{
"value": "{{categoryId}}",
"label": "新的名字"
}
result/ JSON Object
{
"rc": 0,
"data": [
{
"value": "wwQyjS310",
"label": "一级分类名",
"children": [
{
"value": "{{categoryId}}",
"label": "新的名字"
}
]
}
]
}
删除知识库分类
Chatbot#command("DELETE", "/faq/categories/{{categoryId}}")
path
key |
type |
default |
description |
categoryId |
string |
无默认值,必填 |
分类唯一标识 |
result/ JSON Object
{
"rc": 0,
"data": [
{
"value": "TSDD-W6T9",
"label": "x2"
}
]
}
创建问答对
Chatbot#command("post", "/faq/database", body)
body / JSON Object
{
"post": "如何查看快递单号",
"replies": [
{
"rtype": "plain",
"content": "foo",
"enabled": true
},
{
"rtype": "plain",
"content": "bar",
"enabled": true
}
],
"enabled": true,
"categoryTexts": [
"一级分类名",
"二级分类名"
]
}
result / JSON Object
{
"rc": 0,
"data": {
"id": "{docId}",
"replyLastUpdate": "{{replyLastUpdate}}"
}
}
更新知识库问答对
Chatbot#command("PUT", "/faq/database/{{docId}}", body)
path
key |
type |
default |
description |
docId |
string |
无默认值, 必填 |
问答对标识 |
body / JSON Object
{
"post": "怎么开通微信支付?",
"replyLastUpdate": "{{replyLastUpdate}}",
"replies": [
{
"rtype": "plain",
"content": "foo2",
"enabled": true
},
{
"rtype": "plain",
"content": "bar2",
"enabled": true
}
],
"enabled": true
}
result / JSON Object
{
"rc": 0,
"data": {
"id": "{{docId}}",
"replyLastUpdate": "{{replyLastUpdate}}"
}
}
获取问答对列表
Chatbot#command("GET", "/faq/database?limit={{limit}}&page={{page}}&q={{q}}")
path
key |
type |
default |
description |
limit |
int |
20 |
返回最多多少条数据 |
page |
int |
1 |
返回第多少页 |
q |
string |
空 |
问答对匹配时,问题应包含的关键字 |
result / JSON Object
{
"total": 3,
"current_page": 1,
"total_page": 1,
"data": [
{
"post": "如何查看快递单号",
"categories": [
"wwQyjS310",
"I7vfx47i5I"
],
"enabled": true,
"id": "{{docId}}"
}
],
"rc": 0,
"status": {
"reindex": 0,
"retrain": 0
}
}
创建问答对相似问
Chatbot#command("POST", "/faq/database/{{docId}}/extend", body)
path
key |
type |
default |
description |
docId |
string |
无默认值, 必填 |
问答对标识 |
body / JSON Object
{
"post": "怎样支持微信支付?"
}
result / JSON Object
{
"rc": 0,
"data": {
"id": "{{extendId}}"
}
}
获取问答对相似问列表
Chatbot#command("GET", "/faq/database/{{docId}}/extend")
path
key |
type |
default |
description |
docId |
string |
无默认值, 必填 |
问答对标识 |
result / JSON Object
{
"total": 1,
"current_page": 1,
"total_page": 1,
"data": [
{
"post": "怎样支持微信支付?",
"postId": "{{docId}}",
"enabled": true,
"id": "{{extendId}}"
}
],
"rc": 0
}
更新问答对相似问
Chatbot#command("PUT", "/faq/database/{{docId}}/extend/{{extendId}}", body)
path
key |
type |
default |
description |
docId |
string |
无默认值, 必填 |
问答对标识 |
extendId |
string |
无默认值, 必填 |
扩展问标识 |
body / JSON Object
{
"post": "怎样支持微信支付?"
}
result / JSON Object
{
"rc": 0,
"data": {
"id": "{{extendId}}"
}
}
删除问答对相似问
Chatbot#command("DELETE", "/faq/database/{{docId}}/extend/{{extendId}}")
path
key |
type |
default |
description |
docId |
string |
无默认值, 必填 |
问答对标识 |
extendId |
string |
无默认值, 必填 |
扩展问标识 |
result / JSON Object
{
"rc": 0,
"msg": "done"
}
删除问答对
Chatbot#command("DELETE", "/faq/database/{{docId}}")
result / JSON Object
{
"rc": 0,
"msg": "done"
}
获取知识库热门问题
Chatbot#command("GET", "/faq/database/inquiryrank?topN={{topN}}")
path
key |
type |
default |
description |
topN |
int |
10 |
获得热门问题的条数,即导出数据的条数 |
result / JSON Object
{
"rc": 0,
"data": [
{
"docId": "{{docId}}",
"inquiryscore": "13",
"post": "{{post}}",
"enabled": true,
"categories": [
"s1",
"s2"
]
},
{
"docId": "{{docId}}",
"inquiryscore": "0",
"post": "{{post}}",
"enabled": true,
"categories": []
},
...
]
}
其中,data 内元素按照 inquiryscore
的值,降序排列,即该问题越热门,越靠上。