【发布时间】:2018-11-08 22:53:00
【问题描述】:
我在使用新创建的 alexa 技能时遇到了一些问题。
在 Alexa 模拟器的文本框中键入请求总是返回“请求的技能响应有问题”。使用下面的输出 JSON。
{
"body":{
"version":"1.0",
"response":{
"outputSpeech":{
"type":"PlainText",
"text":"Hello i am here"
},
"card":{
"type":"Simple",
"title":"Welcome",
"content":"Hello i am here"
},
"directives":[
{
"type":"Display.RenderTemplate",
"template":{
"type":"BodyTemplate2",
"token":"",
"backgroundImage":{
"contentDescription":"Description for the background image",
"sources":[
{
"url":"URL for the background image - must be secure (https)",
"size":"x-small",
"widthPixels":0,
"heightPixels":0
}
]
},
"image":{
"contentDescription":"Description for the main image",
"sources":[
{
"url":"URL for the main image - must be secure (https)",
"size":"x-small",
"widthPixels":0,
"heightPixels":0
}
]
},
"title":"Welcome",
"textContent":{
"primaryText":{
"type":"RichText",
"text":"Welcome"
},
"secondaryText":{
"type":"RichText",
"text":"Hello i am here"
}
},
"backButton":"HIDDEN"
}
}
],
"shouldEndSession":false
},
"sessionAttributes":{
}
}
}
但是,当我从请求中复制 JSON 输入并使用用户手册 JSON 进行测试时,它运行良好,但返回的 JSON 格式略有不同
{
"status":"SUCCESSFUL",
"result":{
"skillExecutionInfo":{
"invocationRequest":{
"endpoint":"url here",
"body":{
"version":"1.0",
"session":{
"new":true,
"sessionId":"amzn1.echo-api.session.b62b79ba-1dde-4b22-9bf5-492943a008bc",
"application":{
"applicationId":"amzn1.ask.skill.7c4d08db-82be-4e18-9a62-7a95c58dd69f"
},
"user":{
"userId":"amzn1.ask.account."
}
},
"context":{
"AudioPlayer":{
"playerActivity":"IDLE"
},
"Display":{
},
"System":{
"application":{
"applicationId":"amzn1.ask.skill.7c4d08db-82be-4e18-9a62-7a95c58dd69f"
},
"user":{
"userId":"amzn1.ask.account."
},
"device":{
"deviceId":"amzn1.ask.device.",
"supportedInterfaces":{
"AudioPlayer":{
},
"Display":{
"templateVersion":"1.0",
"markupVersion":"1.0"
}
}
},
"apiEndpoint":"https://api.amazonalexa.com",
"apiAccessToken":"eyJ0eXAiOiJKV1"
}
},
"request":{
"type":"LaunchRequest",
"requestId":"amzn1.echo-api.request.",
"timestamp":"2018-02-05T11:35:53Z",
"locale":"en-GB"
}
}
},
"invocationResponse":{
"body":{
"response":{
"card":{
"type":"Simple",
"title":"Welcome",
"content":"Hello i am here"
},
"directives":[
{
"template":{
"type":"BodyTemplate2",
"token":"",
"title":"Welcome",
"textContent":{
"primaryText":{
"type":"RichText",
"text":"Welcome"
},
"secondaryText":{
"type":"RichText",
"text":"Hello i am here"
}
},
"backButton":"HIDDEN",
"backgroundImage":{
"contentDescription":"Description for the background image",
"sources":[
{
"url":"URL for the background image - must be secure (https)",
"size":"X_SMALL",
"widthPixels":0,
"heightPixels":0
}
]
},
"image":{
"contentDescription":"Description for the main image",
"sources":[
{
"url":"URL for the main image - must be secure (https)",
"size":"X_SMALL",
"widthPixels":0,
"heightPixels":0
}
]
}
},
"type":"Display.RenderTemplate"
}
],
"outputSpeech":{
"type":"PlainText",
"text":"Hello i am here"
},
"shouldEndSession":false
},
"sessionAttributes":{
},
"version":"1.0"
}
},
"metrics":{
"skillExecutionTimeInMilliseconds":254
}
},
"error":null
}
}
知道问题出在哪里,谢谢。
【问题讨论】:
-
从 cloudwatch 捕获日志并在您的问题中更新...我在您的第二个 json 中看到 null 但详细日志会告诉根本原因
标签: alexa alexa-skills-kit alexa-skill alexa-voice-service