首页 文章

Alexa Skill将请求分派给技能时发生异常

提问于
浏览
1

首先,如果我在alexa应用程序开发页面上使用模拟器,一切正常,尽管请求看起来有些不同 . 如果我对我的Alexa设备说“询问appName ”,则会调用我的Web服务,并显示错误消息“将请求分派给技能时发生异常” . 是我的意图插槽 .

这只有在直接与Alexa交谈并且模拟器再次完美运行时才会发生 .

以下是我与Amazon Echo交谈时收到的请求 .

{
    "version": "1.0",
    "session": {
        "new": false,
        "sessionId": "amzn1.echo-api.session.6a13f2db-a9f6-43a9-bc4d-x063b86905b6c",
        "application": {
            "applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9xc94abba2"
        },
        "user": {
            "userId": "xxx"
        }
    },
    "context": {
        "AudioPlayer": {
            "playerActivity": "STOPPED"
        },
        "System": {
            "application": {
                "applicationId": "amzn1.ask.skill.ef8bd603-cc39-406e-bed8-a8f9c94abba2"
            },
            "user": {
                "userId": "xxxx"
            },
            "device": {
                "deviceId": "xx",
                "supportedInterfaces": {
                    "AudioPlayer": {}
                }
            },
            "apiEndpoint": "https://api.eu.amazonalexa.com",
            "apiAccessToken": "xxxx"
        }
    },
    "request": {
        "type": "SessionEndedRequest",
        "requestId": "amzn1.echo-api.request.2a993410-e7a8-4f37-87d7-a5063ef185b5",
        "timestamp": "2017-12-22T00:11:45Z",
        "locale": "en-GB",
        "reason": "ERROR",
        "error": {
            "type": "INVALID_RESPONSE",
            "message": "An exception occurred while dispatching the request to the skill."
        }
    }
}

以下是我的意图Schema

{
  "intents": [
    {
      "intent": "StartGameIntent"
    },
    {
      "slots": [
        {
          "name": "playerOne",
          "type": "AMAZON.US_FIRST_NAME"
        },
        {
          "name": "playerTwo",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ],
      "intent": "PlayTheGame"
    },
    {
      "intent": "StopTheGame"
    },
    {
      "slots": [
        {
          "name": "damage",
          "type": "AMAZON.NUMBER"
        },
        {
          "name": "player",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ],
      "intent": "PlayerTakesDamage"
    },
    {
      "slots": [
        {
          "name": "health",
          "type": "AMAZON.NUMBER"
        },
        {
          "name": "player",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ],
      "intent": "PlayerHeals"
    }
  ]
}

如果我问一个没有任何插槽的意图,它工作正常 . 为什么在有插槽时没有找到我的意图?

我正在使用Language UK运行这个应用程序 .

2 回答

  • 0

    我最终创建了两种语言,英国和美国,然后我使用新的技能构建器确保在完成编辑/添加我的意图和示例话语后保存并构建模型 .

    enter image description here

    我也使用了不同的插槽类型,而不是 AMAZON.US_FIRST_NAME 我使用了 AMAZON.GB_FIRST_NAME .

    下面是我的技能构建器页面设置的屏幕截图,我用它来获得我的Alexa技能

    只是要指出这是交互模式的一个问题,目前处于测试阶段的新构建器似乎为我解决了这个问题 .

    enter image description here

  • 2

    尝试检查AWS lambda日志以查找请求的错误 . 它应该为您提供失败的模块名称(例如index.js)和异常的行号 .

    您还可以将console.log()消息添加到lambda代码中,以帮助缩小发生错误的位置 .

相关问题