【问题标题】:how to get the text of user input in alexa using python flask-ask如何使用 python flask-ask 在 alexa 中获取用户输入的文本
【发布时间】:2018-08-17 17:36:11
【问题描述】:

无论何时用户说话,我都想将它传递给我的 API,并使用 python flask-ask 将 API 响应发送给 Alexa。

我不想使用 AWS lambda。我想知道这是否可能,如果可以,我该如何实现。

例如:

UserVoiceInput = anything that user says

def anyfunc():
    abc = MyApiUrl?message=UserVoiceInput
    return statement(abc["Response_Message"])

如何使用 python flask-ask 实现上述逻辑

【问题讨论】:

    标签: python-3.x alexa-skill flask-ask


    【解决方案1】:

    是的,你可以用烧瓶问来实现这一点

    @ask.intent("IntentName")
    def function(slotvalue):
        example = get_api_response(slotvalue)
        example_msg = 'the result is {}'.format(example)
        return statement(example_msg)
    

    然后像下面这样定义你的函数。

    def get_api_response(value):
        # Do your api call 
        return response
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-03
      • 1970-01-01
      • 2019-06-06
      • 2020-12-01
      • 2018-08-28
      • 1970-01-01
      相关资源
      最近更新 更多