askWithCarousel() 返回空响应

askWithCarousel() is returning empty response

这是我正在使用的代码片段:

app.askWithCarousel('Which of these looks good?',
    app.buildCarousel()
        .addItems([
            app.buildOptionItem("SELECTION_KEY_ONE",
                ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
                .setTitle('Number one'),
            app.buildOptionItem("SELECTION_KEY_TWO",
                ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
                .setTitle('Number two'),
        ]));

这里是屏幕截图:

我找到了解决办法。这可能是一个 Google 错误。您所要做的就是添加 .setDescription 方法

app.askWithCarousel('Which of these looks good?',
    app.buildCarousel()
        .addItems(
            app.buildOptionItem("SELECTION_KEY_ONE",
                            ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
                            .setTitle('Number one')
                            .setDescription('Number one description')
            )
        .addItems(
            app.buildOptionItem("SELECTION_KEY_TWO",
                            ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
                            .setTitle('Number two')
                            .setDescription('Number two description')
            )
);

更新

我刚刚发现像.setDescription('')这样的空字符串是不可能设置的。它 returns 一个错误。于是,我就和space.setDescription(' ')

相处了