简体   繁体   English

Watson Assistant Slots:如何允许用户使用非字典实体重新输入数据?

[英]Watson Assistant Slots: how to allow the user to re-enter data using non-dictionary entities?

I want to capture the following input from the user and am using these entities:我想从用户那里捕获以下输入并使用这些实体:

  • First and last names: use sys-person (I extract first and last names later using a cloud action).名字和姓氏:使用 sys-person(我稍后使用云操作提取名字和姓氏)。
  • Email address: use pattern entity, name @contactEmail and value "email" pattern \b[A-Za-z0-9._%+-]+@([A-Za-z0-9-]+.)+[A-Za-z]{2,}\b Email 地址:使用模式实体,名称@contactEmail 和值“电子邮件”模式\b[A-Za-z0-9._%+-]+@([A-Za-z0-9-]+.)+[ A-Za-z]{2,}\b
  • Mobile Number: use pattern entity, name @contactPhone and value "mobileNumber" pattern ^[1-9][0-9]{7}[0-9]+$手机号码:使用模式实体,名称@contactPhone 和值“mobileNumber”模式^[1-9][0-9]{7}[0-9]+$

Slots插槽

I created a node with slots:我创建了一个带插槽的节点:

插槽

The setup is as follows:设置如下:

Check for:检查:

  • Check for: @sys-person.literal Save it as $person If not present: Type your name检查:@sys-person.literal 将其另存为 $person 如果不存在:输入您的姓名
  • Check for: @contactEmail.literal Save it as $email If not present: Type your email检查:@contactEmail.literal 将其另存为 $email 如果不存在:输入您的 email
  • Check for: @contactPhone.literal Save it as $contactPhone If not present: Type your mobile.检查:@contactPhone.literal 将其另存为 $contactPhone 如果不存在:输入您的手机。

This all works perfectly and I get the name, email address and Phone number.这一切都很完美,我得到了名字,email 地址和电话号码。

The Challenge But I want the user to be able to confirm that the details are correct.挑战但我希望用户能够确认详细信息是正确的。 So I have an intent called #response_yes which is activated by things like "yes", "yep", etc.所以我有一个名为#response_yes 的意图,它由“yes”、“yep”等内容激活。

And I have a fourth slot that checks for #response_yes.我有第四个插槽来检查#response_yes。

  • Check for #response_yes, store the value in $confirmed, if not present ask "Got $person, $contactEmail, $contactPhone is that correct?"检查#response_yes,将值存储在 $confirmed 中,如果不存在,请询问“Got $person, $contactEmail, $contactPhone 是否正确?”

确认

If #response_yes is not found, then it displays the values already typed and asks if they are correct and waits for user input.如果未找到#response_yes,则显示已输入的值并询问它们是否正确并等待用户输入。

After the user has responded, then if the #reponse_yes intent is still not found, then:用户响应后,如果仍然没有找到 #reponse_yes 意图,则:

重新开始

Respond with, "Let's start again".回复“让我们重新开始吧”。 Also, we need to clear the values already typed:此外,我们需要清除已经输入的值:

清除值

Here's where it goes wrong When I try the chatbot, the node collects the input correctly and displays the values correctly and asks if they are correct.这是出错的地方当我尝试聊天机器人时,节点正确收集输入并正确显示值并询问它们是否正确。 I type "no", the #response_no intent is correctly divined and I would expect the prompt for the first slot to show again, but it doesn't.我输入“no”,#response_no 意图被正确预测,我希望第一个插槽的提示再次显示,但事实并非如此。

问题

No matter what I type at that point, the assistant bypasses the top three slots and drops to the fourth one again.无论我此时输入什么,助手都会绕过前三个位置并再次下降到第四个位置。 It's as if I need to clear the entities, not the variables.就好像我需要清除实体,而不是变量。

What am I doing wrong?我究竟做错了什么? How do I make the top slot work again?!如何使顶部插槽再次工作?!

Aaaaargh.啊啊啊。

For anyone who's interested, I simply didn't reset the values to null.对于任何感兴趣的人,我只是没有将值重置为 null。

I guess I assumed that leaving the value blank was the same as null.我想我假设将值留空与 null 相同。 Not so.不是这样。 Once I did this, the system worked perfectly:一旦我这样做了,系统就会完美运行:

将值设置为空!

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

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