node.js - 将 DialogflowConversation 与 Fulfillment SDK 集成时出现异常
问题描述
我正在使用 Node.js Fulfillment SDK ( https://github.com/dialogflow/dialogflow-fulfillment-nodejs ),我想集成 de DialogflowConversation 以访问用户存储。
我正在尝试使用这个简单的代码:
let conv = agent.conv();
conv.ask("HEY");
agent.add(conv);
但是服务器因以下异常而失败:
Error: No responses defined for platform: ACTIONS_ON_GOOGLE
at V2Agent.sendResponses_ (/srv/node_modules/dialogflow-fulfillment/src/v2-agent.js:243:13)
at WebhookClient.send_ (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:505:17)
at promise.then (/srv/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:316:38)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
我目前正在使用这个库:
"dependencies": {
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow-fulfillment": "^0.6.1",
"actions-on-google": "^2.5.0",
"i18n": "^0.8.3"
}
我究竟做错了什么?
谢谢
解决方案
我想这就是您正在做的事情,导致所述错误。尝试仅使用 Google 上的操作。
这应该可以解决您的错误:
agent.add("HEY");
要访问用户存储,请使用如下所示的 actions-on-google 库:
'use strict';
const {
dialogflow,
} = require('actions-on-google'); // Import the firebase-functions package for deployment.
const functions = require('firebase-functions'); // Instantiate the Dialogflow client.
const app = dialogflow({
debug: true
});
app.intent('WELCOME', (conv) => {
conv.data.count = 1;
conv.ask('Hi there, what can I help you with today?');
});
推荐阅读
- javascript - 在异步函数中使用 done 参数时测试不会失败
- python - 如何从嵌套列表中删除循环(无限)符号?
- r - 在 shiny.io 上下载 wordcloud2 输出不起作用
- php - 不要渲染 bitrix 组件
- three.js - 沿椭圆路径移动对象
- java - 如何在继续之前等待方法调用完成
- jdbc - 从缓冲区获取结果时出错。Simba JDBC BigQuery 驱动程序
- angular - 错误消息在 ngx-datatable 中无法正常工作
- javascript - JavaScript PDF 电子邮件不提示
- android - Android中的LTR抽屉导航菜单项