DialogFlow date intent always triggered over another similar date intent

瘦欲@ 提交于 2020-02-25 06:06:55

问题


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.

  1. 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.
  2. The fulfilment service responds with - What date do you plan to travel? E.g next week Monday or 1st of April
  3. User enters Tomorrow - Dialogflow captures the users Departure Date Entity, we will call this Intent the Departure Intent.
  4. 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
  5. 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

  1. URL to Logs - https://jsbin.com/wofefivuqo/edit?js sample code

  2. Return Screenshot -


回答1:


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.



来源:https://stackoverflow.com/questions/49619342/dialogflow-date-intent-always-triggered-over-another-similar-date-intent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!