AIControl接口
http://iotd.cleartv.cn/iotd_backend/AIControl
[TOC]
语义解析
- Url: http://iotd.cleartv.cn/iotd_backend/AIControl
- Request:POST
请求参数 | 类型 | 必须 | 说明 |
---|---|---|---|
userToken | String | 是 | 用户登录后获取到的token |
action | String | 是 | 操作类型,目前只有 text |
content | Object | 是 | 具体内容,当action为text时content里只需要text字段 |
- Response
参数 | 类型 | 必须 | 说明 |
---|---|---|---|
rescode | String | 是 | 应答码 |
errInfo | String | 是 | 错误信息 |
data | Object | 是 | 具体内容 |
data参数 | 类型 | 必须 | 说明 |
---|---|---|---|
userToken | String | 是 | 用户登录后获取到的token |
action | String | 是 | 操作类型,目前只有 text |
content | Object | 是 | 具体内容,当action为text时content里只需要text字段 |
content参数 | 类型 | 必须 | 说明 |
---|---|---|---|
text | String | 是 | 用户的输入,可能和请求中的原始text不完全一致,因服务器可能会对text进行语言纠错 |
service | String | 是 | 服务类型,当service是REMOTE.RoomControl时为客控,这里服务器直接处理,不用客户端处理 |
semantic | List | 是 | 本次语义,一般不用客户端处理,内容我就不介绍了 |
answer | Object | 否 | 返回的结果,用于直接展示给用户看 |
data | Object | 否 | 具体结果详细内容 |
moreResults | List | 否 | 其它结果,一般也不用处理,但有时会有用,例如查询航班时这里会返回火车信息 |
service | 说明 |
---|---|
REMOTE.RoomControl | 客房控制 |
REMOTE.TVControl | 电视控制 |
weather | 天气查询 |
flight | 航班查询 |
train | 火车查询 |
... | ... |
answer参数 | 类型 | 必须 | 说明 |
---|---|---|---|
text | String | 否 | 返回的文本,可以直接展示给用户 |
action | String | 否 | 电视控制的返回类型,目前只在service是REMOTE.TVControl存在 |
channelIndex | int | 否 | action为playLive时存在,频道列表的index |
channelName | String | 否 | action为playLive时存在,频道列表的名称 |
movieName | String | 否 | action为playMovie时存在,电影名称 |
year | String | 否 | action为playMovie时存在,电影年份(待完善) |
location | String | 否 | action为playMovie时存在,电影地区(待完善) |
action | 说明 |
---|---|
playLive | 播放直播 |
playMovie | 播放电影 |
keyEvent | 按键事件 |
- ResCode
rescode | 说明 |
---|---|
200 | 处理成功 |
401 | 没有匹配的应答,语义没解析出来 |
402 | 没有可操作的设备,房间没找到可以控制的设备 |
403 | 超出空调温控范围 |
500 | 语义解析失败,讯飞那边返回错误 |
示例:
1、客房控制
- post
{
"userToken":"hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"action":"text",
"content":{
"text":"请把把空调打开到25度"
}
}
- response
{
"data": {
"action": "text",
"userToken": "hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"content": {
"semantic": [
{
"intent": "airCondition",
"slots": [
{
"normValue": "请",
"begin": 0,
"end": 1,
"name": "ActionPrefix",
"value": "请"
},
{
"normValue": "open",
"begin": 5,
"end": 7,
"name": "action",
"value": "打开"
},
{
"normValue": "25",
"begin": 8,
"end": 10,
"name": "number",
"value": "25"
}
],
"score": 0.9784394502639772,
"entrypoint": "ent",
"template": "{ActionPrefix}把空调{action}到{number}度"
}
],
"service": "REMOTE.RoomControl",
"text": "请把把空调打开到25度",
"moreResults": [
{
"data": null,
"semantic": [
{
"intent": "airCondition",
"slots": [
{
"normValue": "请",
"begin": 0,
"end": 1,
"name": "ActionPrefix",
"value": "请"
},
{
"normValue": "open",
"begin": 6,
"end": 7,
"name": "action",
"value": "开"
},
{
"normValue": "25",
"begin": 8,
"end": 10,
"name": "number",
"value": "25"
}
],
"score": 0.9473228454589844,
"entrypoint": "ent",
"template": "{ActionPrefix}把空调{action}到{number}度"
}
],
"service": "REMOTE.RoomControl",
"text": "请把把空调打开到25度"
}
],
"answer": null,
"data": null
}
},
"errInfo": "None",
"rescode": "200"
}
2、电视控制
- post
{
"userToken":"hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"action":"text",
"content":{
"text":"请把把空调打开到25度"
}
}
{
"data": {
"action": "text",
"userToken": "hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"content": {
"answer": {
"action": "playMovie",
"movieName": "加勒比海盗"
},
"text": "我要看加勒比海盗",
"semantic": [
{
"hazard": false,
"score": 1,
"intent": "playMovie",
"template": "我要看{movieName}",
"entrypoint": "ent",
"slots": [
{
"normValue": "加勒比海盗",
"begin": 3,
"end": 8,
"name": "movieName",
"value": "加勒比海盗"
}
]
}
],
"service": "REMOTE.TVControl",
"data": null
}
},
"errInfo": "None",
"rescode": "200"
}
3、天气查询
- post
{
"userToken":"hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"action":"text",
"content":{
"text":"今天上海天气怎么样"
}
}
- response
{
"data": {
"action": "text",
"userToken": "hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"content": {
"answer": {
"text": "今天上海全天晴转阴,气温28℃ ~ 36℃,空气质量优,有东风微风,酷热难耐,请做好防暑降温的工作。"
},
"text": "今天上海天气怎么样",
"semantic": [
{
"slots": [
{
"normValue": "{\"datetime\":\"2018-08-10\",\"suggestDatetime\":\"2018-08-10\"}",
"name": "datetime",
"value": "今天"
},
{
"normValue": "上海市",
"name": "location.city",
"value": "上海市"
},
{
"normValue": "上海",
"name": "location.cityAddr",
"value": "上海"
},
{
"normValue": "LOC_BASIC",
"name": "location.type",
"value": "LOC_BASIC"
},
{
"name": "queryType",
"value": "内容"
},
{
"name": "subfocus",
"value": "天气状态"
}
],
"intent": "QUERY"
}
],
"service": "weather",
"data": {
"result": [
{
"lastUpdateTime": "2018-08-10 08:00",
"tempHigh": "36℃",
"weather": "晴转阴",
"date_for_voice": "今天",
"airQuality": "优",
"city": "上海",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/00.png",
"tempRange": "28℃ ~ 36℃",
"windLevel": 0,
"pm25": "34",
"week": "周五",
"tempLow": "28℃",
"exp": {
"fs": {
"expName": "防晒指数",
"prompt": "属强紫外辐射天气,外出时应加强防护,建议涂擦SPF在15-20之间,PA++的防晒护肤品。",
"level": "强"
},
"co": {
"expName": "舒适度指数",
"prompt": "白天天气晴好,但烈日炎炎会使您会感到很热,很不舒适。",
"level": "很不舒适"
},
"cl": {
"expName": "晨练指数",
"prompt": "早晨气象条件较适宜晨练,但晨练时会感觉有点凉,建议晨练着装不要过于单薄,以防感冒。",
"level": "较适宜"
},
"xc": {
"expName": "洗车指数",
"prompt": "较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。",
"level": "较适宜"
},
"uv": {
"expName": "紫外线强度指数",
"prompt": "紫外线辐射强,建议涂擦SPF20左右、PA++的防晒护肤品。避免在10点至14点暴露于日光下。",
"level": "强"
},
"tr": {
"expName": "旅游指数",
"prompt": "天气较好,同时又有微风伴您一路同行,但是比较热,外出旅游请注意防晒,并注意防暑降温。",
"level": "一般"
},
"yd": {
"expName": "运动指数",
"prompt": "天气较好,户外运动请注意防晒。推荐您进行室内运动。",
"level": "较适宜"
},
"dy": {
"expName": "钓鱼指数",
"prompt": "天气太热,不适合垂钓。",
"level": "不宜"
},
"gm": {
"expName": "感冒指数",
"prompt": "各项气象条件适宜,发生感冒机率较低。但请避免长期处于空调房间中,以防感冒。",
"level": "少发"
},
"gj": {
"expName": "逛街指数",
"prompt": "天气炎热,较不适宜逛街,若坚持出门,请避免长时间在阳光下暴晒,注意防暑降温。",
"level": "较不宜"
},
"ct": {
"expName": "穿衣指数",
"prompt": "天气炎热,建议着短衫、短裙、短裤、薄型T恤衫等清凉夏季服装。",
"level": "炎热"
}
},
"date": "2018-08-10",
"weatherDescription": "酷热难耐,请做好防暑降温的工作。",
"airData": 50,
"temp": 34,
"humidity": "48%",
"weatherDescription7": "27℃到36℃,明天到16号有雨,风不大,气温较高,请尽量避免午后高温时段的户外活动。",
"warning": "",
"wind": "东风微风",
"weatherDescription3": "27℃到36℃,明天、后天有雨,风不大,气温较高,请尽量避免午后高温时段的户外活动。",
"weatherType": 0,
"dateLong": 1533830400
},
{
"weatherDescription": "酷热难耐,请做好防暑降温的工作。",
"city": "上海",
"tempLow": "28℃",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/07.png",
"lastUpdateTime": "2018-08-10 08:00",
"tempRange": "28℃ ~ 35℃",
"tempHigh": "35℃",
"windLevel": 0,
"weather": "小雨",
"week": "周六",
"wind": "东北风微风",
"weatherType": 7,
"date": "2018-08-11",
"date_for_voice": "明天",
"dateLong": 1533916800
},
{
"weatherDescription": "气温较高,请尽量避免午后高温时段的户外活动。",
"city": "上海",
"tempLow": "27℃",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/08.png",
"lastUpdateTime": "2018-08-10 08:00",
"tempRange": "27℃ ~ 32℃",
"tempHigh": "32℃",
"windLevel": 0,
"weather": "中雨转阴",
"week": "周日",
"wind": "北风微风",
"weatherType": 8,
"date": "2018-08-12",
"date_for_voice": "后天",
"dateLong": 1534003200
},
{
"weatherDescription": "气温较高,请尽量避免午后高温时段的户外活动。",
"city": "上海",
"tempLow": "28℃",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/07.png",
"lastUpdateTime": "2018-08-10 08:00",
"tempRange": "28℃ ~ 34℃",
"tempHigh": "34℃",
"windLevel": 0,
"weather": "小雨转晴",
"week": "下周一",
"wind": "东南风微风",
"weatherType": 7,
"date": "2018-08-13",
"date_for_voice": "13号",
"dateLong": 1534089600
},
{
"weatherDescription": "气温较高,请尽量避免午后高温时段的户外活动。",
"city": "上海",
"tempLow": "28℃",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/07.png",
"lastUpdateTime": "2018-08-10 08:00",
"tempRange": "28℃ ~ 34℃",
"tempHigh": "34℃",
"windLevel": 0,
"weather": "小雨",
"week": "下周二",
"wind": "东南风微风",
"weatherType": 7,
"date": "2018-08-14",
"date_for_voice": "14号",
"dateLong": 1534176000
},
{
"weatherDescription": "气温较高,请尽量避免午后高温时段的户外活动。",
"city": "上海",
"tempLow": "28℃",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/07.png",
"lastUpdateTime": "2018-08-10 08:00",
"tempRange": "28℃ ~ 34℃",
"tempHigh": "34℃",
"windLevel": 1,
"weather": "小雨",
"week": "下周三",
"wind": "东南风3-4级",
"weatherType": 7,
"date": "2018-08-15",
"date_for_voice": "15号",
"dateLong": 1534262400
},
{
"weatherDescription": "气温较高,请尽量避免午后高温时段的户外活动。",
"city": "上海",
"tempLow": "27℃",
"img": "http://aiui-res.ufile.ucloud.com.cn/weather/07.png",
"lastUpdateTime": "2018-08-10 08:00",
"tempRange": "27℃ ~ 34℃",
"tempHigh": "34℃",
"windLevel": 2,
"weather": "小雨",
"week": "下周四",
"wind": "东南风4-5级",
"weatherType": 7,
"date": "2018-08-16",
"date_for_voice": "16号",
"dateLong": 1534348800
}
]
}
}
},
"errInfo": "None",
"rescode": "200"
}
4、交通查询
- post
{
"userToken":"hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"action":"text",
"content":{
"text":"帮我查一下明天上海到北京的飞机"
}
}
- response
{
"data": {
"action": "text",
"userToken": "hbjuotz0yz7ngi6h2fgekowdbhknyaan",
"content": {
"semantic": [
{
"slots": [
{
"normValue": "北京市",
"name": "endLoc.city",
"value": "北京市"
},
{
"normValue": "北京",
"name": "endLoc.cityAddr",
"value": "北京"
},
{
"normValue": "LOC_BASIC",
"name": "endLoc.type",
"value": "LOC_BASIC"
},
{
"normValue": "{\"datetime\":\"2018-08-11\",\"suggestDatetime\":\"2018-08-11\"}",
"name": "startDate",
"value": "明天"
},
{
"normValue": "上海市",
"name": "startLoc.city",
"value": "上海市"
},
{
"normValue": "上海",
"name": "startLoc.cityAddr",
"value": "上海"
},
{
"normValue": "LOC_BASIC",
"name": "startLoc.type",
"value": "LOC_BASIC"
}
],
"intent": "QUERY"
}
],
"service": "flight",
"text": "帮我查一下明天上海到北京的飞机",
"moreResults": [
{
"data": {
"result": [
{
"terminalStation": "北京南",
"endtime_for_voice": "明天13:33",
"originStation": "上海虹桥",
"price": [
{
"name": "二等座",
"value": "553"
},
{
"name": "一等座",
"value": "933"
},
{
"name": "商务座",
"value": "1748"
}
],
"starttime_for_voice": "明天08:00",
"trainNo": "G12",
"starttimestamp": 1533945600,
"startTimeStamp": "1533945600",
"startTime": "2018-08-11 08:00",
"arrivalTime": "2018-08-11 13:33",
"runTime": "5时33分",
"trainType": "高铁",
"endtimestamp": 1533965580
},
{
"terminalStation": "北京南",
"endtime_for_voice": "明天12:28",
"originStation": "上海虹桥",
"price": [
{
"name": "二等座",
"value": "553"
},
{
"name": "一等座",
"value": "933"
},
{
"name": "商务座",
"value": "1748"
}
],
"starttime_for_voice": "明天06:50",
"trainNo": "G104",
"starttimestamp": 1533941400,
"startTimeStamp": "1533941400",
"startTime": "2018-08-11 06:50",
"arrivalTime": "2018-08-11 12:28",
"runTime": "5时38分",
"trainType": "高铁",
"endtimestamp": 1533961680
},
{
"terminalStation": "北京南",
"endtime_for_voice": "2018年08月12号08:55",
"originStation": "上海",
"price": [
{
"name": "二等座",
"value": "336"
},
{
"name": "软卧",
"value": "730"
}
],
"starttime_for_voice": "明天21:08",
"trainNo": "D314",
"starttimestamp": 1533992880,
"startTimeStamp": "1533992880",
"startTime": "2018-08-11 21:08",
"arrivalTime": "2018-08-12 08:55",
"runTime": "11时47分",
"trainType": "动车",
"endtimestamp": 1534035300
}
]
},
"semantic": [
{
"slots": [
{
"normValue": "北京市",
"name": "endLoc.city",
"value": "北京市"
},
{
"normValue": "北京",
"name": "endLoc.cityAddr",
"value": "北京"
},
{
"normValue": "LOC_BASIC",
"name": "endLoc.type",
"value": "LOC_BASIC"
},
{
"normValue": "{\"datetime\":\"2018-08-11\",\"suggestDatetime\":\"2018-08-11\"}",
"name": "startDate",
"value": "明天"
},
{
"normValue": "上海市",
"name": "startLoc.city",
"value": "上海市"
},
{
"normValue": "上海",
"name": "startLoc.cityAddr",
"value": "上海"
},
{
"normValue": "LOC_BASIC",
"name": "startLoc.type",
"value": "LOC_BASIC"
}
],
"intent": "QUERY"
}
],
"service": "train",
"text": "帮我查一下明天上海到北京的飞机"
}
],
"answer": {
"text": "[n2]为您找到303个班次,推荐明天08:00:00从上海出发,明天10:15:00到达北京的[n1][h1]CZ9234的经济舱[h0][n0],价格是[h2]1360元[h0]"
},
"data": {
"webpage": "http://athena.openspeech.cn/athena/gray?method=webpage&wsid=524b0fe9d49d3b2db10b4b9e62372c4e&sid=atn0041c3e4@dx00070ec84f04a11001",
"result": [
{
"takeOffTimeStamp": "1533945600",
"aPort": "首都国际机场",
"standardPrice": "1360",
"flight": "CZ9234",
"endtime_for_voice": "明天10:15:00",
"departCity": "上海",
"arriveTime": "2018-08-11 10:15:00",
"price": "1360",
"starttime_for_voice": "明天08:00:00",
"rate": "1",
"takeOffTime": "2018-08-11 08:00:00",
"dPort": "虹桥国际机场",
"arriveCity": "北京",
"airline": "中国南方航空股份有限公司",
"starttimestamp": 1533945600,
"arriveTimeStamp": "1533953700",
"cabinInfo": "经济舱",
"endtimestamp": 1533953700,
"quantity": "10"
},
{
"takeOffTimeStamp": "1533945600",
"aPort": "首都国际机场",
"standardPrice": "1360",
"flight": "MU5101",
"endtime_for_voice": "明天10:15:00",
"departCity": "上海",
"arriveTime": "2018-08-11 10:15:00",
"price": "1170",
"starttime_for_voice": "明天08:00:00",
"rate": "0.86",
"takeOffTime": "2018-08-11 08:00:00",
"dPort": "虹桥国际机场",
"arriveCity": "北京",
"airline": "中国东方航空股份有限公司",
"starttimestamp": 1533945600,
"arriveTimeStamp": "1533953700",
"cabinInfo": "经济舱",
"endtimestamp": 1533953700,
"quantity": "10"
}
]
}
}
},
"errInfo": "None",
"rescode": "200"
}