繁体   English   中英

如何为所选实体提供动态答案作为对话流实现中的参数

[英]How to provide dynamic answer for the selected entity as parameter in dialogflow fulfillment

我有一个实体(项目),它的值是('name'、'colour'、'awards')

我有三个意图

Intent1 = Welcome Intent (user will get the options in the form of chips)
Intent2 = Select Option (bot will ask question to enter detail for selected option)
Intent3 = Update Option (bot will save the record and ask next option to update.)

Example - 
bot: welcome! what you want to update? name, colour, awards.
user: name
bot: Enter your name.
user: John
bot: record updated, what to update next? name, colour, awards.

现在的问题是奖项有多个要更新的字段,要更新奖项,用户必须提供三件事(奖项名称、奖项日期、奖项描述)

我想要的是当用户从筹码中选择奖励选项时,应该采取新的意图,我将通过插槽填充获取所有数据。

首先要记住的是,意图代表用户所说的内容,不是您对他们所说的内容进行的操作。 所以说你“去一个意图”是没有意义的。

其次,虽然槽填充看起来是个好主意,但它通常会导致进一步的问题,因为它不能很好地处理条件信息,或者如果用户跳过他们想要更新的内容,它就会处理用户。

所有这些都可以通过在对话中设置状态机、您需要什么信息以及他们迄今为止提供的信息来更好地解决。 根据这些设置,您可以自己提示他们下一步的期望。 (您可能还会发现使用一个或多个 Dialogflow 上下文也有助于确定如何接受结果。)

因此,例如,当用户表示他们正在更新奖励时,它可能会像这样工作:

User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?

User: Merit
[This matches the Fallback Intent with an Input Context for 'awards', since it is free-form input. Your fulfillment stores this and sets the 'awards' context with a parameter that we are now prompting for the date.]
Bot: Got it, the award is named Merit. When was it awarded?

User: Today
[This matches an Intent with a training phrase of "<@sys.date>" and the Input Context of 'awards'. There are also training phrases for things like "It was awarded <@sys.date>" and so forth. Your fulfillment sets the date and sets the 'awards' context with a parameter that we're now prompting for description.]
Bot: Got it. Awarded on March 1st. What is the description?

User: They were awesome.
[This matches the Fallback Intent with the Input Context of 'awards' again, because it is still free-form input. Our fulfillment, however, knows that this is about the description this time, so it stores it and removes the 'awards' context since we've captured everything.]
Bot: I've recorded that as a description of "they were awesome" - sure thing. That was everything we needed for now. Do you want to update the name, colour, or awards next?

这一切看起来很简单。 但是考虑一下对话是否是这样进行的:

User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?

User: [Having done this many times] They were given the award for Honor yesterday
[This might match an Intent with an Input Context of 'awards' and the training phrase of "Given the award for <@sys.any> <@sys.date>" and possibly "<@sys.date> they got an award for <@sys.any>". Your fulfillment sets the name and date from this, sees what information it still needs, and prompts with...]
Bot: Got it. Award named Honor. Awarded March 1. What is the description?

User: Actually, it is named Honorable Service
[This matches an Intent with a training phrase of "named <@sys.any>" and an Input Context for 'awards'. Your fulfillment changes the name stored, checks what we still need, and again prompts...]
Bot: Ok, I've changed the award name to Honorable Service. What is the description?

第一种情况可以通过槽填充和简单提示来处理,但第二种情况不能。 能够处理来自人们的更自然的反应和更灵活的提示对您的用户来说会更好。

暂无
暂无

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

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