【发布时间】: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