如何在 google 操作应用程序中设置基本卡片轮播

How can I have carousel of basic cards in google actions app

我想展示一个带有基本卡片列表的旋转木马 (https://developers.google.com/actions/assistant/responses#basic_card) in google actions conversation response. I looked at the rich response(https://developers.google.com/actions/assistant/responses#rich-responses),它只允许其中一张基本卡片。

我想使用基本卡片而不是选项轮播的原因很简单。当我单击轮播选项时,它会继续进行下一次对话,但使用基本卡时,我将被重定向到外部 link,这正是我所需要的。

我正在使用下面的代码在轮播中显示当前聊天响应的项目​​(选项)列表。任何建议和帮助表示赞赏

        let carousel = app.buildCarousel()
        // carousel.addSimpleResponse();
        products_raw.forEach(function(item){
            console.log(item);
            carousel.addItems(
              app.buildOptionItem(item.title,)
              .setTitle(item.title)
              .setDescription(`Price: ${item.price}`)
              // .addButton('know more', item.url)
              .setImage(item.image, item.title)
              // .setImageDisplay('CROPPED')
            )
        });
        app.askWithCarousel(answerData.message_text, carousel)

你不能。两者旨在服务于不同的目的。

轮播卡片旨在推进对话并提供视觉信息作为推进对话的一部分。它并不是真的要提供最终结果或产生让您退出对话的东西。

基本卡片是补充对话语音部分的结果的一部分。它可以是对话的 "end result",但不一定是。因此,它允许链接到网站是有道理的。

如果您在对话中有很多结果,可能您还需要做更多的事情来推进对话。

您可以制作一个轮播或列表选择器,其中包含您希望能够从中进行选择的多个站点。然后当用户选择一个项目时,使用您从选择器传递的站点构建一个基本卡片。

您可以为您的用例使用浏览轮播,Browsing Carousel