Alexa技能需要填充两个插槽,但是即使在请求中同时填充两个插槽,该技能仍会单独请求它们

时间:2019-01-29 22:07:01

标签: amazon-web-services nlp alexa-skills-kit

我正在建立alexa测试技能,以协助购买产品。它期望产品名称和要购买的单元数。这些位置已根据实现意图的需要进行了设置,尽管它们可以单独实现,但我设置了示例话语,使用户可以在同一句子中完成这两个任务,例如

I want to buy {MyQuantity} {MyArticle}

但是,在测试中,Alexa始终会分别要求两个值。下面是对话流程的示例,下面是我的技能的JSON输出。不确定我在做什么错。 (在这种情况下,我已将对话框管理委托给Alexa)。

enter image description here

技能的JSON配置:

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "priceline collect",
            "intents": [
                {
                    "name": "AMAZON.FallbackIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.NavigateHomeIntent",
                    "samples": []
                },
                {
                    "name": "CreateOrder",
                    "slots": [
                        {
                            "name": "MyArticle",
                            "type": "ClickCollectArticle",
                            "samples": [
                                "I want to buy {MyArticle}",
                                "I want {MyArticle}",
                                "Can i get {MyArticle} please",
                                "I'd like to buy {MyArticle}"
                            ]
                        },
                        {
                            "name": "MyQuantity",
                            "type": "AMAZON.NUMBER",
                            "samples": [
                                "{MyQuantity} thanks",
                                "I want {MyQuantity} please"
                            ]
                        }
                    ],
                    "samples": [
                        "I want to buy {MyQuantity} {MyArticle}",
                        "I want to buy {MyArticle}",
                        "Can i please get {MyQuantity} {MyArticle}",
                        "I want to order {MyArticle}",
                        "I would like to place an order"
                    ]
                }
            ],
            "types": [
                {
                    "name": "ClickCollectArticle",
                    "values": [
                        {
                            "name": {
                                "value": "foundation"
                            }
                        },
                        {
                            "name": {
                                "value": "conditioner"
                            }
                        },
                        {
                            "name": {
                                "value": "shampoo"
                            }
                        },
                        {
                            "name": {
                                "value": "perfume"
                            }
                        },
                        {
                            "name": {
                                "value": "after shave"
                            }
                        },
                        {
                            "name": {
                                "value": "aftershave"
                            }
                        },
                        {
                            "name": {
                                "value": "hairspray"
                            }
                        },
                        {
                            "name": {
                                "value": "hair gel"
                            }
                        },
                        {
                            "name": {
                                "value": "lipstick"
                            }
                        }
                    ]
                }
            ]
        },
        "dialog": {
            "intents": [
                {
                    "name": "CreateOrder",
                    "delegationStrategy": "ALWAYS",
                    "confirmationRequired": true,
                    "prompts": {
                        "confirmation": "Confirm.Intent.847210063881"
                    },
                    "slots": [
                        {
                            "name": "MyArticle",
                            "type": "ClickCollectArticle",
                            "confirmationRequired": true,
                            "elicitationRequired": true,
                            "prompts": {
                                "confirmation": "Confirm.Slot.847210063881.746398127202",
                                "elicitation": "Elicit.Slot.847210063881.746398127202"
                            }
                        },
                        {
                            "name": "MyQuantity",
                            "type": "AMAZON.NUMBER",
                            "confirmationRequired": true,
                            "elicitationRequired": true,
                            "prompts": {
                                "confirmation": "Confirm.Slot.847210063881.631830388134",
                                "elicitation": "Elicit.Slot.847210063881.631830388134"
                            },
                            "validations": [
                                {
                                    "type": "isLessThan",
                                    "prompt": "Slot.Validation.369260633406.54462952385.1162755638931",
                                    "value": "20"
                                }
                            ]
                        }
                    ]
                }
            ],
            "delegationStrategy": "ALWAYS"
        },
        "prompts": [
            {
                "id": "Elicit.Slot.847210063881.746398127202",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "We sell all kinds of awesome stuff, from lipstick to hairspray. What would you like to buy?"
                    },
                    {
                        "type": "PlainText",
                        "value": "We sell everything from shampoo to foundation. What would you like to order?"
                    },
                    {
                        "type": "PlainText",
                        "value": "What item would you like to order. Examples are lipstick or foundation. "
                    }
                ]
            },
            {
                "id": "Confirm.Slot.847210063881.746398127202",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "Great. So that's {MyArticle} ?"
                    }
                ]
            },
            {
                "id": "Elicit.Slot.847210063881.631830388134",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "What number of {MyArticle} would you like to purchase?"
                    },
                    {
                        "type": "PlainText",
                        "value": "How many {MyArticle} were you after?"
                    },
                    {
                        "type": "PlainText",
                        "value": "And how many of the item {MyArticle} would you like to buy?"
                    }
                ]
            },
            {
                "id": "Confirm.Slot.847210063881.631830388134",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "Awesome. So {MyQuantity} {MyArticle} ?"
                    }
                ]
            },
            {
                "id": "Confirm.Intent.847210063881",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "Ok. It looks like we're all ready to get you {MyQuantity} units of {MyArticle} , is that right?"
                    }
                ]
            },
            {
                "id": "Slot.Validation.369260633406.54462952385.1162755638931",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "Sorry, you can't order that many units. Please order less than twenty. "
                    }
                ]
            }
        ]
    }
}

0 个答案:

没有答案