【发布时间】:2018-09-12 13:39:55
【问题描述】:
背景:我正在研究一种抽认卡技能,该技能使 Alexa 能够询问有关编程语言的基本问题。用户可以在 Ruby、Python 或 JS 之间进行选择。
进展:
-
LaunchRequest欢迎用户,然后询问他们的语言偏好 - 用户响应,导致
SetLanguageIntent触发 - 然后向用户提出问题
但是,我无法通过SetLanguageIntent 而不遇到“请求的技能响应有问题”。
从响应中可以看出,SetLanguageIntent 已正确激活,插槽 ruby 也正确匹配。
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.743f750e-96d9-4ef9-aeba-e0aec2e45afb",
"timestamp": "2018-09-12T13:35:25Z",
"locale": "en-US",
"intent": {
"name": "SetMyLanguageIntent",
"confirmationStatus": "NONE",
"slots": {
"language": {
"name": "language",
"value": "ruby",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.ee34487d-d343-4deb-ab6c-193777c92aa8.languages",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "ruby",
"id": "58e53d1324eef6265fdb97b08ed9aadf"
}
}
]
}
]
},
"confirmationStatus": "NONE"
}
}
}
但是,此时总是出现错误消息“请求的技能响应有问题”。 CloudWatch Logs 上没有报告错误。
作为参考,这里是SetLanguageIntent 代码。如评论中所述,至少应该说测试“好的”。但是,它不会被执行。
'SetMyLanguageIntent': function() {
this.response.speak('Okay'); //this should at least have been said
this.attributes.flashcards.currentLanguage = this.event.request.intent.slots.languages.value;
var currentLanguage = this.attributes.flashcards.currentLanguage
this.response
.speak('Okay, I will ask you some questions about ' +
currentLanguage + '. Here is your first question. ' +
AskQuestion(this.attributes))
.listen(AskQuestion(this.attributes));
this.emit(':responseReady');
},
非常感谢任何帮助!
编辑:使用插槽名称更新
【问题讨论】:
-
能否记录下生成的响应 JSON 并分享一下
-
@CicilThomas 感谢您的评论。不幸的是,JSON 输出只是“空”
-
这个函数是做什么的 AskQuestion(this.attributes))
标签: alexa alexa-skills-kit alexa-slot