回答

0

不幸的是,它看起来像'简单'是硬编码的,'小'和大图像URL需要'标准'卡片。下面是从

https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/historyBuff/src/AlexaSkill.js#L142

if (options.cardTitle && options.cardContent) { 
     alexaResponse.card = { 
      type: "Simple", 
      title: options.cardTitle, 
      content: options.cardContent 
     }; 
    } 

的代码,你需要修改你的本地AlexaSkill.js副本添加的功能。

这里是API的使用瓶-ASK库(矿)显示卡的工作原理:

https://johnwheeler.org/flask-ask/responses.html#displaying-cards-in-the-alexa-smartphone-tablet-app

2

我也跟着reply对马克斯金格亚马逊开发者支持论坛类似的问题:

我一直在努力与此自己,现在有它的工作。如果 您使用亚马逊提供的示例AlexaSkill.js模块,然后 您需要添加几个部分来处理图片卡。

if (options.cardSmallImageURL && options.cardLargeImageURL) { 
     alexaResponse.card = { 
      type: "Standard", 
      title: options.cardTitle, 
      text: options.cardContent, 
      image: { 
       smallImageUrl: options.cardSmallImageURL, 
       largeImageUrl: options.cardLargeImageURL 
      } 
     }; 
    } 

再经过askWithCard定义再往下补充一点::

在buildSpeechletResponse部分相似类型后 “简单”中添加该

askWithPictureCard: function(speechOutput, repromptSpeech, cardTitle, cardContent, smallImageURL, largeImageURL) { 
     this._context.succeed(buildSpeechletResponse({ 
      session: this._session, 
      output: speechOutput, 
      reprompt: repromptSpeech, 
      cardTitle: cardTitle, 
      cardContent: cardContent, 
      cardSmallImageURL: smallImageURL, 
      cardLargeImageURL: largeImageURL, 
      shouldEndSession: false 
     })); 

现在你可以调用它,可能使用变量而不是常量I 正在使用测试;

response.askWithPictureCard(“这是语音输出”,“这是 重新提示”,“这是卡标题”,“这是卡文,注意 场被称为文本不cardContent”, 'https://s3.amazonaws.com/thisisthesmallpictureurl-small.jpg', 'https://s3.amazonaws.com/thisisthebigpictureurl-big.jpg');

然后按照类似的过程添加tellWithPictureCard函数。

有代码那里有斯金格把CRD时,他的意思我纠正了我上面贴一个小错字。除此之外,这种方法为我工作。

相关问题