ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
### 3.2.9 阿拉丁学诗词 #### (1)功能说明 阿拉丁学古诗,陪伴小朋友一起学习精选的300首经典古诗词!通过智能对话“听、读、对、唱”,每天一首古诗词,让你轻松掌握,做古诗词小达人! #### (2)接口说明 **请求方法** * POST **请求地址** * http://api.ruyi.ai/v1/message **请求参数说明** |参数名 |参数类型 | 是否必须 |参数说明 | :-----| :---| :---:|:----- |q |String| 是| 自然语言表达,例如“阿拉丁学诗词”等 |app_key| String|是 |应用开发者秘钥,注册开发者后台账号,建立虚拟助理后获得 |user_id |String| 是 |用户唯一标识,便于支持个性化语义解析。建议开发者使用 UUID 字符,且不同用户必须用不同的 user_id,防止意图串。 #### (3)返回说明 **返回参数说明** |名称 |类型| 说明 |:---|:---|:--- |code |Integer | 返回代码 |msg | String |返回代码描述 |parameters|JSON Object |解析到的实体以及服务说明 |action|String|服务的接口名称 |name| String|匹配的意图名称 |result | JSON Object| 接口返回内容 |outputs| Array| 服务输出结果,微信端使用 type 类型为 wechat 开头的内容;硬件端收到所有内容,依据需求解析使用 **返回代码说明** |返回代码 |错误类型|说明 |:---|:---|:--- |0/200 |成功 |请求成功 |400 |无效请求 |某些必需参数缺失或参数值错误,详见msg字段 |401 |未授权 |授权失败,app_key缺失或错误 |403 |请求被禁止|有效请求,但服务拒绝响应,请联系contact@ruyi.ai |408 |请求超时 |请求响应超时,一般响应时间设置为2000ms以内 |429 |短时间内大量访问 |短时间内请求数过多 |500 |内部错误 |服务处理异常 |503 |服务不可用|服务异常或正在维护 #### (4)请求示例 **请求范例** 打开阿拉丁学诗词 好了 长干二首之一(正确跟读) 退出 **请求示例正确** http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=长干行二首之一 (正确跟读) 返回结果 ```json {"code": 0, "msg": "ok", "result"{    "_text": "长干行二首之一",    "msg_id": "1ac8ef89-001f-4349-8e04-1731ba805c80",    "intents": [        {            "parameters": {                "speak": "长干行二首之一",                "service": "aladingxueshici"            },            "action": "拉丁学诗词(新)",            "name": "阿拉丁-进入-古代诗(新)",            "result": {                     "robot_output": " 请跟我读:君家何处"                     "text": " 请跟我读:君家何处",                     "type": "dialog"            },            "outputs": [                {                    "type": "wechat.text",                    "property": {                        "text": " 请跟我读:君家何处"                    }                },                {                    "type": "dialog",                    "property": {                        "text": " 请跟我读:君家何处",                        "emotion": "calm"                    }                }            ],            "score": "1.0",            "scoreColor": "c4",            "is_match": 1,            "skill_id": "f99f9889-a313-4950-b2fe-3574d6bdf579",            "id": "2ec32459-6aa5-4122-90a3-7c1e101db8a4"        }    ],    "meta_process_milliseconds": 402 } ``` **请求示例退出** http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=退出 (退出游戏) 返回结果 ```json {"code": 0, "msg": "ok", "result"{    "\_text": "退出",    "msg\_id": "2cf51c9c-d655-484d-88a7-495a7deacf77",    "intents": \[        {            "parameters": {                "any1": "",                "service": "aladingxueshici"            },            "name": "退出如意技能",            "result": {                "text": "已为您退出“阿拉丁古诗词”",                "type": "dialog"            },            "outputs": \[                {                    "type": "wechat.text",                    "property": {                        "text": "已为您退出“阿拉丁古诗词”"                    }                },                {                    "type": "dialog",                    "property": {                        "text": "已为您退出“阿拉丁学诗词”",                        "emotion": "calm"                    }                }            \],            "score": "1.0",            "scoreColor": "c4",            "is\_match": 1,            "skill\_id": "f99f9889-a313-4950-b2fe-3574d6bdf579",            "id": "544e9ea0-d3d8-47c9-b70a-0ebafb6391d9",            "action": "dialog"        }    \],    "meta\_process\_milliseconds": 57 } ``` **详细参数说明** |名称|类型|说明| |:---|:---|:--- |service | String |服务名称 |speak|String|用户回答跟读内容 |robot_output | String | 机器返回内容(让用户跟读的内容) **指令清单** |指令名称|范例| |:---|:--- |唤醒 | 打开阿拉丁学诗词 |跟读| 长干二首之一 |退出 | 退出