如何对Alexa中用户提出的“未处理意图”进行错误处理?

时间:2017-12-09 07:19:17

标签: alexa alexa-skills-kit alexa-voice-service alexa-app

当alexa收到用户的“未处理意图”时。如何处理错误消息“我不太确定如何帮助你”?

1 个答案:

答案 0 :(得分:4)

第1步: 如果您的交互模型缺少样本超出,则可能会收到大量未处理的事件。您添加的更多示例会将您的alexa技能重定向到正确的函数...

请参阅此链接以正确设置您的互动模型https://developer.amazon.com/docs/custom-skills/define-the-interaction-model-in-json-and-text.html#h2_sample_utterances

第2步:在index.js中定义未处理的函数来处理异常并重新引导用户输入正确的单词

'Unhandled': function () {
    this.attributes.speechOutput = this.t('HELP_MESSAGE');
    this.attributes.repromptSpeech = this.t('HELP_REPROMPT');
    this.emit(':ask', this.attributes.speechOutput, this.attributes.repromptSpeech);
},