作者:重庆互联网小徐 发布时间:2024-11-06 浏览:19935 赞(1950) 收藏 评论(0)
请求参数:
{ "query":"北京今天适合运动吗", "date":{ "type":"datetime_point", "text":"今天", "date":"2019-12-03" }, "loc":{ "city":"北京市", "town":"北京市", "loc_ori":"北京" }, "请求接口基础参数":{xxxxx} // 详见**请求接口基础参数说明**章节 }
注意:回复的TTS第一句为 指数信息,这个是根据query中的关键字进行判断的,也可以带在参数的intention字段中。 支持的关键字和对应的intention为:
if strings.Contains(req.Query, "污染") { req.Intention = "空气污染扩散指数" } else if strings.Contains(req.Query, "紫外线") { req.Intention = "紫外线指数" } else if strings.Contains(req.Query, "感冒") { req.Intention = "感冒指数" } else if strings.Contains(req.Query, "穿衣") { req.Intention = "穿衣指数" } else if strings.Contains(req.Query, "运动") { req.Intention = "运动指数" } else if strings.Contains(req.Query, "交通") { req.Intention = "交通指数" } else if strings.Contains(req.Query, "息斯敏过敏") { req.Intention = "息斯敏过敏指数" } else if strings.Contains(req.Query, "旅游") { req.Intention = "旅游指数" } else if strings.Contains(req.Query, "洗车") { req.Intention = "洗车指数" } else if strings.Contains(req.Query, "钓鱼") { req.Intention = "钓鱼指数" } else if strings.Contains(req.Query, "化妆") { req.Intention = "化妆指数" } else if strings.Contains(req.Query, "放风筝") { req.Intention = "放风筝指数" } else if strings.Contains(req.Query, "心情") { req.Intention = "心情指数" } else if strings.Contains(req.Query, "晨练") { req.Intention = "晨练指数" } else if strings.Contains(req.Query, "逛街") { req.Intention = "逛街指数" } else if strings.Contains(req.Query, "美发") { req.Intention = "美发指数" } else if strings.Contains(req.Query, "感冒") { req.Intention = "感冒指数" } else if strings.Contains(req.Query, "空调") { req.Intention = "空调开指数" } else if strings.Contains(req.Query, "约会") { req.Intention = "约会指数" } else if strings.Contains(req.Query, "舒适度") { req.Intention = "舒适度指数" } else if strings.Contains(req.Query, "划船") { req.Intention = "划船指数" } else if strings.Contains(req.Query, "雨伞") { req.Intention = "雨伞指数" } else if strings.Contains(req.Query, "风寒") { req.Intention = "风寒指数" } else if strings.Contains(req.Query, "夜生活") { req.Intention = "夜生活指数" } else if strings.Contains(req.Query, "路况") { req.Intention = "路况指数" } else if strings.Contains(req.Query, "防晒") { req.Intention = "防晒指数" } else if strings.Contains(req.Query, "啤酒") { req.Intention = "啤酒指数" } else if strings.Contains(req.Query, "晾晒") { req.Intention = "晾晒指数" } else if strings.Contains(req.Query, "中暑") { req.Intention = "中暑指数" }
部分指数不一定有对应的TTS数据返回,都是正常的。
返回结果:
{ "code": 0, "msg": "成功", "request_id": "test_Random", "tts": "气温过低,特别容易着凉感冒,较不适宜户外运动,建议室内运动。北京今天晴,温度-3度到8度,当前温度6度,空气质量优,天冷了,该加衣服了!" }
如果不询问当天的,可能会返回如下结果:
{ "code": 0, "msg": "成功", "tts": "抱歉,暂时只能查到今天的指数信息,北京明天晴,温度-4度到9度,空气质量良" }
重庆互联网项目从2004年开始为各行各业提供互联网发展解决方案,专业从事网站、小程序、微信公众号、APP、电商平台、系统等互联网平台开发,帮助企业实现从传统行业到互联网的完美转型。截止目前,重庆互联网合作的企业遍布全国各地,20年的开发经验和完善的售后服务体系获得合作客户的高度认可!
关注重庆互联网官方公众号,即可获取粉丝专享福利!
欢迎广大用户为此页面进行评价,评价成功将获得积分奖励!