Alexa-在python中实现CanFulfillIntentRequest [英] Alexa - Implementing CanFulfillIntentRequest in python

查看:116
本文介绍了Alexa-在python中实现CanFulfillIntentRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已从alexa技能开发者控制台以我的英语(美国)启用CanFulfillIntentRequest。我在lambda中为CanFulfillIntentRequest添加了一个处理程序。当我使用技能测试器并直接输入意图言语(不带技能调用名称)时,似乎没有碰到我的代码。我在cloudwatch中找不到任何相关日志。

I have enabled the CanFulfillIntentRequest from the alexa skill developer console in English(U.S) of my skill. I have added a handler in my lambda for the CanFulfillIntentRequest. When I use the skill tester and type the intent utterance directly (without skill invocation name), it doesn't seem to hit my code. I can't find any related logs in the cloudwatch.

def lambda_handler(event, context):
    print("event.session.application.applicationId=" +
          event['session']['application']['applicationId'])

    if event['session']['new']:
        on_session_started({'requestId': event['request']['requestId']},
                           event['session'])

    if event['request']['type'] == "LaunchRequest":
        return on_launch(event['request'], event['session'])
    elif event['request']['type'] == "IntentRequest":
        return on_intent(event['request'], event['session'])
    elif event['request']['type'] == "SessionEndedRequest":
        return on_session_ended(event['request'], event['session'])
    elif event['request']['type'] == "CanFulfillIntentRequest":
        return on_canfullfill(event['request'], event['session'])

def on_canfullfill(request, session):
    print ("Yes, I can!")

我知道这必须使用指定的JSON进行响应技能是否可以接受此请求。但是不应该在云监视日志中有一个是的,我可以!条目吗?

I know this has to respond back with a JSON specifying if the skill can or cannot take up this request. But shouldn't there be a - 'Yes, I can!' entry in the cloud watch logs?

我在这里错过了什么?另外,在哪里可以找到有关形成和发送此请求的响应的文档/ api?

What am I missing here? Also, where can I find documentation/apis on forming and sending the reponse for this request?

推荐答案

看来您只能使用开发人员控制台中的手动JSON 选项卡并使用 ASK CLI CanFulfillIntentRequest c>。

It looks like you can only test CanFulfillIntentRequest using Manual JSON tab from developer console and using ASK CLI.

来自Alexa文档


您无法使用Alexa测试CanFulfillIntentRequest支持设备

You cannot test CanFulfillIntentRequest with an Alexa-enabled device

有关测试 CanFulfillIntentRequest 的更多信息此处

这篇关于Alexa-在python中实现CanFulfillIntentRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆