alexa-skills-kit - Alexa Skill 向技能发送请求时发生异常

标签 alexa-skills-kit alexa-skill

首先,如果我在 alexa 应用程序开发页面上使用模拟器,一切正常,尽管请求看起来有些不同。如果我对我的 Alexa 设备说“询问 appName {x} 和 {y}”,那么我的 Web 服务会被调用并显示错误消息“向技能发送请求时发生异常”。 {X} 和 {Y} 是我的意图槽。

这只发生在直接与 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."
        }
    }
}

以下是我的意图架构
{
  "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"
    }
  ]
}

如果我问一个没有任何插槽的 Intent,它工作正常。为什么当他们有插槽时找不到我的意图?

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

最佳答案

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

enter image description here

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

下面是我用来让我的 Alexa 技能工作的技能构建器页面设置的屏幕截图

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

enter image description here

关于alexa-skills-kit - Alexa Skill 向技能发送请求时发生异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47939252/

相关文章:

amazon-web-services - Amazon Echo-将消息推送到设备

c# - 使用 Alexa.net - 我可以从代码中调用 intent 吗?

alexa-skills-kit - 不同语言的 Alexa 技能响应

ios - 是否可以将Alexa Skills Kit与iOS移动应用程序集成以触发事件?

javascript - Alexa 技能循环 : Based off of User Input, Alexa 会说些什么

amazon-web-services - Alexa SSML 不播放

javascript - Dialogue.Directive 不起作用 发出处理程序时?

c# - Alexa.NET 无法创建提醒 : Invalid Bearer Token

amazon-web-services - Alexa 智能家居技能 API v2/v3 兼容性引用

alexa-skills-kit - Alexa智能家居技能套路