我一直在研究 Alexa 技能,到目前为止它运行良好,但今天我遇到了一个奇怪的问题。在其他技能中也可以看到类似的问题。问题是我在我的技能请求 JSON 的 resolutionsPerAuthority 中获得了多个权限。这些权限具有不同的状态码来匹配槽值。因此,我的代码遇到了困难,因为 resolutionsPerAuthority 应该只有一个对象。
我正在使用亚马逊官方文档中提供的代码来获取插槽值,并且由于这种情况而失败。还有其他人面临类似问题吗?有什么解决办法吗?
这是我的请求 JSON:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.f4bf3a11-f882-4732-9275-6e494e0bca4d",
"application": {
"applicationId": "app id"
},
"attributes": {
"launchCount": 0,
"jokeCount": 0,
"indexes": [
34
],
"lastSpeechOutput": {
"outputSpeech": "response",
"reprompt": "reprompt"
},
"history": [
{
"IntentRequest": "LaunchRequest"
}
],
"currentJokeIndex": 34,
"lastUseTimestamp": 0
},
"user": {
"userId": "amzn1.ask.account.ncsdkncsdlcnskY"
}
},
"context": {
"Display": {
"token": "string"
},
"System": {
"application": {
"applicationId": "id"
},
"user": {
"userId": ""
},
"device": {
"deviceId": "",
"supportedInterfaces": {
"Display": {
"templateVersion": "1.0",
"markupVersion": "1.0"
}
}
},
"apiEndpoint": "https://api.eu.amazonalexa.com",
"apiAccessToken": ""
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.824ef2fe-5a6b-45c8-96d2-a5aa0063e9b5",
"timestamp": "2018-07-26T13:47:56Z",
"locale": "en-IN",
"intent": {
"name": "TellJokeIntent",
"confirmationStatus": "NONE",
"slots": {
"joke": {
"name": "joke",
"value": "joke",
"resolutions": {
"resolutionsPerAuthority": [
{
"authority": "amzn1.er-authority.echo-sdk.amzn1.ask.skill.a4bb9873-04fa-486f-8e1e-e30cb3c3d669.joke",
"status": {
"code": "ER_SUCCESS_MATCH"
},
"values": [
{
"value": {
"name": "joke",
"id": "e2ff3cfd4b43876adaa5767ce93bf7d3"
}
}
]
},
{
"authority": "amzn1.er-authority.dynamic.amzn1.ask.skill.a4bb9873-04fa-486f-8e1e-e30cb3c3d669.joke",
"status": {
"code": "ER_SUCCESS_NO_MATCH"
}
}
]
},
"confirmationStatus": "NONE"
}
}
}
}
}