1.添加自定义对话接入配置
### 接口路径:https://dev.lingju.ai/httpapi/addDialog.do
|名称|添加自定义对话API接口|
|-|-|
|接口路径|https://dev.lingju.ai/httpapi/addDialog.do|
|请求方式|post|
</br>
### http post请求示例:
~~~
post https://dev.lingju.ai/httpapi/addDialog.do
json格式串行化post上传,注意请求的header需添加 'Content-Type':'application/json;charset=UTF-8'
{
"appkey":"xxxxxxxxxxxxxxxxxxxxxx",
"data": [{
"name":"xxxxxx",
"question":"xxxxxx",
"response":"xxxxxx"
},
{
"name":"xxxxxx",
"question":"xxxxxx",
"response":"xxxxxx"
}]
}
~~~
</br>
### 请求参数说明:
<table style="width:100%">
<thead>
<tr height="28" >
<th height="28" width="130px">参数</th>
<th width="100px">数据类型</th>
<th width="100px">可需</th>
<th colspan="2">描述</th>
</tr>
</thead>
<tbody>
<tr height="23">
<td height="23" >appkey</td>
<td>String</td>
<td>必填</td>
<td colspan="2">分配给开发者的专属appkey,请妥善保管</td>
</tr>
<tr >
<td rowspan="4" >data</td>
<td rowspan="4" >list</td>
<td rowspan="4" >必填</td>
<td colspan="2">自定义对话集合</td>
</tr>
<tr >
<td width="50px">name</td>
<td>对话名(限定32个字符以内。需要确保唯一,增、删、查、改都是通过对话名确定)</td>
</tr>
<tr >
<td width="50px">question</td>
<td>问题(限定30个字符以内)</td>
</tr>
</tr>
<tr >
<td width="50px">response</td>
<td>回复(限定1000个字符以内)</td>
</tr>
</tbody></table>
</br>
### 接口返回JSON示例:
~~~
{
"status": 900,
"description":"插入3条,失败2条",
"data": [{
"name":"xxxxxx",
"question":"xxxxxx",
"response":"xxxxxx",
"errorCause":"对话名XXX已存在"
},
{
"name":"xxxxxx",
"question":"xxxxxx",
"response":"xxxxxx",
"errorCause":"与对话名YYY的问题SSS存在相同记录"
}]
}
~~~
</br>
### 接口返回说明:
~~~
Content-Type:application/json;charset=UTF-8
~~~
<table style="width:100%">
<thead>
<tr height="28" >
<th height="28" width="130px">参数</th>
<th width="100px">数据类型</th>
<th colspan="2">描述</th>
</tr>
</thead>
<tbody>
<tr height="23">
<td height="23" >status</td>
<td>int</td>
<td colspan="2">状态码,0=成功,其它值则为错误码,请参考错误码表</td>
</tr>
<tr >
<td rowspan="5" >data</td>
<td rowspan="5" >list</td>
<td colspan="2">添加失败的自定义对话集合</td>
</tr>
<tr >
<td width="50px">name</td>
<td>对话名</td>
</tr>
<tr >
<td width="50px">question</td>
<td>问题</td>
</tr>
</tr>
<tr >
<td width="50px">response</td>
<td>回复</td>
</tr>
</tr>
<tr >
<td width="50px">errorCause</td>
<td>添加失败原因</td>
</tr>
</tr>
</thead>
<tbody>
<tr height="23">
<td height="23" >description</td>
<td>String</td>
<td colspan="2">通常为空,出错时会有错误信息</td>
</tr>
</tbody></table>
</br>
*灵聚接口不提供文件上传,若开发者开发批量提交对话问答功能,例如开发者允许对应的用户上传excel表格文档进行批量对话自定义,则需自行开发文件上传和转化功能。