如何使用 "exit" 停止 Alexa 技能或处理无法识别的话语?

How to use "exit" to stop an Alexa skill or handle unrecognized utterances?

我在使用 Alexa SDK 时遇到了一个奇怪的行为。我正在尝试实现用户结束会话的所有可能方式。我遇到的问题是 "exit" return 这个词让 Alexa 说 "There was a problem..." 并立即退出该技能。所有其他词,如 "stop" 或 "cancel" 都可以正常工作,return 一个再见消息。

这是我实现处理程序的方式:

'AMAZON.CancelIntent': function () {
    this.emit('SessionEndRequest');
},
'AMAZON.StopIntent': function () {
    this.emit('SessionEndRequest');
},
'SessionEndRequest': function() {
    const speech_output = 'Goodbye and take care!'

    this.emit(':tell', speech_output);
},

如您所见,为了尽可能简单,我现在将 StopIntentCancelIntent 重定向到 SessionEndRequest 其中 return 是一个告别消息。这很好用,除了无法识别的 "exit" 。

有办法实现吗?我尝试将自定义意图(称为 ExitIntent)与语句 "exit" 加上一堆其他意图(如 "see ya"、"until next time" 一起使用,除了 "exit" 语句外,其他一切都很好.

或者有没有办法处理无法识别的话语 - 即。 return HelpIntent?

如果您想处理无法识别的话语,只需创建一个 Unhandled 请求即可。

'Unhandled': function () {
     const speech_output = 'Goodbye and take care!'
     this.emit(':tell', speech_output);
}

这应该可以解决 'exit' 不工作的问题。

我遇到了同样的问题。简单修复,将 "exit" 作为话语添加到 AMAZON.StopIntent