我的技能因错误而超时,“请求的技能响应有问题”。
如果用户在初始提示和重新提示时都没有说任何话,我会尝试静默结束会话。
目前,如果用户第一次什么都没说,它会重新提示。
如果他们在重新提示后什么也没说,Alexa 会显示错误消息:“请求的技能响应有问题。”
拉姆达函数:
'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)} );