0

我的技能因错误而超时,“请求的技能响应有问题”。

在此处输入图像描述

如果用户在初始提示和重新提示时都没有说任何话,我会尝试静默结束会话。

目前,如果用户第一次什么都没说,它会重新提示。

如果他们在重新提示后什么也没说,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)} );
4

1 回答 1

0

只需将SessionEndedRequest添加到您的处理程序对象。

'SessionEndedRequest': function() {
        console.log("No response from user.");
 }

请注意,您的技能无法返回对SessionEndedRequest的响应。

来自 Alexa Skills Kit Docs 的参考资料

于 2018-07-30T15:49:14.283 回答