google-cloud-functions - Google Dialogflow:无法读取未定义的属性“EventInput”
问题描述
我试图通过触发事件意图向谷歌对话流对话发送消息,我的代码在节点 14 运行时的云函数中运行。
const dialogflow = require('dialogflow');
const eventName = 'ResultResponse';
const sessionClient = new dialogflow.SessionsClient({projectId: projectId, keyFilename: keypath});
const session = sessionClient.session_path(projectId,sessionId);
event_input = dialogflow.types.EventInput(name=eventName, language_code=LANGUAGE_CODE)
query_input = dialogflow.types.QueryInput(event=event_input)
response = client.detect_intent(session=session, query_input=query_input)
如本问答中所述: 如何从检测意图 API 触发对话流事件?
但是,我收到此错误:
TypeError: Cannot read property 'EventInput' of undefined at triggerCallback (/workspace/index.js:53:34) at exports.Callback (/workspace/index.js:75:3)
这是我的 package.json:
{
"name": "Callback",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"engines": {
"node": "10"
},
"dependencies": {
"actions-on-google": "^2.2.0",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.5.0",
"request-promise-native": "^1.0.9",
"axios": "^0.21.1",
"@google-cloud/storage": "^5.14.0"
}
}
这是我的意图:
我究竟做错了什么?
解决方案
推荐阅读
- html - 为什么 Boostrap 4 dropright selected menu 显示为 Chrome 中的浏览器默认按钮?火狐没有问题
- android - 带有改造的协程 Kotlin Android
- django - Django - 如何修复返回所有项目的空搜索栏
- java - 如何自动将用户定义的对象存储到地图中?
- php - 基于 SQL 结果数的 HTML 表行数
- php - 如何使 Policy Auto-Discovery 新的 Laravel 功能与我在不同文件夹中的模型一起使用?
- javascript - 如何从“表单”中获取 2 个数字并将它们相加,以便输出结果
- java - SimpleMessageListenerContainer 类中的退避用法
- python - 如何根据文本文件绘制训练和验证损失和准确性
- swift - 将 layoutMargins 添加到 UIStackView 中的一个元素