actions在dialogflow的内联编辑器

actions在dialogflow的内联编辑器

本文介绍了google-dialogflow-session-entities-plugins-on-actions在dialogflow的内联编辑器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用以下插件在Inline Editor中创建会话实体:actions-on-google-dialogflow-session-entities-plugin.

I haven't been able to create a Session Entity in Inline Editor, using this plugin: actions-on-google-dialogflow-session-entities-plugin.

我声明了变量/包:

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();

无法弄清楚该如何工作.我发现了很多示例(即使在这里),但在Inline Editor中没有实现.

Can't figure out how to make that work. I found lots of examples (even here) but no one implemented in Inline Editor.

提醒一下,当我使用Inline Editor时,我位于以下函数上下文中:

Just a reminder, as I'm using Inline Editor, I'm inside these functions context:

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });

因此,例如以下示例: https://cloud.google.com/dialogflow/docs/entities-session 没有帮助.

So, examples like this one: https://cloud.google.com/dialogflow/docs/entities-session did not help.

我想念什么吗?

感谢您的帮助,感谢您提供线索...

Thanks for helping, I appreciate any clue...

迭戈·梅斯基塔

推荐答案

问题是您使用"dialogflow-fulfillment"库,并且它不知道如何创建在调用agent.conv()时也创建了sessionEntities对象的conv对象.

The issue is that you're also using the "dialogflow-fulfillment" library, and it doesn't know how to create a conv object that also has the sessionEntities object created when you call agent.conv().

最简单的解决方案是停止使用"dialogflow-fulfillment".库和 just 使用"Google行动"图书馆.您不需要使用"dialogflow-fulfillment"只是因为您使用的是内联编辑器.两者相当相似,如果您只是在Google上为Actions开发,则没有太多理由使用"dialogflow-fulfillment".

The easiest solution is to stop using the 'dialogflow-fulfillment" library and just use the "actions-on-google" library. You don't need to use "dialogflow-fulfillment" just because you're using the Inline Editor. The two are fairly similar, and if you're just developing for Actions on Google, there isn't much reason to use "dialogflow-fulfillment".

如果您需要使用"dialogflow-fulfillment"由于除了Google的Actions之外,您还需要支持其他平台,因此事情可能会比较棘手.我没有尝试过,但是类似这样的代码可能有用

If you need to use "dialogflow-fulfillment" since you need to support other platforms besides Actions on Google, things may be trickier. I haven't tried this but code something like this might work

  const entity = {/* Put your entity definition here */};
  agent.client.addJson_({sessionEntityTypes: [entity]});

顺便说一句,请记住,对话流实现"是指软件包已被弃用,显然是赞成手动编写JSON. "Google行动"该软件包也已弃用,因为它不支持Actions v3和Actions Builder/SDK(不使用Dialogflow).

As an aside, keep in mind that the "dialogflow-fulfillment" package has been deprecated, apparently in favor of writing the JSON manually. The "actions-on-google" package has also been deprecated as it does not support Actions v3 and the Actions Builder/SDK (which do not use Dialogflow).

这篇关于google-dialogflow-session-entities-plugins-on-actions在dialogflow的内联编辑器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 11:36