简体   繁体   English

为什么我应该在Google Node.js客户端库中的Actions中的actionsdk()之上使用dialogflow()

[英]Why should I used dialogflow() over actionssdk() in Actions on Google Nodejs client Library

Based on the V1 to V2 Node.js Client Library Migration guide there are two ways of listening to conversations 根据V1到V2的Node.js客户端库迁移指南 ,有两种收听对话的方法

so the following code from V1 所以下面的代码来自V1

const {DialogflowApp } = require('actions-on-google');

const actionMap = new Map();

actionMap.set('input.welcome', app => {   app.ask('How are you?'); });

...

can be replaced with either the dialogflow module 可以替换为dialogflow模块

const { dialogflow } = require('actions-on-google');
const app = dialogflow();

app.intent('Default Welcome Intent', conv => {   conv.ask('How are you?'); });

or Actions SDK module 或Actions SDK模块

const { actionssdk } = require('actions-on-google');
const app = actionssdk();

app.intent('actions.intent.MAIN', conv => {   conv.ask('How are you?'); });

In the first case (dialogflow) you recongize the Intent by its name but at the second (actionSdk) you recognize it from the actions name. 在第一种情况(对话框流)中,您通过其名称重新识别了Intent,而在第二种情况(actionSdk)中,您从操作名称中识别了它。

Why should I use one over the other and what are the benefits and limitations of each method? 为什么我要一个接一个地使用?每种方法的优点和局限性是什么?

Both libraries will deliver the transcription of what the user of your Action has said. 这两个库都将传递您的Action用户所说的内容。 Which library you use depends on how you intend to understand the text - to make sense of it and react accordingly. 您使用哪个库取决于您打算如何理解文本-理解文本并做出相应反应。 If you plan to parse it in a bespoke manner or if you have your own natural language processor (aka NLP/NLU) you use the Actions SDK. 如果您打算以定制的方式对其进行解析,或者您拥有自己的自然语言处理器(又名NLP / NLU),则可以使用Actions SDK。 If you don't you can use Dialog Flow as the NLP and its library. 如果不这样做,则可以将Dialog Flow用作NLP及其库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dialogflow webhook(Google上的操作)。 是否应该使用RichResponse? - Dialogflow webhook (Actions on Google). Should I be using RichResponse or not? 如何使用hapi Node.js框架对Google动作对话框进行整数运算? - How to integerate Google actions dialogflow with hapi nodejs framework? 关于dialogflow的意图不会在Google的操作上更新 - Intents on dialogflow not updating on actions on google Google上的操作不起作用,但它们在dialogflow中起作用 - actions on google not working but they does in dialogflow Google Cloud Endpoints客户端库NodeJS - Google Cloud Endpoints client library NodeJS google-actions-如何在nodejs中的Promise中使用mongo-on-google库在对话框流实现中进行mongodb查询? - How to use Promise in node js for mongodb query in dialogflow fulfillment with actions-on-google library? 在Google NodeJS库v2的“操作”中获取选定的选项键 - Get the selected option key in Actions on Google NodeJS library v2 添加训练短语时的 Dialogflow v2 Nodejs 客户端库 UpdateIntent - Dialogflow v2 Nodejs Client Library UpdateIntent when adding Training Phrases 通过 Dialogflow 实现在 Google Actions 上设置上下文 - Set context on Google Actions through Dialogflow fulfillment Google Actions和Dialogflow v2-Webhooks - Google Actions & Dialogflow v2 - webhooks
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM