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

问题描述 投票:0回答:1

我有一个实体(项目),其值为('名称','颜色','奖项')

我有三个意图

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.

现在的问题是奖励有多个字段可以更新,要更新奖励,用户必须提供三样东西(奖励名称,奖励日期,奖励说明)

[我想要的是,当用户从芯片中选择奖励选项时,应该将其带到新的意图,在该意图中,我将通过插槽填充获得所有数据。

node.js entity dialogflow actions-on-google dialogflow-fulfillment
1个回答
0
投票

首先要记住的是,一个Intent表示用户说了什么不是您对他们所说的所做的事情。因此,说您“打算去”是没有意义的。

第二,虽然插槽填充似乎是一个好主意,但由于它不能很好地处理条件信息,或者如果用户跳过要更新的内容,也无法处理用户,因此通常会导致其他问题。

通过设置状态机可以更好地解决所有这些问题,这些状态机位于对话中,需要什么信息以及它们到目前为止提供了什么。根据这些设置,您可以自己提示他们接下来的期望。 (您可能还会发现使用一个或几个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?

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

© www.soinside.com 2019 - 2024. All rights reserved.