取消意图没有调用Alexa

时间:2017-09-11 15:19:59

标签: alexa-skills-kit alexa-skill

我正在撰写Alexa技能并且遇到AMAZON.CancelIntent意图问题。

如果我说"退出"或"帮助"相应地调用其他意图。但如果我说"取消"

:我的自定义意图NutriFactsIntent被调用,当然也有问题,因为插槽没有填充。

为什么会这样?

意图架构

"intents": [
{
  "name": "AMAZON.CancelIntent",
  "samples": [
    "Cancel",
    "Never mind",
    "forget it"
  ]
},
{
  "name": "AMAZON.HelpIntent",
  "samples": [
    "Open",
    "Start",
    "what can I say",
    "help me"
  ]
},
{
  "name": "AMAZON.StopIntent",
  "samples": [
    "Quit",
    "Exit",
    "Leave",
    "Off",
    "Stop"
  ]
},
{
  "name": "NutriFactsIntent",
  "samples": [
    "give me the facts on a {Food}",
    "give me the facts on an {Food}",
    "give me the facts for a {Food}",
    "give me the facts for an {Food}",
    "give me the facts of a {Food}",
    "give me the facts of an {Food}",
    "give me the facts for {Food}",
    "give me the facts of {Food}",
    ...

}

抓住意图

function onIntent(intentRequest, session, callback) {
    //console.log(`onIntent requestId=${intentRequest.requestId}, sessionId=${session.sessionId}`);

    const intent = intentRequest.intent;
    const intentName = intentRequest.intent.name;

    // Dispatch to your skill's intent handlers
    if (intentName === 'NutriFactsIntent') {
        getFactsFromSession(intent, session, callback);
    } else if (intentName === 'AMAZON.HelpIntent') {
        getWelcomeResponse(callback);
    } else if (intentName === 'AMAZON.StopIntent' || intentName === 'AMAZON.CancelIntent') {
        handleSessionEndRequest(callback);
    } else {
        throw new Error('Invalid intent');
    }
}

1 个答案:

答案 0 :(得分:0)

我选择退出Alexa可用于交互模型的启动技能构建器 BETA。

enter image description here

我点击它进入BETA,然后经过几个小时的痛苦后我去了仪表板并离开了BETA。

现在一切正常。