From f62a9665697bcb36f0f6fd1ff570862d8937f54b Mon Sep 17 00:00:00 2001 From: realcaiyizhen <56955287@qq.com> Date: Sat, 4 Nov 2023 14:17:39 +0800 Subject: [PATCH] 新增chatruntime接口文档 --- chat_server/chatruntime接口.md | 1541 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1541 insertions(+) create mode 100644 chat_server/chatruntime接口.md diff --git "a/chat_server/chatruntime\346\216\245\345\217\243.md" "b/chat_server/chatruntime\346\216\245\345\217\243.md" new file mode 100644 index 0000000..94d0641 --- /dev/null +++ "b/chat_server/chatruntime\346\216\245\345\217\243.md" @@ -0,0 +1,1541 @@ +[TOC] +# chatruntime对话接口 + +**对话测试环境URL**: http://10.0.7.5:8081/ + +**bot开发生产环境URL**: http://10.0.7.3:8081/ + + + + + + + +## 1.作品BOT对话接口 +**中控调用,作品对话接口** + +**METHOD**: POST + +**path**: /api/chat + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求body字段说明 + +| key | type | required | description | +| -------------- |-------------| -------------- | -------------- | +| appVersion | String | no | app的版本号 | +| channelId | String | no | 渠道ID | +| channelName | String | no | 渠道名称 | +| uid | String | yes | 用户id | +| msg | String | yes | ASR解析出来的自然语言文本 | +| botAccount | String | yes | bot Id | +| chatKey | String | no | chatruntime和引擎的 sessionId,空的话为新会话,作品从头开始 | +| needWelcome | boolean | no | 是否需要引擎welcome,默认false | +| needRecommendMsg | boolean | no | 是否需要提示词,默认false | +| needPlotImgUrl | boolean | no | 是否需要背景图,默认false | +| resultType | int | no | * 0: 正常对话流程处理 * 1: 返回三元组 * 2: 返回词性和三元组,默认0 | + + + + +### 请求示例 + +```json +{ + "uid": 123123, + "botAccount":"gz33botzhentanxueyuan0605394082129", + "channelId":"haiwaixtcrtos-watch-sdk-pro", + "msg": "开始", + "chatKey":"haiwaixtcrtos-watch-sdk-pro123123@@@gz33botzhentanxueyuan0605394082129@@@@MF7BHX5A7H8eEcG0IPuC" +} + +curl --location 'http://10.0.7.11:8081/api/chat' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data-raw '{ + "uid": 123123, + "botAccount":"gz33botzhentanxueyuan0605394082129", + "channelId":"haiwaixtcrtos-watch-sdk-pro", + "msg": "开始", + "chatKey":"haiwaixtcrtos-watch-sdk-pro123123@@@gz33botzhentanxueyuan0605394082129@@@@MF7BHX5A7H8eEcG0IPuC" +}' + +``` + + + +### 响应字段说明 + +| key | type | description | +| -------------- |-------------|-------------| +| code | int | 状态码 | +| msg | string | 状态信息 | +| data | JSONObject | 响应数据 | + +data值说明 + +| key | type | description | +| ---------------- | -------------------- | ------------------------------------------------------------ | +| replys | List | BOT运行后的输出结果;
chatruntime的bot运行线程把结果给到引擎,引擎再转发到redis里,然后chatruntime的接口线程从redis里取出来;
虽然是个list,但所有业务场景中,list里都只有1个元素 | +| chatKey | string | 引擎的sessionId | +| cmds | JSONObject | 执行对象,主要用在中控bot,避免相互调用的操作,优化之前的不好设计 | +| log | SigleLogVO | 对话流程日志对象,拼写有错,single | +| plotImgUrl | String | 剧情点背景图 | +| bgmUrl | String | 背景音乐地址 | +| botPostData | Object | 对话流程配置调用第三方返回的对象 | +| plotNum | String | 剧情编号 | +| recommendMsgList | List | 提示词列表 | +| mediaList | List | 媒体列表 | + +EngineMsgBO值说明 + +| key | type | description | +| -------- | ------ | ------------------------------------- | +| nickname | String | bot的别名,默认值visitor | +| status | String | 状态,默认值waiting | +| chat_key | String | 引擎的sessionId | +| text | String | bot返回的数据,包括故事剧情和各种指令 | + + + + + +### 响应实例 + +```json +{ + "code":1, + "msg":"成功", + "data":{ + "replys":[ + { + "nickname":"bot", + "status":"answering", + "chat_key":"haiwaixtcrtos-watch-sdk-pro123123@@@gz33botzhentanxueyuan0605394082129@@@@MF7BHX5A7H8eEcG0IPuC", + "text":" 【旁白@正常】夜晚,你突然听到一阵敲打声。你看到一只啄木鸟悬停在窗沿,喙里衔着一封信件。【弟弟@正常】李正哥哥,你还不睡觉?【旁白@正常】你的弟弟迷迷糊糊地走过来,发现了是这只啄木鸟在用嘴敲打着窗户。【弟弟@正常】哥哥!那是只啄木鸟吗?►SEND_CC_DATA{\"priority\":8}SEND_CC_DATA◄ " + } + ], + "chatKey":"haiwaixtcrtos-watch-sdk-pro123123@@@gz33botzhentanxueyuan0605394082129@@@@MF7BHX5A7H8eEcG0IPuC", + "cmds":null, + "log":null, + "plotImgUrl":null, + "bgmUrl":null, + "botPostData":null, + "plotNum":"1-0", + "recommendMsgList":[ + + ], + "mediaList":[ + + ] + } +} + + +``` + + + + + +## 2.意图组搜索BOT对话接口 + +**创作平台和剧本编辑器调用,必须在有意图组搜索BOT的节点才能运行,不然报500错误** + +**METHOD**: POST + +**path**: /api/intent/query/v3 + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +| key | type | required | description | +| ------ | ------ | -------- | ---------------------------- | +| secret | String | yes | 固定值f1fvo0Yhw199PIHWTmCbbQ | + + + +### 请求body字段说明 + +| key | type | required | description | +| ----- | --------- | -------- | -------------------------------------------- | +| sents | JSONArray | yes | 查询句子数组,所有场景中,数组里只有一个元素 | + + + +### 请求示例 + +```json + + +curl --location 'http://10.0.7.3:8081/api/intent/query/v3?secret=f1fvo0Yhw199PIHWTmCbbQ' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "sents":["我要去吃饭"] +}' + +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | --------- | ---------------- | +| code | int | 状态码 | +| msg | string | 状态信息 | +| data | JSONarray | 数组元素说明见下 | + +data数组元素说明 + +| key | type | description | +| -------------------- | --------- | ------------------------------------------------------------ | +| sentenceIdentifyList | JSONarray | 虽然是数组,但所有场景中都只有一个元素,元素是个对象,对象包含2个字段:1.用户输入的搜索句子,2.引擎解析句子的语义三元组数组
这里字段的设计是有问题的:用户的一次搜索,对应N个data元素,所以每个data元素的这个字段的值,都是一样的,别看接口返回内容一大串,80%内容是冗余的 | +| intentName | string | 意图名字 | +| matchType | int | 匹配类型,2是忽略语义关系的模糊匹配,1是全匹配 | +| allMatch | boolean | 字段内涵同matchType,true是全匹配,false是忽略语义关系的匹配 | + + + + + +### 响应实例 + +```json +{ + "code": 1, + "msg": "成功", + "data": [{ + "sentenceIdentifyList": [{ + "sentence": "我要去吃饭", + "identifyList": [{ + "semanticRelationName": "ruleb0answerb0nn", + "soSet": ["吃:饭"] + }, { + "semanticRelationName": "ruleb0negativeb0mood", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vv", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb01", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0answerb0what", + "soSet": ["visitor:吃", "要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vn", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0dob0whatb0nv", + "soSet": ["visitor:吃", "visitor:要"] + }, { + "semanticRelationName": "ruleb0nnb0pn", + "soSet": ["visitor:吃", "visitor:饭"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0vvb0adjunct", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0nnb0adjunct", + "soSet": ["visitor:吃"] + }] + }], + "intentName": "复合动作", + "matchType": 1, + "allMatch": true + }, { + "sentenceIdentifyList": [{ + "sentence": "我要去吃饭", + "identifyList": [{ + "semanticRelationName": "ruleb0answerb0nn", + "soSet": ["吃:饭"] + }, { + "semanticRelationName": "ruleb0negativeb0mood", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vv", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb01", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0answerb0what", + "soSet": ["visitor:吃", "要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vn", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0dob0whatb0nv", + "soSet": ["visitor:吃", "visitor:要"] + }, { + "semanticRelationName": "ruleb0nnb0pn", + "soSet": ["visitor:吃", "visitor:饭"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0vvb0adjunct", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0nnb0adjunct", + "soSet": ["visitor:吃"] + }] + }], + "intentName": "做不到", + "matchType": 2, + "allMatch": false + }, { + "sentenceIdentifyList": [{ + "sentence": "我要去吃饭", + "identifyList": [{ + "semanticRelationName": "ruleb0answerb0nn", + "soSet": ["吃:饭"] + }, { + "semanticRelationName": "ruleb0negativeb0mood", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vv", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb01", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0answerb0what", + "soSet": ["visitor:吃", "要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vn", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0dob0whatb0nv", + "soSet": ["visitor:吃", "visitor:要"] + }, { + "semanticRelationName": "ruleb0nnb0pn", + "soSet": ["visitor:吃", "visitor:饭"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0vvb0adjunct", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0nnb0adjunct", + "soSet": ["visitor:吃"] + }] + }], + "intentName": "买某东西", + "matchType": 2, + "allMatch": false + }, { + "sentenceIdentifyList": [{ + "sentence": "我要去吃饭", + "identifyList": [{ + "semanticRelationName": "ruleb0answerb0nn", + "soSet": ["吃:饭"] + }, { + "semanticRelationName": "ruleb0negativeb0mood", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vv", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb01", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0answerb0what", + "soSet": ["visitor:吃", "要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0dob0whatb0vn", + "soSet": ["要:饭", "去:饭", "吃:饭"] + }, { + "semanticRelationName": "ruleb0dob0whatb0nv", + "soSet": ["visitor:吃", "visitor:要"] + }, { + "semanticRelationName": "ruleb0nnb0pn", + "soSet": ["visitor:吃", "visitor:饭"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0vvb0adjunct", + "soSet": ["要:吃", "去:吃"] + }, { + "semanticRelationName": "ruleb0answerb0isb0whatb0nnb0adjunct", + "soSet": ["visitor:吃"] + }] + }], + "intentName": "形容动作", + "matchType": 2, + "allMatch": false + }] +} +``` + + + + + + + +## 3.重新加载bot数据 + +**数据端调用** + +**METHOD**: PUT + +**path**: /bot/data + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +| key | type | required | description | +| ---------- | ------ | -------- | ---------------- | +| path | String | yes | 固定值botRestart | +| secret | String | yes | 固定值qiwuradd | +| botAccount | String | yes | botid | + + + +### 请求body字段说明 + +| key | type | required | description | +| ----- | --------- | -------- | -------------------------------------------- | +| sents | JSONArray | yes | 查询句子数组,所有场景中,数组里只有一个元素 | + + + +### 请求示例 + +```json + +curl --location --request PUT 'http://10.0.7.5:8081/bot/data?path=botRestart&botAccount=gz33botzhentanxueyuan0605394082129&secret=qiwuradd' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{}' + +``` + + + +### 响应字段说明 + +| key | type | description | +| ------ | ---- | ------------------------- | +| status | int | 固定值1,无论有无加载成功 | + + + +### 响应实例 + +```json +{"status":1} + +``` + + + + + + + +## 4.获取所有剧情点编号 + +**分析系统调用** + +**METHOD**: GET + +**path**: /bot/data/plot + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +| key | type | required | description | +| -------- | ------ | -------- | ---------------------------- | +| secret | String | yes | 固定值f1fvo0Yhw199PIHWTmCbbQ | +| workName | String | yes | botid | + + + +### 请求body字段说明 + +无 + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/bot/data/plot?secret=f1fvo0Yhw199PIHWTmCbbQ&workName=gz33botzhentanxueyuan0605394082129' \ +--header 'Content-Type: application/json;charset=utf-8' + +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | --------- | ----------- | +| code | int | 状态码 | +| msg | string | 状态信息 | +| data | JSONArray | 剧情点数组 | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":["10-5","33-4","56-4","10-4","33-3","56-5","10-3","33-2","56-6","10-2","33-1","10-1","33-0","10-0","7-0","7-1","10-9","7-2","79-0","56-0","10-8","7-3","56-1","10-7","7-4","33-6","56-2","10-6","7-5","33-5","56-3","7-6","21-5","44-5","67-5","21-4","44-6","67-4","21-3","44-7","21-2","44-8","21-1","44-9","21-0","44-0","44-1","21-9","67-1","44-2","21-8","67-0","44-3","21-7","67-3","21-6","44-4","67-2","32-5","78-5","55-5","32-4","78-4","55-6","32-3","55-7","32-2","55-8","32-1","32-0","6-0","6-1","6-2","55-0","6-3","55-1","38-0-2","78-1","6-4","55-2","38-0-1","78-0","6-5","55-3","32-7","78-3","6-6","32-6","78-2","55-4","6-7","6-8","13-0-1-7","13-0-1-6","13-0-1-5","13-0-1-4","20-6","43-6","66-6","20-5","43-7","66-5","20-4","20-3","66-7","20-2","13-0-1-3","20-1","13-0-1-2","20-0","13-0-1-1","13-0-1-0","43-0","66-0","43-1","43-2","66-2","43-3","66-1","43-4","66-4","43-5","66-3","54-6","31-6","77-5","31-4","77-8","31-3","77-7","31-2","31-1","77-9","31-0","5-0","5-1","54-0","77-0","54-1","5-4","54-2","77-2","5-5","54-3","77-1","5-6","54-4","77-4","5-7","54-5","13-0-1-0-0","42-7","65-7","65-6","42-0","42-1","65-1","42-2","65-0","42-3","65-3","42-4","65-2","42-5","65-5","42-6","65-4","37-0-1","76-7","76-6","30-5","30-4","30-3","30-2","30-1","4-0","30-0","4-1","4-2","53-0","53-1","76-1","4-4","53-2","76-0","4-5","53-3","76-3","4-6","53-4","76-2","4-7","53-5","76-5","4-8","76-4","41-0","64-0","41-1","41-2","64-2","41-3","64-1","41-4","48-12","64-4","41-5","48-13","64-3","48-10","48-11","64-5","3-0","0-0-0-0-0-20","3-1","3-2","52-0","75-0","3-3","52-1","52-2","75-2","3-5","52-3","75-1","3-6","52-4","75-4","52-5","75-3","52-6","52-7","75-5","51-0","13-0-1","63-9","63-8","40-1","63-1","40-2","63-0","40-3","63-3","40-4","63-2","40-5","63-5","63-4","63-7","63-6","62-0","2-0","2-1","2-2","2-3","51-1","74-1","2-4","51-2","74-0","2-5","51-3","74-3","2-6","51-4","74-2","2-7","51-5","74-5","51-6","74-4","51-7","74-6","50-0","73-0","50-1","62-2","62-1","62-4","62-3","62-6","62-5","61-1","61-0","1-0","42-0-1","1-1","42-0-0","1-2","42-0-3","1-3","42-0-2","1-4","50-2","42-0-5","73-2","1-5","50-3","42-0-4","73-1","1-6","50-4","42-0-7","73-4","1-7","50-5","42-0-6","73-3","1-8","50-6","73-6","1-9","73-5","73-7","72-1","72-0","61-3","61-2","61-5","61-4","19-9","19-8","60-0","19-7","19-6","60-2","60-1","72-3","19-3","72-2","72-5","19-1","72-4","19-0","71-0","60-4","60-3","60-6","60-5","60-7","18-6","18-5","18-4","18-2","18-1","18-0","70-1","70-0","29-7","70-3","29-6","70-2","29-5","29-4","29-3","29-2","29-1","29-0","17-7","00-00","17-6","70-5","17-5","70-4","17-4","70-7","12-0-1","17-3","70-6","17-2","17-1","17-0","28-6","28-5","28-4","28-3","28-2","28-1","28-0","16-8","39-0","16-7","16-6","16-5","16-4","16-3","16-2","16-1","16-0","27-5","27-4","27-3","27-2","27-1","27-0","75-0-1","15-0","38-0","38-1","38-2","38-3","38-4","38-5","38-6","15-7","15-6","15-5","15-4","15-3","15-2","15-1","49-8","49-0","26-0","49-1","49-2","49-3","38-0-0-1","49-4","49-5","49-6","49-7","26-8","26-7","26-6","26-5","26-4","26-3","26-2","26-1","77-10","14-1","37-1","14-0","37-2","37-3","37-4","37-5","25-0-1","14-5","14-4","14-3","14-2","37-0","48-9","48-1","25-1","48-2","25-0","48-3","48-4","45-0-1","48-5","48-6","48-7","48-8","25-7","25-6","25-5","25-4","25-3","48-0","25-2","13-2","36-1","59-1","13-1","36-0","59-2","13-0","59-3","59-4","59-5","59-6","13-8","13-7","36-6","13-6","36-5","13-5","36-4","13-4","36-3","13-3","36-2","59-0","47-2","24-2","47-3","24-1","47-4","24-0","47-5","47-6","47-7","47-8","24-6","24-5","47-0","24-4","47-1","24-3","12-3","35-2","58-2","12-2","35-1","58-3","12-1","35-0","58-4","12-0","58-5","58-6","58-7","58-8","58-9","35-9","35-8","35-7","12-7","9-0","35-6","12-6","9-1","35-5","12-5","9-2","35-4","58-0","12-4","9-3","35-3","58-1","9-4","9-5","9-6","9-7","30-0-1","46-3","23-3","69-3","46-4","23-2","69-2","46-5","23-1","69-5","23-0","69-4","23-7","46-0","23-6","46-1","23-5","69-1","46-2","23-4","69-0","11-4","34-3","57-3","34-2","57-4","11-2","34-1","57-5","11-1","34-0","57-6","11-0","57-7","8-0","8-1","11-7","8-2","34-6","57-0","11-6","8-3","34-5","57-1","11-5","8-4","34-4","57-2","8-5","8-6","8-7","45-4","22-4","68-4","45-5","22-3","68-3","45-6","22-2","68-6","45-7","22-1","68-5","45-8","22-0","45-9","45-0","68-0","45-1","22-7","45-2","22-6","68-2","45-3","22-5","68-1"]} +``` + + + +# chatruntime引擎回调接口 + +## 5.作品对话接口-引擎回调 + +**引擎调用** + +**METHOD**: POST + +**path**: /bot/dialog + +RequestHeaders: + +| key | description | +| ------------ | --------------------------------- | +| Content-Type | application/x-www-form-urlencoded | + + + +### 请求body字段说明 + +| key | type | required | description | +| ------------------ | ------ | -------- | --------------------------------------------- | +| bot_name | String | yes | botid | +| query_text | String | yes | 被处理的字符串 | +| query_pos | String | | | +| chat_key | String | yes | sessionId,必须是正在对话中的key,否则500错误 | +| action_name | String | | pivot_httppost | +| 其他好像是动态字段 | | | | + + + + + +### 请求示例 + +```json +curl --location --request POST 'http://10.0.7.5:8081/bot/dialog' \ +--header 'Content-Type: application/x-www-form-urlencoded' \ +--data-urlencode 'bot_name=txgz14bothuaxianaishangweimin353238309' \ +--data-urlencode 'action_name=pivot_httppost' \ +--data-urlencode 'chat_key=haiwaixtcrtos-watch-sdk-pro123123@@@txgz14bothuaxianaishangweimin353238309@@@@ZfqfVUBWpEc3ux6W5bH7' \ +--data-urlencode '$rule-any-keyword=unknown:unknown' \ +--data-urlencode 'query_text=1' \ +--data-urlencode 'query_pos=' + +``` + + + +### 响应字段说明 + +| key | type | description | +| -------- | ------ | --------------------------------------------- | +| status | int | 不知道其含义及取值内容 | +| solution | string | 文本结果,发给引擎的 | +| data | String | 不知道其含义及取值内容 | +| process | String | 发送给引擎用,不知什么用,固定值为any_keyword | + + + +### 响应实例 + +```json +{ + "status":0, + "solution":"【旁白@正常】留下男主甲变量我就放这里,想要的话可以自己拿。【旁白@正常】^影片的银幕上,一场感人的告别令你和留下男主甲名字变量无言以对。你瞥了一眼留下男主甲名字变量,他的目光依旧凝视着前方,脸色似乎有些苍白。突然,他转过头来,意识到你正看着他,他咳嗽了一声,尴尬地笑道。【旁白@正常】留下男主甲变量电影中的那段告别,你怎么看?►SEND_CC_DATA{\"priority\":8}SEND_CC_DATA◄", + "process":"nextStep=any_keyword" +} +``` + + + + + +## 6.意图组搜索bot对话接口-引擎回调 + +**引擎调用** + +**METHOD**: POST + +**path**: /bot/dialog/intent + +RequestHeaders: + +| key | description | +| ------------ | --------------------------------- | +| Content-Type | application/x-www-form-urlencoded | + + + +### 请求body字段说明 + +| key | type | required | description | +| ------------------ | ------ | -------- | -------------------------------- | +| bot_name | String | yes | botid | +| query_text | String | yes | 被处理的字符串 | +| query_pos | String | yes | | +| chat_key | String | yes | sessionId,必须是正在生效中的key | +| action_name | String | | | +| 其他好像是动态字段 | | | | + + + + + +### 请求示例 + +```json +curl --location --request POST 'http://10.0.7.3:8081/bot/dialog/intent' \ +--header 'Content-Type: application/x-www-form-urlencoded' \ +--data-urlencode 'bot_name=systemintentbotallv1' \ +--data-urlencode 'action_name=pivot_httppost' \ +--data-urlencode 'chat_key=haiwaixtcrtos-watch-sdk-pro123123@@@txgz14bothuaxianaishangweimin353238309@@@@ZfqfVUBWpEc3ux6W5bH7' \ +--data-urlencode '$rule-any-keyword=unknown:unknown' \ +--data-urlencode 'query_text=1' \ +--data-urlencode 'query_pos=' + +``` + + + +### 响应字段说明 + +| key | type | description | +| -------- | ------ | --------------------------------------------- | +| status | int | 不知道其含义及取值内容 | +| solution | string | 文本结果,发给引擎的 | +| data | String | 不知道其含义及取值内容 | +| process | String | 发送给引擎用,不知什么用,固定值为any_keyword | + + + + + +### 响应实例 + +```json +{"status":0,"solution":"全匹配[]","process":"nextStep=any_keywork"} +``` + + +# chatruntime分支生成接口 +## 7.意图组bot拷贝后加上词性 + +**创作平台调用** + +**METHOD**: POST + +**path**: /api/generate/custom/search/bot + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +| key | type | required | description | +| ------ | ------ | -------- | ---------------------------- | +| secret | String | yes | 固定值f1fvo0Yhw199PIHWTmCbbQ | + + + +### 请求body字段说明 + +| key | type | required | description | +| --------------- | --------- | -------- | --------------------------- | +| fuzzyBotAccount | String | yes | 要生成的目标模糊匹配bot的id | +| allBotAccount | String | yes | 要生成的目标全匹配bot的id | +| wordPosList | JSONArray | yes | 词和词性的映射 | + + + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.3:8081/api/generate/custom/search/bot?secret=f1fvo0Yhw199PIHWTmCbbQ' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "fuzzyBotAccount":"systemintentbotfuzzyv1", + "allBotAccount":"systemintentbotallv1", + "wordPosList":[] +}' + +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | --------- | ----------- | +| code | int | 固定1 | +| msg | string | 固定成功 | +| data | JSONArray | 固定null | + +只要不出错,这接口的返回值是固定的 + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":null} +``` + + + + + + + +## 8.搜索语义和意图 + +**创作平台调用,用于自动生成,超集扩展用** + +**METHOD**: POST + +**path**: /api/semantic/relation/search + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +| key | type | required | description | +| ------ | ------ | -------- | ---------------------------- | +| secret | String | yes | 固定值f1fvo0Yhw199PIHWTmCbbQ | + + + +### 请求body字段说明 + +| key | type | required | description | +| --------------- | ------------ | -------- | ---------------------------------------------------- | +| sents | List | yes | 需要查询的句子列表,虽然是列表,但只会用到第一个元素 | +| fuzzyBotAccount | String | yes | 模糊匹配所用的 bot id | +| allBotAccount | String | yes | 全匹配时候所用的 bot id | + + + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.3:8081/api/semantic/relation/search?secret=f1fvo0Yhw199PIHWTmCbbQ' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "fuzzyBotAccount":"systemintentbotfuzzyv1", + "allBotAccount":"systemintentbotallv1", + "sents":["我要去吃饭了"] +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | -------------- | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | IntentResultBO | | + +IntentResultBO的结构如下 + +| key | type | description | +| ------------------------------- | ------------------------------------- | ------------------------------------------------------------ | +| chatKey | string | | +| allMatchSet | Set | 全匹配意图名称 | +| fuzzyMatchSet | Set | 模糊匹配意图名称 | +| wscSet | Set | 词句转换集合 | +| semanticRelationName2soSet | Map> | 语义名称对应的so集合 | +| usedPhraseName2intentPhraseBO | Map | 词组名称对应意图组词组对象,意图组里的so,没包含词组,这里就空的 | +| intentName2semanticRelationInfo | Map>> | 意图组名称对应语义条件集合 | +| createTime | Long | 创建时间 | + + + +### 响应实例 + +```json +{ + "code":1, + "msg":"成功", + "data":{ + "chatKey":null, + "allMatchSet":[ + "主谓", + "我做", + "去做", + "复合动作", + "肯定同意" + ], + "fuzzyMatchSet":[ + "否定形容动作", + "两形容词", + "否定修饰语", + "某人做某事", + "两事物", + "会做某事", + "是某人", + "问某人或物或地特征", + "形容自己", + "去某地", + "我是来做某事的", + "答案是某某", + "修饰动作", + "形容人或物或地方", + "做不到", + "某时间某人为什么做某事", + "问这是某物吗", + "某时间为什么做某事", + "问某物是某某吗", + "否定形容对方", + "我是XX", + "做某事", + "同意做", + "加强形容", + "某人是XX", + "买某东西", + "形容动作", + "选择某某", + "选择性回答" + ], + "wscSet":[ + + ], + "semanticRelationName2soSet":{ + "ruleb0answerb0nn":[ + "吃:饭" + ], + "ruleb0negativeb0mood":[ + "吃:了", + "了:吃", + "要:吃", + "去:吃" + ], + "ruleb0dob0whatb0vv":[ + "吃:了", + "了:吃", + "要:吃", + "去:吃" + ], + "ruleb0answerb0isb0whatb01":[ + "要:饭", + "去:饭", + "吃:饭" + ], + "ruleb0certainb0answer":[ + "了:吃" + ], + "ruleb0dob0whatb0nv":[ + "visitor:吃", + "visitor:要", + "了:吃", + "visitor:了" + ], + "ruleb0dob0whatb0adv":[ + "了:吃" + ], + "ruleb0nn":[ + "吃:了", + "饭:了" + ], + "ruleb0answerb0isb0whatb0nnb0adjunct":[ + "visitor:吃", + "吃:了", + "饭:了", + "visitor:了" + ], + "ruleb0answerb0what":[ + "visitor:吃", + "吃:了", + "了:吃", + "饭:了", + "visitor:了", + "要:吃", + "去:吃" + ], + "ruleb0dob0whatb0vn":[ + "要:饭", + "去:饭", + "吃:饭" + ], + "ruleb0positiveb0advb0adj":[ + "吃:了", + "了:吃" + ], + "ruleb0nnb0pn":[ + "visitor:吃", + "吃:了", + "visitor:饭", + "了:吃" + ], + "ruleb0answerb0isb0whatb0vvb0adjunct":[ + "吃:了", + "了:吃", + "要:吃", + "去:吃" + ] + }, + "usedPhraseName2intentPhraseBO":{ + + }, + "intentName2semanticRelationInfo":{ + + }, + "createTime":1698399153761 + } +} +``` + + + + + +# chatruntime小说APP相关接口 + +## 9.删除chatKey存档从内存中 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: DELETE + +**path**: /bot/chatCache + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| ------- | ------ | -------- | ------------------------ | +| userKey | String | yes | chatkey组成部分的userkey | + + + +### 请求示例 + +```json +curl --location --request DELETE 'http://10.0.7.5:8081/bot/chatCache' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "userKey":"haiwaixtcrtos-watch-sdk-pro123123@@@txgz14bothuaxianaishangweimin353238309" +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | | 固定null | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":null} +``` + +## 10.保存chatKey存档到文件中 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: POST + +**path**: /bot/chatCache/save + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| --------------- | ------- | -------- | ------------------------ | +| userKey | String | yes | chatkey组成部分的userkey | +| positiveArchive | boolean | yes | 是否主动存档 | + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/bot/chatCache/save' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data-raw '{ + "userKey":"haiwaixtcrtos-watch-sdk-pro123123@@@txgz14bothuaxianaishangweimin353238309", + "positiveArchive":true +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | ------------------------------------------------------------ | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | 保存成功则对象为{"status":true},保存失败则对象为{"status":false} | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":{"status":true}} +``` + + + + + + + +## 11.查找是否有存档 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: POST + +**path**: /bot/chatCache/find + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| --------------- | ------- | -------- | ------------------------ | +| userKey | String | yes | chatkey组成部分的userkey | +| positiveArchive | boolean | yes | 是否主动存档 | + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/bot/chatCache/find' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data-raw '{ + "userKey":"haiwaixtcrtos-watch-sdk-pro123123@@@txgz14bothuaxianaishangweimin353238309", + "positiveArchive":true +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | ------------------------------------------------------------ | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | 查的到存档则对象为{"exist":true},查不到存档则对象为{"exist":false} | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":{"exist":true}} +``` + + + +## 12.初始化我的状态信息 + +**小说APP调用中控,中控调用chatruntime,删除存档** + +**METHOD**: POST + +**path**: /bot/chatCache/init + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +| key | type | required | description | +| ------ | ------ | -------- | -------------------------------- | +| secret | String | yes | 固定值:ZKO90l4N4tf0yo2oLIYLIeNf | + + + +### 请求body字段说明 + +| key | type | required | description | +| --------- | ------ | -------- | ----------- | +| channelId | String | yes | 渠道id | +| uid | String | yes | 用户id | + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/bot/chatCache/init?secret=ZKO90l4N4tf0yo2oLIYLIeNf' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "uid":"123123", + "channelId":"haiwaixtcrtos-watch-sdk-pro" +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | null | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":null} +``` + + + +## 13.检测并获取控制点相关信息 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: POST + +**path**: /api/controlNodePay/check + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| ---------- | ------ | -------- | ----------- | +| channelId | String | yes | 渠道id | +| userId | String | yes | 用户id | +| controlId | String | yes | 控制点id | +| botAccount | String | yes | botid | +| botName | String | yes | botname | + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/api/controlNodePay/check' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "channelId":"hwzcnanyouxiaomi-phone-sdk-pro", + "userId":"123123", + "controlId":"wodenver1", + "botAccount":"txgz12botwoshinvernu1102586868845", + "botName":"我是女儿奴" +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | null | + + + +### 响应实例 + +```json + +``` + + + + + +## 14.设备绑定存档迁移 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: POST + +**path**: /api/device/bind/user + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| --------- | ------ | -------- | ----------- | +| channelId | String | yes | 渠道id | +| userId | String | yes | 用户id | +| oldUserId | String | yes | 老用户id | + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/api/device/bind/user' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "oldUserId":"avasdf", + "userId":"123123", + "channelId":"haiwaixtcrtos-watch-sdk-pro" +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | null | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":null} +``` + + + + + +## 15.获取多个全局变量的内容 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: GET + +**path**: /user/var + +RequestHeaders: + +| key | description | +| -------------- | ------------------------------------------------------------ | +| Content-Type | application/json;charset=utf-8 | +| Authorization | String secret = "wXD7PjkMqW";String originStr = secret+"@"+timestampStr; String authorization = DigestUtils.md5Hex(originStr.getBytes()); | +| App-Channel-Id | 渠道id | +| timestamp | 加密用的,参考Authorization | + + + +### 请求param字段说明 + +| key | type | required | description | +| ---------- | ------ | -------- | ------------------------- | +| botAccount | String | yes | botId | +| userId | String | yes | 用户id | +| varNames | String | yes | 变量列表,用半角逗号,分隔 | + + + +### 请求body字段说明 + +无 + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/user/var?botAccount=txgz14bothuaxianaishangweimin353238309&userId=123123&varNames=%E5%9B%AD%E4%B8%81%E5%A7%93%E5%90%8D%2C%E6%8F%90%E4%BA%A4%E8%A1%A8%E5%8D%95%E5%9C%B0%E5%9D%80' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--header 'Authorization: 1699006867290' \ +--header 'App-Channel-Id: haiwaixtcrtos-watch-sdk-pro' \ +--header 'timestamp: b3855338cb358ef63abcabf9968029e6' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | null | + + + +### 响应实例 + +```json + +``` + + + + + +## 16.获取用户全局变量 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: POST + +**path**: /user/var/gb/get + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| --------- | --------- | -------- | ------------ | +| channelId | String | yes | 渠道ID | +| uid | String | yes | 用户id | +| varSet | JSONArray | yes | 变量对象列表 | + + + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/user/var/gb/get' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "uid": 123123, + "channelId": "haiwaixtcrtos-watch-sdk-pro", + "varSet": [ + {"varName":"新手引导详细步骤2"}, + {"varName":"新手引导详细步骤3"}, + {"varName":"园丁性别"} + ] +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | object | 变量对象查询结果列表 | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":[{"varName":"新手引导详细步骤2","varValue":""},{"varName":"新手引导详细步骤3","varValue":""},{"varName":"园丁性别","varValue":""}]} +``` + + + + + +## 17.更新用户全局变量 + +**小说APP调用中控,中控调用chatruntime** + +**METHOD**: POST + +**path**: /user/var/gb/put + +RequestHeaders: + +| key | description | +| ------------ | ------------------------------ | +| Content-Type | application/json;charset=utf-8 | + + + +### 请求param字段说明 + +无 + + + +### 请求body字段说明 + +| key | type | required | description | +| --------- | --------- | -------- | ------------ | +| channelId | String | yes | 渠道ID | +| uid | String | yes | 用户id | +| varSet | JSONArray | yes | 变量对象列表 | + + + + + +### 请求示例 + +```json +curl --location 'http://10.0.7.5:8081/user/var/gb/put' \ +--header 'Content-Type: application/json;charset=utf-8' \ +--data '{ + "uid": 123123, + "channelId": "haiwaixtcrtos-watch-sdk-pro", + "varSet": [ + {"varName":"新手引导详细步骤2","varValue":"值2"}, + {"varName":"新手引导详细步骤3","varValue":"值3"}, + {"varName":"园丁性别","varValue":"女"} + ] +}' +``` + + + +### 响应字段说明 + +| key | type | description | +| ---- | ------ | -------------------- | +| code | int | 只要不出错,固定1 | +| msg | string | 只要不出错,固定成功 | +| data | | null | + + + +### 响应实例 + +```json +{"code":1,"msg":"成功","data":null} +``` + + + + + + + + + + + -- libgit2 0.27.1