我一直在研究 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"
}
}
}
}
}
最佳答案
我今天刚遇到同样的问题。以前从来没有这个问题。我猜亚马逊改变了一些东西。
我认为最好的办法是对每个机构的决议进行排序,然后选择具有 er_success_match 的决议,而不是仅仅获取resolutionsPerAuthority 列表中的第一项。但是,我不确定在一个 resolutionsPerAuthority 列表中是否可以有多个 er_success_matchs。
https://forums.developer.amazon.com/questions/171318/when-would-you-have-multiple-resolution-authoritie.html
关于alexa - Alexa 技能请求上的 resolutionsPerAuthority 中的多个权限,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51540750/