如何在Webhook api.ai中触发多个Intent? [英] How to trigger multiple Intent in Webhook api.ai?

查看:109
本文介绍了如何在Webhook api.ai中触发多个Intent?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个api.ai机器人,它将在数据库中搜索供应商名称。

I am developing an api.ai bot that will search for the Vendor name in the database.

a)如果供应商存在->提供用户名->提供密码

a ) if vendor exist -> provide username -> provide password

b),如果供应商不存在->(添加供应商->是)或(添加供应商->否)

b) if vendor doesn't exist -> (add vendor -> yes ) or (add vendor -> No)

我有一个Webhook正在检查供应商是否存在于数据库中。

I have a webhook which is checking the vendor exist in database or not .

启动场景:(示例)

案例1:

User: Do Alpha exist as a vendor?
Bot: yes, Alpha exist in Database. Please Provide User Name.
User: abc@gmail.com
Bot: Please Provide Password?
User: abcdef
Bot : Welcome

案例2:

User: Do Beta exist as a vendor ?
Bot: No Beta is not a vendor. Do you want to Register?

Case 1:
       User: Yes
       Bot: Please fill this Form.
Case 2:
       User: No
       Bot: Is there any other way I can help

我已经发现的一件事,我必须使用输出上下文来触发意图。但是在这种复杂的情况下我该怎么办呢?以及如何使用Output Context调用多个跟进意图?

One thing I have figured out, I have to use output context to trigger the intent. But how can I do it in this complex case? and how can I call multiple to follow up intent using Output Context?

我可能使用的是错误的方法,还有其他方法可以解决此问题吗?

I might be using a bad approach, Is there any other way to solve this ?

我确实有一个后续问题。

I do have a follow-up question.


  • 当我们通过履行回应返回对话流程。机器人控制台上的响应打印将是默认的文本响应,我如何才能使 fulfillmentText成为响应。

谢谢伙计们这是后续Intent方案。

Thank you Guys. This is the followup Intent scenario.

推荐答案

这并不复杂,您有两个意图收集用户名/密码来做错了。


请尝试以下方式


This is not complex, you are doing it wrong by having two intents for collecting username/password.

Try the following way

当您检测到供应商存在时-在webhook中设置上下文,例如 供应商存在


不存在-在webhook中设置上下文,例如 供应商新的


使用寿命(左侧的数字


为现有供应商创建一个单独的意图-说供应商数据收集以收集用户名和密码。在Dialogflow中将输入上下文设置为 vendor-present 。在这里,您将以相同的意图将它们收集为参数(请参见下图)。将这些参数标记为必需,以便您的机器人必须收集它们。使用提示部分来输入您的回答问题,以收集诸如请提供用户名之类的信息。





如果供应商是不存在,请使用现有的意图,并在Dialogflow中将输入上下文设置为 vendor-new

When you detect that your vendor is present - set the context in webhook, as say, "vendor-present"

When the vendor is not present - set the context in webhook, as say, "vendor-new"

Use lifespan (the number at the left side of the context) to set the lifetime or validity of the context.

Create a separate intent for existing vendor - say "Vendor Data Collection" for collecting username and password. Set input context as "vendor-present" in the Dialogflow. Here you will collect these as parameters in the same intent (see image below). Mark these parameters as 'required' so that they must be collected by your bot. Use the Prompt section to put your response question for collecting information like "Please provide username".

If the vendor is not present, use existing intents and set input context as "vendor-new" in the Dialogflow.

现在,需要注意的几件事-可以使用系统实体 @ sys.given-name 来收集username参数。但是使用非美国/英语名称不是很准确。我不确定这是否有所改善。其次,没有系统实体可以收集密码,因此您需要将该实体设置为 @ sys.any ,并且在Webhook中,您需要使用regex来提取密码。你自己。顺便说一句-您不应该共享密码!

Now, few things to note - the username parameter can be collected using the system entity @sys.given-name. But it is not very accurate with the Non-American/English names. I am not sure if this is improved or not. Secondly, there is no system entity to collect passwords, so you need to set the entity as @sys.any and in the webhook, you need to use regex to extract passwords on your own. BTW - you are not supposed to share passwords!

希望这对您有所帮助!

这篇关于如何在Webhook api.ai中触发多个Intent?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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