1
我正在开发一个技能回显示。但是我无法显示所有的显示模板和python lambda技能。我能够完美地完成alexa技能,并且能够添加可正常工作的图像网址。但是当显示模板被添加时,它显示无效的响应。回声显示蟒蛇技能不生成显示模板
而这是被添加到JSON响应额外的参数。
directives: [
{
type: “Display.RenderTemplate”,
template: {
type: “BodyTemplate1”,
token: “T123”,
backButton: “HIDDEN”,
backgroundImage: {
contentDescription: “StormPhoto”,
sources: [
{
url: “https://s3.amazonaws.com/hurricane-data/hurricaneBackground.png”
}
]
},
title: “Hurricane Center”,
textContent: {
primaryText: {
text: output,
type: “PlainText”
}
}
}
}],
这就是我修改后的渲染模板方法的样子。 高清build_speechlet_response(标题,输出,reprompt_text,should_end_session): imgUrl的= “https://thesweetsetup.com/wp-content/uploads/2014/10/scanbot_ico_1024.png”
return {
'outputSpeech': {
'type': 'PlainText',
'text': output
},
'card': {
'type': 'Standard',
'title': title,
'text': output,
"image": {
"smallImageUrl": imgurl,
"largeImageUrl": imgurl
}
},
'reprompt': {
'outputSpeech': {
'type': 'PlainText',
'text': reprompt_text
}
},
directives: [
{
type: “Display.RenderTemplate”,
template: {
type: “BodyTemplate1”,
token: “T123”,
backButton: “HIDDEN”,
backgroundImage: {
contentDescription: “StormPhoto”,
sources: [
{
url: “https://s3.amazonaws.com/hurricane-data/hurricaneBackground.png”
}
]
},
title: “Hurricane Center”,
textContent: {
primaryText: {
text: output,
type: “PlainText”
}
}
}
}],
'shouldEndSession': should_end_session
}
但是这给了我错误为无效的响应格式。我在这里做错了什么。