简体   繁体   English

如何在Dialogflow中构造意图

[英]How To construct Intents in Dialogflow

I'm creating a chatbot to identify questions about store and products and answer accordingly with Dialogflow. 我正在创建一个聊天机器人,以识别有关商店和产品的问题,并使用Dialogflow做出相应的回答。 But when constructing intents I came across this problem. 但是在构造意图时,我遇到了这个问题。 The approaches I think I can construct as follows. 我认为我可以构建的方法如下。

1st Approach 第一种方法

Create multiple intents 创建多个意图

GetPrice, GetColor, GetAvailability, GetType, GetStoreName, GetStoreContact

The difficulty that I found in this approach is I have to create dozens of intents for all product types and for all types of questions about store 我在这种方法中发现的困难是,我必须针对所有产品类型以及有关商店的所有类型的问题创建数十个意图

The advantage is that I can train for the intents seperately. 好处是我可以分别训练意图。

2nd Approach 第二种方法

Create 2 intents 创建2个意图

ProductQuestions, StoreQuestions

The training has to be done for all the 1st approach question types in those 2 必须针对这2种方法中的所有第一种方法问题进行培训

What approach I should take? 我应该采取什么方法? In future this will be more scalable. 将来这将更具可扩展性。

Most logic for conversation design can be based on your personal preferences. 对话设计的大多数逻辑都可以基于您的个人喜好。 If you're looking for best practices, check out Google's documentation here: 如果您正在寻找最佳做法,请在此处查看Google的文档:

https://developers.google.com/actions/assistant/best-practices https://developers.google.com/actions/assistant/best-practices

As per my opinion you should go with 1st approach. 根据我的意见,您应该采用第一种方法。 It is more flexible and scalable. 它更加灵活和可扩展。
You would need to make many intents for sure but you would be able to get what user wants to know exactly. 您需要确定许多意图,但是您将能够获得用户想要确切了解的内容。

In the 2nd approach, you would need to do many things for which you are using DialogFlow. 在第二种方法中,您将需要执行许多要使用DialogFlow的事情。

Try making conversation flow chart before designing the intents. 在设计意图之前,请尝试制作对话流程图。

Using Dialogflow: 使用Dialogflow:

WorkFlow: 工作流程:

  • Open the Actions Console . 打开操作控制台
  • Click on Add/import project. 单击添加/导入项目。
  • Type in a Project name, like "actions-codelab". 输入项目名称,例如“ actions-codelab”。 This name is for your own internal reference; 此名称仅供您内部参考; later on, you can set an external name for your project. 稍后,您可以为项目设置一个外部名称。
  • Click Create Project. 单击创建项目。
  • Rather than pick a category, click Skip on the upper-right corner. 而不是选择类别,而是单击右上角的“跳过”。
  • Click Build > Actions in the left nav. 点击左侧导航栏中的Build> Actions。
  • Click Add your first Action. 单击添加您的第一个操作。
  • Select at least one language for your Action, followed by Update. 为您的操作选择至少一种语言,然后选择“更新”。 For this codelab, we recommend only selecting English. 对于此代码实验室,我们建议仅选择英语。
  • On the Custom intent card, click Build. 在自定义意图卡上,单击生成。 This will open the Dialogflow Console in another tab. 这将在另一个选项卡中打开Dialogflow控制台。

2. Test with Dialogflow: 2.使用Dialogflow进行测试:

Dialogflow generates and uploads an Action package to your actions project automatically when you test it. 在测试时,Dialogflow会自动生成一个动作包并将其上传到动作项目。 To test your Action: 要测试您的操作:

  • Make sure the Web & App Activity, Device Information, and Voice & Audio Activity permissions are enabled on the Activity controls page for your Google account. 确保在Google帐户的“ 活动”控件页面上启用了“网络与应用活动”,“设备信息”以及“语音和音频活动”权限。
  • Click on Integrations in the Dialogflow console's left navigation. 单击Dialogflow控制台左侧导航中的Integrations。
  • Click on the Google Assistant card to bring up the integration screen and click TEST. 单击Google助手卡以显示集成屏幕,然后单击“测试”。 Dialogflow uploads your Action package to Google's servers, so you can test the latest version in the simulator. Dialogflow将您的Action软件包上传到Google的服务器,以便您可以在模拟器中测试最新版本。
  • In the Actions console simulator, enter "talk to my test app" in the Input area of the simulator to test your Action. 在动作控制台模拟器中,在模拟器的“输入”区域中输入“与我的测试应用对话”以测试您的动作。 If you have already specified an invocation name and saved your invocation information, you can start the conversation by saying talk to instead. 如果您已经指定了调用名称并保存了调用信息,则可以通过说出对话来开始对话。

Note : If you don't see a TEST button, you need to click on the AUTHORISE button first to give Dialogflow access to your Google account and Actions project. 注意 :如果没有看到“测试”按钮,则需要首先单击“授权”按钮,以使Dialogflow可以访问您的Google帐户和“操作”项目。

For more information refer below link: 有关更多信息,请参见下面的链接:

https://codelabs.developers.google.com/codelabs/actions-1/index.html#0 https://codelabs.developers.google.com/codelabs/actions-1/index.html#0

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM