6

我正在尝试建立一个 alexa 自定义技能。我正面临一个问题,我试图从用户那里获得是/否对技能询问用户的问题的回答。

Alexa: Would you like to know the rules of the game?
User: <Can respond either Yes or No>

根据用户响应,我想执行特定操作。

这是我的意图架构:

{
    "intents": [
    {
        "intent": "AMAZON.StopIntent"
    },
    {
        "intent": "AMAZON.CancelIntent"
    },
    {
        "intent": "AMAZON.HelpIntent"
    },
    {
        "intent": "StartGame"
    },
    {
        "intent": "GetRules"
    }
  ]
}

这是我的示例话语:

StartGame Begin the game
StartGame Start the game

GetRules What are the rules
GetRules Get the rules
GetRules Tell me the rules
GetRules Tell me the rules again

该技能向用户提出的问题如下:

Welcome to the game. Would you like me to tell you the rules?

每当我说“是”时,StartGame 意图就是被触发的内容。(“否”也是如此)。Alexa 总是选择 Intent 作为 StartGame。调用“GetRules”意图的最佳方式是什么。我希望用户只说是/否而不是说“获取规则”。

如果已经回答/需要更多信息,请告诉我。

4

2 回答 2

5

您需要使用 AMAZON.YesIntent 和 AMAZON.NoIntent。

你可以在这里阅读它们:。

标准内置意图。 https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/standard-intents

于 2017-02-20T14:37:05.600 回答
0

请在交互模型中添加以下代码。

{
    "name": "AMAZON.NoIntent",
    "samples": []
},
{
    "name": "AMAZON.YesIntent",
    "samples": []
}

并在您的 lambda 中为是/否提供您的业务逻辑。

'AMAZON.YesIntent': function () {
    //business code
},
'AMAZON.NoIntent': function () {
    //business code
}
于 2018-07-10T09:44:59.043 回答