问题描述
一切顺利,
我遇到了一种情况,正在为Dialogflow中的 Flights预先构建的代理商建立配送服务。下面是该应用程序中的示例交互。
- 我想从伦敦返回纽约- DialogFlow / Fulfilment back-终端接收用户Ticket-Type [返回],To [New York]和From [London]实体。
- 履行服务以-日期响应你打算旅行吗?例如,下周星期一或4月1日
- 用户输入明天- Dialogflow捕获用户的出发日期实体,我们将其称为出发意图。
- 现在提供退役服务了-
您打算什么时候返回?例如,下周星期一或4月1日,我将其称为返回意图 - 用户在下星期一输入- Dialogflow仍将与步骤3中的出发意图匹配这将导致用户返回相同的返回日期。但是,如果用户输入我将在下周星期一返回,那么返回日期的意图就匹配了。
所以我的问题
是怎么回事,因为我已经捕获了出发数据并且我不能期望用户也使用与日期匹配的短语?
已更新受影响的意图的屏幕截图
-
URL到日志-
通常的解决方案是在您确定出发日期后设置Context。 (例如,您可以将其命名为出发地点设置。)然后,对获取返回日期的Intent进行条件化,以表明它期望出发地点设置在传入上下文中。在这种情况下,与上下文不匹配(或上下文不同)的Intent相比,它更有利于Intent。
您有两个输入上下文,这很好,但这意味着必须同时存在两个 上下文,才能触发Intent。我不知道这两个上下文的寿命是什么,但是我注意到您的出发地点上下文的寿命只有1,这意味着它仅是有效的用户的下一个回应。如果您对航班上下文执行了相同的操作,则此刻在对话中可能不再有效。
Good day All,
I have a situation where am building the fulfilment service for the Flights Pre-built agent in Dialogflow. Below is a sample interaction in the application.
- I want a return flight from London to New York - DialogFlow/Fulfilment back-end picks up the users Ticket-Type[return], To[New York] and From[London] entities.
- The fulfilment service responds with - What date do you plan to travel? E.g next week Monday or 1st of April
- User enters Tomorrow - Dialogflow captures the users Departure Date Entity, we will call this Intent the Departure Intent.
- Fulfilment service now goes on to ask -What date do you plan to return? E.g next week Monday or 1st of April, i will call this the Return Intent
- User enters next week monday - Dialogflow will still match the Departure Intent from step 3 and this will cause a response back to the user for the same Return date. But if the user enters i will return next week monday then then the return date intent is matched.
So my question is how do i make the Return Intent match over the Departure Intent since i have captured the data for Departure and i cannot expect the user to also use the phrase that works with the dates?
Updated with the Screenshots of affected Intents
URL to Logs - https://jsbin.com/wofefivuqo/edit?jssample code
Return Screenshot -
The general solution for this is to set a Context once you have the departure date. (For example, you can call it departure-set.) You then condition your Intent that gets the return date to say it expects departure-set in the Incoming Context. In these cases, it will favor the Intent that has the Context that matches over the one that doesn't (or that has a different Context.)
In your example, you have two Input Contexts, which is fine, but it means that both Contexts must be present for the Intent to be triggered. I don't know what the lifespan is for these two Contexts, but I noticed that your departure-set Context only has a lifespan of 1, which means it will only be valid on the next response from the user. If you did the same thing for the flight Context, then it is likely no longer valid at this point in the conversation.
这篇关于DialogFlow日期意图总是在另一个类似的日期意图上触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!