【问题标题】:Actions-on-google library List and Carousel not workingActions-on-google 图书馆列表和轮播不起作用
【发布时间】:2020-06-05 09:38:32
【问题描述】:
    ```
'use strict';
const functions = require('firebase-functions');
const { Button, dialogflow, BrowseCarouselItem, BrowseCarousel, Suggestions, List } = require('actions-on-google');
const axios = require('axios');

const app = dialogflow({ debug: true });

app.intent('Welcome', (conv) => {
    conv.ask(new BrowseCarousel({
        items: [
            new BrowseCarouselItem({
                title: 'Title of item 1',
                url: 'https://example.com',
                description: 'Description of item 1',
                image: new Image({
                    url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
                    alt: 'Image alternate text',
                }),
            }),
            new BrowseCarouselItem({
                title: 'Title of item 2',
                url: 'https://example.com',
                description: 'Description of item 2',
                image: new Image({
                    url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
                    alt: 'Image alternate text',
                }),
            }),
        ],
    }));
});

// Run the proper function handler based on the matched Dialogflow intent name
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

我将 Dialogflow 与 actions-on-google 一起使用,但我遇到了问题。在创建任何丰富的消息响应时,机器人只会崩溃而没有任何错误。我还升级和降级了 actions-on-google 库的版本,但仍然面临同样的问题。

【问题讨论】:

  • 您可以尝试添加另一个带有介绍文本的 conv.ask() 吗?大多数视觉元素要求您与元素一起至少发送 1 条消息。
  • 如果它崩溃了,你应该检查服务器日志看看它是什么。

标签: node.js dialogflow-es actions-on-google dialogflow-es-fulfillment


【解决方案1】:

在 DialogFlow 中使用 Lists 和 Carousel 需要一个额外的简单响应,例如 conv.ask("this is a list") 在丰富的响应之前。正如documentation中所写的那样

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    • 2012-09-18
    相关资源
    最近更新 更多