【发布时间】:2017-11-05 17:01:43
【问题描述】:
我的技能因错误“请求的技能响应出现问题”而超时。
如果用户在初始提示和重新提示中都没有说任何内容,我会尝试静默结束会话。
目前,如果用户第一次什么都没说,它会重新提示。
如果他们在重新提示后什么也没说,Alexa 会显示错误消息:“请求的技能响应有问题。”
Lambda 函数:
'use strict';
const Alexa = require('alexa-sdk');
const APP_ID = undefined;
const handlers = {
'LaunchRequest': function () {
const launchMsg = "How can I help you?";
const reprompt = "You can say, give me the weather.";
this.response.speak( launchMsg )
.listen( reprompt );
// errors out here on .listen if no input
this.emit(':responseReady');
},
'WeatherIntent': function () {
this.response.speak( 'It is 100 degrees Kelvin' )
this.emit(':responseReady');
}
}
exports.handler = function (event, context, callback) {
const alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
alexa.resources = languageStrings;
alexa.registerHandlers(handlers);
alexa.execute();
};
尝试失败:
// this.response.speak( launchMsg ).listen( reprompt, function(){this.emit('SessionEndedRequest')} );
// this.response.speak( launchMsg ).listen( reprompt, this.emit('SessionEndedRequest') );
// this.response.speak( launchMsg ).listen( reprompt, this.response.shouldEndSession(true) );
// this.response.shouldEndSession(true).speak( launchMsg ).listen( reprompt );
// this.response..speak( launchMsg ).listen( reprompt ).shouldEndSession(true);
// this.response.speak( 'goodbye' ).listen( reprompt ).speak( launchMsg );
// this.response.speak( launchMsg ).listen( reprompt ).speak( 'goodbye' );
// this.response.speak( launchMsg ).listen( reprompt, this.emit(":tell", "goodbye") );
// this.response.speak( launchMsg ).listen( reprompt).speak('goodbye');
// this.response.speak( launchMsg ).listen( reprompt, true );
// this.response.speak.listen( reprompt, false );
// this.response.speak.listen( true, reprompt );
// this.response.speak.listen( false, reprompt );
// this.emit(':responseReady', function(){this.emit('SessionEndedRequest')});
// this.emit(':responseReady', this.emit('SessionEndedRequest') );
// this.emit(':responseReady', this.response.shouldEndSession(true));
// this.emit(':responseReady', function(){this.response.shouldEndSession(true)} );
【问题讨论】:
-
您的代码中是否有任何日志?如果您在 Lambda 中运行,是否可以包含函数中的云监视日志?
-
您解决了吗?我遇到了同样的问题。
-
不....仍在尝试。还在哭。
-
您是否尝试过处理 SessionEndedRequest ? developer.amazon.com/docs/custom-skills/…
标签: node.js alexa alexa-skills-kit alexa-skill alexa-app