Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Dialogflow
deleteFilterValue
‘deleteFilterValue’ is useful to deal with a scenario where the user requests to remove a filter that they have already put on specificallyadded beforehand. For example, “I wish to remove the onion filter”, “Forget about excluding broccoli”, and “Can you delete the Chinese cuisine”. Add some training phrases with for all the different filters that user could be deletedwant to delete.
It is important that in your training phrases, you include all filter-related entities in your training phrases, and that these entities are also given specific values and parameter names in the Action and Parameters tables. These entities are given new parameters and value names in order to identify them as a filter to be deleted. Specifically, you tag the entity in your training phrases as normal (e.g. “ingredient”) and then you change the parameter name and value name to “entitynameDel”. Your entity table under Action and Parameters should look like this when you are done.
...
The ‘noMoreFilters’ intent is used when the user does not want to add any more other filters to their recipes list and wishes to see the available recipes.
Prolog and Patterns
a21noMoreFilters
Example:
A: “What other filters would you like to add”add?”
U: “I do not want more filters filters.“
A: “Ok. Here is a list of recipes” recipes.” / “Sorry the list is still too long to show”show.”
a21noMoreFilters pattern handles a user request to not add more feature requests, preferences, or requirements. When filtering the recipes, the user is not shown the list of filtered recipes until there are only 15 (or fewer) recipes. It could be, though, that the user does not wish to filter recipes further. The user would then use the NoMoreFilters intent. The agent can then allow the user to see the list with the ‘grantPicture’ response, or deny with ‘pictureNotGranted’. If the agent grants the user’s request, the pattern should end with the agent updating its memory using ‘[agent, update(['show'='true'])]’. This triggers the showing of recipes by updating the agent’s memory.
...
Multiple text predicates take the argument feature inquiry in responses.pl. Each feature inquiry response is different based on how many recipes there are left to filter.
First Rule for Large Number of Recipes
We want to prompt the user for more specific preferences if there are too many recipes. The rule will be triggered when the length of the list of recipes is greater than 890.
...
If there's a moderate number of recipes (more than 15 but fewer than 891), we ask the user to add more preferences unless a certain memory key-value pair is set.
Repeat the initial steps as of the first rule.
The response text will change to "What other preference would you like to add?".
Set the length condition to be less than 891 and greater than 15.
Include a condition using
not/1
to check that the memory does not have the key-value pair'show', 'true'
.
...
Use the
recipesFiltered/1
predicate again.The response text will be "There are still no recipes, please remove more requirements.".
Check that the length
L
is equal to 0 usingL=0
.
Fourth Rule for a Small Number of Recipes or a Show Command
This rule handles two scenarios: either there's a small number of recipes, or the user has explicitly asked to show the recipes despite the number.
...
Code Block |
---|
% used in a21removeKeyFromMemory for handling deleteParameter. text(removedSpecificFilter(DelFilter), Txt) :- convert_to_string(DelFilter, Str1), string_concat("I removed the ", Str1, Str2), string_concat(Str2, " requirement.", Txt). |
Visuals
Nothing we ask What you to do here visually for this capability . It’s is up to you.
Test it Out
Info |
---|
All done? |