首先,如果我在 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 运行这个应用程序。
最佳答案
我最终创建了两种语言,英国和美国,然后我使用新的技能构建器确保在完成编辑/添加我的意图和示例话语后保存并构建模型。
我还使用了不同的插槽类型,而不是 AMAZON.US_FIRST_NAME 我用了 AMAZON.GB_FIRST_NAME .
下面是我用来让我的 Alexa 技能工作的技能构建器页面设置的屏幕截图
只是指出这是交互模式的问题,目前处于测试阶段的新构建器似乎为我解决了这个问题。
关于alexa-skills-kit - Alexa Skill 向技能发送请求时发生异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47939252/