Google Assistant的ActionsSdkApp和DialogflowApp有什么区别 [英] What's the difference between ActionsSdkApp and DialogflowApp for Google Assistant

查看:122
本文介绍了Google Assistant的ActionsSdkApp和DialogflowApp有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了构建Google Assistant应用,Google提供了两个不同的API,作为其API的一部分node.js Google行动库:

In order to build a Google Assistant app, Google provides two different APIs as part of their node.js actions-on-google library :

  • ActionsSdkApp
  • DialogflowApp

有一个通用的界面,但是我不了解两者之间的区别以及为什么要使用其中一个.

There have a common interface, but I don't understand what the difference is between the two and why I would use one or the other.

推荐答案

简而言之,这两个对象提供相似(尽管不完全相同)的方法来处理请求,并提供两种默认方法的结果,Google允许您为该对象构建Action助手.

In short, these two objects provide similar (although not identical) methods to handle requests and provide results for two default ways Google allows you to build an Action for the Assistant.

DialogflowApp对象是您可能会用于大多数目的的对象.它旨在与Dialogflow工具一起使用,让它处理自然语言处理(NLP)组件,并将结果(在适当的情况下)传递给您的Webhook.它提供了一些特定于Dialogflow功能的方法,例如上下文,并将其他内容映射到Dialogflow期望的响应格式.

The DialogflowApp object is the one you will likely use for most purposes. It is meant to work with the Dialogflow tool, letting it handle the Natural Language Processing (NLP) components and passing the results, where appropriate, to your webhook. It provides a few methods that are specific to Dialogflow features, such as Contexts, and maps other things to the response format that Dialogflow expects.

如果您正在使用自己的NLP并且您的Webhook直接从Google获取内容(不使用Dialogflow),则可以使用ActionsSdkApp.如果您需要构建actions.json文件,请使用Actions SDK.

The ActionsSdkApp is meant to be used if you are using your own NLP and your webhook is getting things directly from Google (without using Dialogflow). If you need to build an actions.json file, you're using the Actions SDK.

两者都有通用的方法和习惯用法,例如app.ask()app.tell()以及将app.data映射到会话存储等等,即使每种类型的实现细节不同.

Both have common methods and idioms, such as app.ask() and app.tell() and mapping app.data to session storage and so forth, even if the details of implementing these are different for each type.

您应该使用与所用工具匹配的工具.对于大多数新用户-可能是Dialogflow和DialogflowApp对象.

You should be using the one that matches the tool that you're using. For most new users - that will likely be Dialogflow and the DialogflowApp object.

更新

请注意,问题中的API,所询问的特定对象和我的答案中所谈论的特定方法适用于该库的先前版本.

Note that the API in the question, the specific objects asked about, and the specific methods talked about in my answer are for the previous version of the library.

当前库中何时使用ActionSDK与Dialogflow对象的概念仍然有效,因此此问题和解答背后的概念仍然有效,但是技术细节已更改.

The concept of when to use the ActionSDK vs Dialogflow objects in the current library still hold, so the concept behind this question and answer are still valid, but the technical details have changed.

更新-2020年6月

该库现已弃用,因为该库不再适用于Google当前版本的Actions(Actions Builder/SDK AoG v3).如果您仍在使用AoG v2 Actions SDK,它仍可与Dialogflow(使用AoG v2)配合使用.

The library in question is now deprecated, since it no longer works with the current version of Actions on Google (Actions Builder/SDK AoG v3). It still works with Dialogflow (which uses AoG v2) and if you're still using the AoG v2 Actions SDK.

这篇关于Google Assistant的ActionsSdkApp和DialogflowApp有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆