使用this.toIntent()导航后如何请求输入,并使用this.ask()捕获用户输入后如何继续执行相同的意图

时间:2019-06-19 13:16:17

标签: node.js alexa-skill jovo-framework alexa-intent

我对Alexa开发非常陌生,为此我正在使用JOVO框架。因此,我很抱歉,如果这不是问这个问题的正确地方。

我的app.js(JOVO)骨架如下:

const ivr_menu: = [
{
    choice: "contact detail",
    desc: "know more about a given contact."
  },
  {
    choice: "email history",
    desc: "know emailing history of a given contact."
  },
]
app.setHandler({
     LAUNCH(){
          return this.toIntent("WelcomeIntent");
     },

 async WelcomeIntent() {
    let os = "Welcome. Please listen to the IVR menu options carefully.";
    for (var index = 0; index < ivr_menu.length; index++) {
       os += `Say ${ivr_menu[index].choice} to ${ivr_menu[index].desc}.`;
    }
    this.ask(os);
 },

 async UserChoiceIntent() {
    const menu_option = this.$inputs.ivrmenuoption.value;
    switch(menu_option) {
      case "contact detail":
         return this.toIntent("ContactLookupIntent");
      case "email history":
         return this.toIntent("EmailHistoryIntent");
    }
 },

 async ContatLookupIntent() {
    const contact_id = this.$inputs.contactid.value;
    this.tell(contact_id);
 }

});

我要完成的工作是,当用户告诉他的选择时,它将首先向用户显示IVR菜单选项。一旦用户选择一个选项(例如说出联系方式),该技能就会进入UserChoiceIntent并导航到正确的意图(switch-case)。

ContactLookupEmailHistory之类的每种意图都要求用户输入。对于这种技能,ID总是数字的,例如5099563。

在上述方法中,我遇到的问题是,当alexa导航到意图时,它没有获得所需的输入(const contact_id = this.$inputs.contactid.value),因此最终说出

  

您要求的技能回答有误。

我的问题:

我是否有导航到意图并要求用户输入的选项?在导航到意图并等待用户输入(this.ask())之后,alexa会问我有没有什么方法可以使用这种说话方式?输入值可用后,alexa将继续执行该意图内的其余逻辑吗?最重要的是alexa执行this.ask(),然后继续执行意图中的其余逻辑。

如何手动创建时段说话?请注意,我正在本地使用JOVO来构建该技能,并将其部署到Alexa。

由于我在这项技能上的全部意图都是像5099563这样的输入,即一个数字值,我该如何将其发送给alexa?我尝试使用AMAZON.NUMBER,但是当我输入一个值时,我不知道它会带来一些奇怪的结果,而这与我的意图响应无关。似乎输入已从某处获取并用于其他技能!在这里使用哪种正确的插槽类型?我尝试过AMAZON.LITERAL,但它仅在美国提供,并且我来自印度,因此对我的技能不起作用。我认为传递这种价值的最好方法是说它像五零九九九五六三。 AMAZON.NUMBER不会接受(或可能我错了)。那么处理这种情况的最佳方法是什么?

交互模型:

​{
    "interactionModel": {
        "languageModel": {
            "invocationName": "metrics report",
            "types": [],
            "intents": [
                {
                    "name": "WelcomeIntent",
                    "samples": [],
                    "slots": []
                },
                {
                    "name": "UserOptionIntent",
                    "samples": [
                        "{ivrmenuoption}"
                    ],
                    "slots": [
                        {
                            "name": "ivrmenuoption",
                            "type": "AMAZON.Person"
                        }
                    ]
                },
                {
                    "name": "ContactLookupIntent",
                    "samples": [
                        "{contactid}",
                    ],
                    "slots": [
                        {
                            "name": "contactid",
                            "type": "AMAZON.NUMBER"
                        }
                    ]
                },
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                }
            ]
        }
    }
}​

请注意,我是Alexa技能开发的新手。如果我的某些问题看起来很愚蠢,请考虑我对新手的理解程度。

0 个答案:

没有答案
相关问题