【问题标题】:Cancel intent not invoked Alexa取消意图未调用 Alexa
【发布时间】:2018-02-19 21:30:28
【问题描述】:

我正在编写 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');
    }
}

【问题讨论】:

  • 你能在样本话语而不是样本中输入话语吗?

标签: alexa-skills-kit alexa-skill


【解决方案1】:

我选择退出 Alexa 为交互模型提供的 Launch Skill Builder BETA。

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

现在一切正常。

【讨论】:

    猜你喜欢
    • 2019-07-03
    • 1970-01-01
    • 2018-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 2016-04-25
    • 2023-04-10
    相关资源
    最近更新 更多