Развиваю навык эхо-шоу. Однако я не могу отобразить все шаблоны отображения и прочее из навыков Python Lambda. Я могу отлично использовать навык Alexa и могу добавить URL-адрес изображения, который отлично работает. Но когда добавляется шаблон отображения, он показывает неверный ответ.
Я следовал этому руководству https://medium.freecodecamp.org/how-to-design-and-code-alexa-skills-for-amazons-echo-show-c5716da8fee5
И это был дополнительный параметр, который нужно было добавить в ответ 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”
}
}
}
}],
Вот как выглядит мой модифицированный метод шаблона рендеринга. def 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
}
Но это дает мне ошибку как недопустимый формат ответа. Что я здесь делаю неправильно.