node.js中开发的Alexa技能在带有npm软件包'alexa-sdk'的简单或标准卡类型的Alexa应用程序的主页中不会显示任何卡。看来“ Alexa-sdk”包的response.js文件中存在问题。 我使用了以下方法
'THREE_D_QuestionIntent': function() {
let reply = " Here’s a list"
let speechOutput = reply;
let repromptSpeech = "Question";
let cardTitle = resultCardTitle;
let cardContent = "Result is ";
let imageObj = "https://s3.amazonaws.com/visitmadison/HTML/shape.png";
console.log(speechOutput);
this.emit(':askWithCard', speechOutput, repromptSpeech, cardTitle, cardContent, imageObj);
}
答案 0 :(得分:0)
对于带有图像的标准Alexa卡,您要包含具有smallImageUrl
和largeImageUrl
属性的图像对象。 smallImageUrl
和largeImageUrl
是要显示的图像大小版本的URL。
例如,响应JSON将具有:
...
"card": {
"type": "Standard",
"title": "Ordering a Car",
"text": "Your ride is on the way",
"image": {
"smallImageUrl": "https://carfu.com/resources/card-images/race-car-small.png",
"largeImageUrl": "https://carfu.com/resources/card-images/race-car-large.png"
}
}
...
使用同时具有smallImageUrl
和largeImageUrl
的图像对象更新代码
var speechOutput = 'your speech here';
var repromptSpeech = 'your re prompt here';
var cardTitle = 'card title here';
var cardContent = 'card content here';
var imageObj = {
"smallImageUrl": "https://carfu.com/resources/card-images/race-car-small.png",
"largeImageUrl": "https://carfu.com/resources/card-images/race-car-large.png"
};
this.emit(':askWithCard', speechOutput, repromptSpeech, cardTitle, cardContent, imageObj);
有关标准卡here
的更多信息卡片图片必须满足某些条件,例如: