-1

当我从 alexa 调用我的服务时,我得到的不是我应该得到的 slot 的值。我有这样的意图模式:

{
"interactionModel": {
    "languageModel": {
        "invocationName": "name_of_app",
        "intents": [
            {
                "name": "AMAZON.CancelIntent",
                "samples": []
            },
            {
                "name": "AMAZON.HelpIntent",
                "samples": []
            },
            {
                "name": "AMAZON.StopIntent",
                "samples": []
            },
            {
                "name": "EventsIntent",
                "slots": [
                    {
                        "name": "City",
                        "type": "AMAZON.GB_CITY"
                    }
                ],
                "samples": [
                    "whats {City}",
                    "whats going on in {City} ",
                    "tell me about {City}"
                ]
            }
        ],
        "types": []
    }
}

}

我的 Flask-Ask 代码我想在哪里导入城市,但是当我运行我的代码时,我在城市名称的地方得到 None 。

@ask.intent('EventsIntent', mapping={'city': 'City'})
def weather(city):
    return statement('you have selected {}'.format(city))
4

1 回答 1

0

您需要使用转换而不是映射它应该可以很好地工作请尝试

@ask.intent('EventsIntent', convert={'City': str})
def weather(City):
    return statement('you have selected {}'.format(City))
于 2018-10-17T06:51:01.283 回答