Alexa总是生成intentrequest,从不启动请求

时间:2017-09-07 18:24:38

标签: alexa-skills-kit

我的意图架构如下所示:

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

映射到getaddressintent的唯一话语是“GetAddressIntent给我我的地址”

当我在服务模拟器中说“Alexa ask”时,它应该根据文档生成LaunchRequest,但这绝不会发生。它总是生成一个GetAddressIntent。而且,无论我在服务模拟器中输入什么,它都是GetAddressIntent。

我在服务模拟器中输入了“asdfjasdfjalsdfjal; skdfj”,它生成了以下请求(省略了一些细节):

{
  "session": {
    "new": true,
    "sessionId": "SessionId.19876680-dd64-4420-b51c-209aac45e0ed",
    "application": {
      "applicationId": "amzn1.ask.skill.1cfe092b-45d9-4b76-b9a7-d3c0193e9e32"
    },
    "attributes": {},
    "user": {
      "userId": ".."
    }
  },
  "request": {
    "type": "IntentRequest",
    "requestId": "...",
    "intent": {
      "name": "GetAddressIntent",
      "slots": {}
    },
    "locale": "en-US",
    "timestamp": "2017-09-07T18:21:45Z"
  },
  "context": {
    "AudioPlayer": {
      "playerActivity": "IDLE"
    },
    "System": {
      "application": {
        "applicationId": ".."
      },
      "user": {
        "userId": "..."
      },
      "device": {
        "supportedInterfaces": {}
      }
    }
  },
  "version": "1.0"
}

处理程序:

def lambda_handler(event, context):
    """ Route the incoming request based on type (LaunchRequest, IntentRequest,
    etc.) The JSON body of the request is provided in the event parameter.
    """
    print("EVENT: {0}".format(event))
    print("event.session.application.applicationId=" +
          event['session']['application']['applicationId'])

    """
    Uncomment this if statement and populate with your skill's application ID to
    prevent someone else from configuring a skill that sends requests to this
    function.
    """
    ddid = "" #event['context']['System']['device']['deviceId']
    consent_token = "" #event['context']["System"]["user"]["permissions"]["consentToken"]
    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'], ddid, consent_token)
    elif event['request']['type'] == "SessionEndedRequest":
        return on_session_ended(event['request'], event['session'])

0 个答案:

没有答案