Dialogflow
Confirmation, Disconfirmation, Farewell Intents
Add the following intents, following the same procedure as you did for the ‘greeting’ intent. Use the intent names as specified below:
confirmation
If a user wants to agree or say ‘yes’.
no
If a user wants to disagree or say ‘no’.
farewell
If a user wants to say 'goodbye'.
Visuals
Add a closing page at the end of the program to bid farewell and thank the user.
%%% Thank you page at the end. page(c43, _, Html) :-
Prolog and Patterns
a50 recipe confirmation patterns in patterns.pl
% Pattern a50recipeCheck: present recipe ingredients and instructions for final check before committing to recipe choice. pattern([a50recipeConfirm, [agent, recipeCheck], [user, confirmation]]). pattern([a50recipeConfirm, [agent, recipeCheck], [user, appreciation]]). % % If user does not like recipe, we go back to the recipe selection stage (a50recipeSelect). pattern([a50recipeConfirm, [agent, recipeCheck], [user, no], [agent, insert(a50recipeSelect)]]).
c43 the farewell pattern
% Pattern C4.3: Closing Farewell (Agent)
% Example:
% A: goodbye
% U: bye
% Instruction:
% 1. Introduce an intent 'farewell' for saying goodbye by adding this intent to your Dialogflow
% agent (for user recognition) and the text.pl file (for agent text generation).
% 2. Add a pattern here where the agent initiates (i.e. starts) saying goodbye and then the user is
% allowed to say goodbye.
% 3. Add a rule in the dialog generation module in the right place to update the session by adding
% the c43 pattern you introduced in step 2.
pattern([c43, [agent, farewell], [user, farewell]]).
responses.pl add
% Intent: recipeCheck
text(recipeCheck, "Can you check the recipe and let me know if you want to cook this?").
% Intent: farewell
text(farewell, "bye").
Extend
last topic check, restart
%%% C4 Patterns: Closing
% Pattern C4.0: Last Topic Check (Agent)
% Example 1:
% A: is there anything else I can help you with?
% U: bye
% A: goodbye
% Example 2:
% A: is there anything else I can help you with?
% U: yes
% A: okay!
% Example 3:
% A: is there anything else I can help you with?
% U: i don't think so
% A: have a good day!
% U: goodbye
% A: bye
% Instruction:
% 1. Introduce intents for 'lastTopicCheck', 'acknowledgement', and a 'wellWish' for the agent (i.e.
% add these to the text.pl file) and the intents 'confirmation' and 'disconfirmation' for the
% user (i.e. add these to your Dialogflow agent). Re-use the 'farewell' intent.
% 2. Add three variants of the last topic check pattern, each with the same c40 pattern id, that
% match the three examples above. For the second variant, use the special agent management
% instruction 'restart' as an intent the agent should perform at the end of the pattern
% variant. You do not need to do anything else than use this intent as it has already been
% implemented for you (see the dialog generation module).
% 3. Add a rule in the dialog generation module in the right place to update the session by adding
% the c40 pattern you introduced in step 2.
% pattern variant 1 (farewell):
pattern([c40, [agent, sessionCloser], [agent, farewell]]).
% pattern variant 2 (confirmation):
% use of special instruction 'restart' to reset agenda to initial agenda at start of session.
%pattern([c40, [agent, lastTopicCheck], [user, confirmation], [agent, acknowledgement],
% [agent, restart]]).
% pattern variant 3 (disconfirmation):
%pattern([c40, [agent, lastTopicCheck], [user, disconfirmation], [agent, wellWish],
% [user, farewell], [agent, farewell]]).
Test it Out
add c43 to agent agenda in dialog_init file
run agent all the way thru from greeting to closing