接口说明


查询接口(异步)


名称

描述

默认值

接口路径

http://host:port/aiweb/api/v3/conv/query

接口说明

V3版本查询方法 -- 异步方法 -- SSE请求

header

token

登录key,使用login方法获取;login方法请参考:登录AIChat

接口参数

convId

会话Id

datasetId

数据模型Id

question

用户问题


queryType

查询类型:

  • query(查询模式)

  • analysis(分析模式)

  • expert(专家模式)


id

本次对话id

从外部传入才能做点赞点踩


need_inquiry

本次查询是否需要使用反问功能

default(true)

返回内容

返回SSE对象,前端处理

SSE返回报文样例:

{"role": "SimpleQuery", "response_status": "generating code", "response_message": " \"", "execution_result": "", "send_to": "Unknown", "response_type": "python"}

...

SSE 接口会返回很多条这样的报文;具体原理请自行查询百度。

请手工拼接返回报文 "response_message" 和 "execution_result" 部分内容;response_type 表示当前这条报文的返回内容是啥。


查询接口(同步)


名称

描述

默认值

接口路径

http://host:port/aiweb/api/v3/conv/query_sync

接口说明

V3版本查询方法 -- 同步方法

header

token

登录key,使用login方法获取;login方法请参考:登录AIChat

接口参数

convId

会话Id

datasetId

数据模型Id

question

用户问题


queryType

查询类型:

  • query(查询模式)

  • analysis(分析模式)

  • expert(专家模式)


id

本次对话id

从外部传入才能做点赞点踩


need_inquiry

本次查询是否需要使用反问功能

default(true)

返回内容

返回查询结果(JSON),前端处理

{

"code": 0,

"result": "[\"[{\\\"年月\\\":\\\"2019-01\\\",\\\"销量\\\":132912,\\\"销量环比增长率\\\":\\\"-6.06%\\\",\\\"_销量占比\\\":\\\"8.8272%\\\"},...]",

"message": null

}

code=0,表示返回正确(result是返回结果);否则message就是错误提示。


中断查询


名称

描述

默认值

接口路径

http://host:port/aiweb/api/v3/conv/stop_stream

接口说明

异步query方法情况下,中断当前查询

header

token

登录key,使用login方法获取;login方法请参考:登录AIChat

接口参数

convId

会话Id

返回内容

{

code: 错误码(0 - 表示正确)

message:错误描述

result:方法执行返回结果 -- 服务端无返回则为空

}


新建查询对话


名称

描述

默认值

接口路径

http://host:port/aiweb/api/v3/conv/new

接口说明

新建查询对话

header

token

登录key,使用login方法获取;login方法请参考:登录AIChat

接口参数

convId

会话Id

返回内容

{

code: 错误码(0 - 表示正确)

message:错误描述

result:方法执行返回结果 -- 服务端无返回则为空

}


关闭查询对话


名称

描述

默认值

接口路径

http://host:port/aiweb/api/v3/conv/close

接口说明

关闭查询对话 -- 结束本次多轮对话

header

token

登录key,使用login方法获取;login方法请参考:

接口参数

convId

会话Id

返回内容

{

code: 错误码(0 - 表示正确)

message:错误描述

result:方法执行返回结果 -- 服务端无返回则为空

}

获取本次对话推荐数据模型


名称

描述

默认值

接口路径

http://host:port/aiweb/api/v3/conv/recommend_dataset

接口说明

获取本次对话推荐数据模型

header

token

登录key,使用login方法获取;login方法请参考:登录AIChat

接口参数

convId

会话Id

question

用户提问


datasetId

当前数据模型id


返回内容

{

code: 错误码(0 - 表示正确)

message:错误描述

result:获取推荐的数据模型列表

}


获取本次对话的详细查询步骤和内容


名称

描述

默认值

接口路径

http://host:port/aiweb/#/testTool?answerid=${id}


GET请求


示例:

http://10.10.35.110:9070/aiweb/#/testTool?answerid=01fc76d5-7ec4-4fad-8216-d4b829ac740c

接口说明

获取本次对话的详细查询步骤和内容


这个基本是前端接口,需要前端js辅助解析的,所以无法直接提供给第三方调用

接口参数

id

本次对话Id

返回内容

查询步骤说明html页面

登录接口请参考


界面集成


名称

描述

默认值

URL路径

/smartbi/vision/AIChatV3.html


GET请求


示例:

http://10.10.35.110:9070/smartbi/vision/AIChatV3.html

集成说明

本地址为bi里面的地址,必须登录bi后再使用。可以跳过登录步骤,直接打开v3的界面

参数