简体   繁体   English

IBM Watson Assistant - 如何在 Slots 中使用 input.text

[英]IBM Watson Assistant - how to use input.text inside Slots

I am using IBM Watson Assistant for a chatbot.我正在将 IBM Watson Assistant 用于聊天机器人。 I have a dialog node with two slots.我有一个带有两个插槽的对话节点。 The first slot works fine.第一个插槽工作正常。 The node gets triggered and the bot asks for the first slot, since it is not present.节点被触发并且机器人请求第一个插槽,因为它不存在。

Then I would like to have the bot asking for the second slot.然后我想让机器人要求第二个插槽。 And the answer given should be stored in a $variable.给出的答案应该存储在一个 $variable 中。 I tried to achieve this with input.text , because I want to store every kind of input given there.我试图用input.text来实现这一点,因为我想存储那里给出的每一种输入。

But instead of asking for the second slot the bot skips it and stores the answer given in slot one in the slot two $variable as well.但是,机器人并没有要求第二个插槽,而是跳过它并将插槽一中给出的答案存储在插槽二 $variable 中。 I guess it's because the bot also checks if input.text is present in slot one.我猜这是因为机器人还会检查input.text是否存在于插槽一中。 To make it clear, I have not activated the 'prompt for everything' option.为了清楚起见,我没有激活“提示一切”选项。

How can I overcome this?我该如何克服呢?

I am sure these screenshots of my test environment will make everything more clear:我相信我的测试环境的这些屏幕截图会让一切变得更加清晰:

This is because input.text as a check matches all input, so no matter what you enter your second slot will always be satisfied.这是因为input.text作为检查匹配所有输入,所以无论您输入什么,您的第二个插槽将始终得到满足。

The way slots work is that it doesn't matter in which order the information is given or how much is given.插槽的工作方式是,以什么顺序给出信息或给出多少信息都无关紧要。

For Example: Say I have an ordering system looking for 'product', 'quantity', and 'delivery date'例如:假设我有一个查找“产品”、“数量”和“交货日期”的订购系统

The request 'I want spoons for the 3rd Feb'请求“我想要 2 月 3 日的勺子”

Then two of the slots 'product' and 'delivery date' are satisfied and the output response will be for the prompt for the missing 'quantity' slot.然后两个槽“产品”和“交货日期”得到满足,output 响应将提示缺少“数量”槽。

In your case you need to determine what information you are trying to gather.在您的情况下,您需要确定您要收集哪些信息。 Is there an entity or an intent that is going to uniquely match the input.是否存在将唯一匹配输入的实体或意图。 If so then you could use a slot.如果是这样,那么您可以使用插槽。 As a brute force match you can make the condition for the second slot more complex.作为蛮力匹配,您可以使第二个插槽的条件更复杂。

For example when looking for confirmation of an order you can add in the condition, which only triggers when all above slots have been completed, and you are looking to confirm whether you collected the instructions correctly.例如,在查找订单确认时,您可以添加条件,该条件仅在上述所有槽都完成时触发,并且您正在寻找确认您是否正确收集了指令。

(#yes || #no) && slot_in_focus

If this kind of approach doesn't fit your application then you should gather this information after the node for the slots.如果这种方法不适合您的应用程序,那么您应该在插槽节点之后收集此信息。

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

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