actions-on-google-dialogflow-session-entities-plugin 在 dialogflow 的内联编辑器中不起作用
actions-on-google-dialogflow-session-entities-plugin not working in dialogflow's inline editor
我无法使用此插件在内联编辑器中创建会话实体:actions-on-google-dialogflow-session-entities-plugin。
我声明了 variable/package:
const { sessionEntitiesHelper } = require('actions-on-google-dialogflow-session-entities-plugin');
更新了我的 json 包
"dependencies": {
"actions-on-google": "^2.12.0",
"firebase-admin": "^6.4.0",
"firebase-functions": "^2.1.0",
"dialogflow": "^4.0.3",
"dialogflow-fulfillment": "^0.6.1",
"google-auth-library": "^1.6.1",
"googleapis": "^39.2.0",
"actions-on-google-dialogflow-session-entities-plugin": "^1.0.1"
但是当我调用函数时
let conv = agent.conv();
conv.sessionEntities.add({
name: 'processo',
entities: [{
value: 'descarte',
}, {
value: 'cobrança',
}]
});
conv.sessionEntities.send();
It says that: TypeError: Cannot read property 'sessionEntities' of
null
不知道该怎么做。我找到了很多示例(甚至在这里),但没有一个是在内联编辑器中实现的。
提醒一下,因为我正在使用内联编辑器,所以我在这些函数上下文中:
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
因此,像这样的示例:https://cloud.google.com/dialogflow/docs/entities-session 没有帮助。
我是不是漏掉了什么?
感谢您的帮助,我很感激任何线索...
迭戈·梅斯基塔
问题是您也在使用“dialogflow-fulfillment”库,它不知道如何创建一个conv
对象在调用 agent.conv()
.
时创建了 sessionEntities
对象
最简单的解决方案是停止使用“dialogflow-fulfillment”库,只需使用“actions-on-google”库。你不需要需要使用“dialogflow-fulfillment”只是因为您使用的是内联编辑器。两者非常相似,如果您只是针对 Google 上的操作进行开发,则没有太多理由使用“dialogflow -履行”。
如果您需要使用“dialogflow-fulfillment”,因为除了 Google 上的 Actions 之外,您还需要支持其他平台,事情可能会更棘手。我没试过这个,但像这样的代码可能有效
const entity = {/* Put your entity definition here */};
agent.client.addJson_({sessionEntityTypes: [entity]});
顺便说一句,请记住“dialogflow-fulfillment”包已被弃用,显然支持手动编写 JSON。 “actions-on-google”包也已弃用,因为它不支持 Actions v3 和 Actions Builder/SDK(不使用 Dialogflow)。
我无法使用此插件在内联编辑器中创建会话实体:actions-on-google-dialogflow-session-entities-plugin。
我声明了 variable/package:
const { sessionEntitiesHelper } = require('actions-on-google-dialogflow-session-entities-plugin');
更新了我的 json 包
"dependencies": {
"actions-on-google": "^2.12.0",
"firebase-admin": "^6.4.0",
"firebase-functions": "^2.1.0",
"dialogflow": "^4.0.3",
"dialogflow-fulfillment": "^0.6.1",
"google-auth-library": "^1.6.1",
"googleapis": "^39.2.0",
"actions-on-google-dialogflow-session-entities-plugin": "^1.0.1"
但是当我调用函数时
let conv = agent.conv();
conv.sessionEntities.add({
name: 'processo',
entities: [{
value: 'descarte',
}, {
value: 'cobrança',
}]
});
conv.sessionEntities.send();
It says that: TypeError: Cannot read property 'sessionEntities' of null
不知道该怎么做。我找到了很多示例(甚至在这里),但没有一个是在内联编辑器中实现的。
提醒一下,因为我正在使用内联编辑器,所以我在这些函数上下文中:
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
因此,像这样的示例:https://cloud.google.com/dialogflow/docs/entities-session 没有帮助。
我是不是漏掉了什么?
感谢您的帮助,我很感激任何线索...
迭戈·梅斯基塔
问题是您也在使用“dialogflow-fulfillment”库,它不知道如何创建一个conv
对象在调用 agent.conv()
.
sessionEntities
对象
最简单的解决方案是停止使用“dialogflow-fulfillment”库,只需使用“actions-on-google”库。你不需要需要使用“dialogflow-fulfillment”只是因为您使用的是内联编辑器。两者非常相似,如果您只是针对 Google 上的操作进行开发,则没有太多理由使用“dialogflow -履行”。
如果您需要使用“dialogflow-fulfillment”,因为除了 Google 上的 Actions 之外,您还需要支持其他平台,事情可能会更棘手。我没试过这个,但像这样的代码可能有效
const entity = {/* Put your entity definition here */};
agent.client.addJson_({sessionEntityTypes: [entity]});
顺便说一句,请记住“dialogflow-fulfillment”包已被弃用,显然支持手动编写 JSON。 “actions-on-google”包也已弃用,因为它不支持 Actions v3 和 Actions Builder/SDK(不使用 Dialogflow)。