Bra*_*nch 6 alexa node.js alexa-skills-kit
我的AMAZON.StopIntent搞砸了.无论我放在那里(我已经尝试了每个教程中的所有内容),无论何时调用,我都会得到"所请求技能的响应存在问题",并且Alexa应用程序将错误显示为"speechletresponse不能为空".我的项目是JSON,而不是Java格式.
如果有人可以提供帮助,我将非常感激!
谢谢!
根据要求,这是发送给Lambda的内容
{
"session": {
"sessionId": "SessionId.XXXXX",
"application": {
"applicationId": "amzn1.ask.skill.XXXXXXX"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.XXXXXXX"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.XXXXXX",
"locale": "en-US",
"timestamp": "2017-01-18T22:38:53Z",
"intent": {
"name": "AMAZON.StopIntent",
"slots": {}
}
},
"version": "1.0"
}
Run Code Online (Sandbox Code Playgroud)
以下是相关代码:
var handlers = {
'LaunchRequest': function () {
this.emit('AMAZON.HelpIntent');
},
'GetNewDogThoughtIntent': function () {
this.emit('GetDogThought');
},
'GetNewCatThoughtIntent': function () {
this.emit('GetCatThought');
},
'GetDogThought': function () {
var dogthoughtIndex = Math.floor(Math.random() * DOGTHOUGHTS.length);
var randomDogThought = DOGTHOUGHTS[dogthoughtIndex];
// Create speech output
var speechOutput = "Your dog is thinking, " + randomDogThought;
this.emit(':tellWithCard', speechOutput, "Your dog was thinking... ", randomDogThought);
},
'GetCatThought': function () {
var catthoughtIndex = Math.floor(Math.random() * CATTHOUGHTS.length);
var randomCatThought = CATTHOUGHTS[catthoughtIndex];
// Create speech output
var speechOutput = "Your cat is thinking, " + randomCatThought;
this.emit(':tellWithCard', speechOutput, "Your cat was thinking... ", randomCatThought);
},
'AMAZON.HelpIntent': function () {
var speechOutput = "You can ask me for what your cat or dog is thinking, or you can say exit... Right now I can only provide thoughts for one cat or dog at a time... What can I help you with?";
var reprompt = "What can I help you with? Make sure to say if your pet is a cat or dog when you ask!";
this.emit(':ask', speechOutput, reprompt);
},
'SessionEndedRequest': function (sessionEndedRequest, session) {
},
"AMAZON.StopIntent": function (shouldEndSession) {
}
Run Code Online (Sandbox Code Playgroud)
在再次查阅 SpaceGeek 教程并对其进行一些调整后,我终于得到了它。基本上,这是有效的:
'AMAZON.StopIntent': function () {
this.emit(':tell', "Goodbye!");
}
Run Code Online (Sandbox Code Playgroud)
关键是':tell'
我以前没有的。感谢所有回答和帮助的人!
归档时间: |
|
查看次数: |
4189 次 |
最近记录: |