Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
typelist
printablefalse

Dialogflow

Tip

Before you start: make sure your MARBEL agent is connected to Dialogflow.

...

Tip

Check that your greeting intent is working by using the microphone button in the test console on the DIalogflow console page. Try various phrases also using the test console and check whether what you say is recognized as a greeting intent.

Prolog and Patterns

Greeting pattern without self-identification

...

Warning

When you have added a name for your agent, and the new pattern and rule for generating a self-identifying phrase, you can now Run your Conversational Agent again to hear your agent self-identify itself.

Visuals

Welcoming Page

When a user has visited the Start page and clicked on the Start button, your agent should start by greeting its user. But we would also like to show a webpage that welcomes the user and is shown while the greeting pattern c10 is active and ongoing. A new page should be shown if only because we need to provide the user with the ability to start talking too by clicking on the microphone icon.

As before, we need to introduce a rule for generating a webpage. The head of this rule should be page(c10, _, Html). The main requirement for this page is that it shows a microphone icon that the user can use to start We advise you to reuse the same overall structure for the Prolog rule as for the Start page you created in the html.pl file. Add your rule for the welcoming page also to the html.pl file.

The main requirement for this page is that it shows a microphone icon that the user can use to start talking to the agent. All you need to do for this is to create a page with a header. Other ideas for this page could A second requirement is that your page should not have a button for moving on to a next page! Progress should be made by talking from now on! Ideas for this page could be to show a greeting, and introduce your agent by showing its name.

...

Next we provide some suggestions on how you could proceed with creating the welcoming page for your agent:

  1.  As a start, consider the condition that needs to succeed when you generate this page (is generated. Hint: look at the start page rule body and rule for the Start page and check out how the first parameter argument of the page/3 predicate is used in that rule) head of this rule is reused for defining the condition for showing the page.

  2. Think about what you want to be on this page. It needs somewhere to show text to introduce your agent. For this, you can use a card or an alert, for example. This will be the first atom in your HTML code that we use in Step 3. The second atom should be HTML code with text(formatted) to introduce your agent, i.e. what you want to go on your alert or card. In Step 5 we need to format the HTML code by formating the Prolog string with ‘applyTemplate’. This means that in this second atom there should be a placeholder for the variable with the name of the agent. Read the Visual Support Guide for hints on how to do that.

  3. Use a predicate to combine the first atom and second atom you created in the previous step (check out the Visuals Guide for how to do this). What we created in HTML above is our template, and the predicate should return the variable Template.

  4. Now we need to get the agent's name in order to add it to our text. This knowledge should be somewhere in the agent's memory. Hint: Look at line 40 in dialog_init for the applicable predicate. Retrieve the name of the agent in a variable.

  5. Next, you should use the applyTemplate/3 predicate to add the agent’s name to our HTML code atom (which is also explained in the Visual Support Guide).

  6. Lastly, you should use the last variable that you used in the applyTemplate/3 predicate and use the html/2 predicate to convert your code snippet into a completed HTML page. This can be done by using html(YourCompleteHTMLCodeVariableHere, Html). Html is the variable that returns the page as you can see in the head of the rule.the design of your welcoming page. What should the page look like? You can show text which introduces your agent somewhere, using the agentName(Name) fact to retrieve its name, for example (if you do, also take into account what should happen if the agent has no name!). You can use a https://www.w3schools.com/bootstrap4/bootstrap_jumbotron.asp, https://www.w3schools.com/bootstrap4/bootstrap_alerts.asp, or other Bootstrap component to display the text. You can add other visual elements using images, or add more advanced layouts for your page. Check out the Visual Support Guide for more on how to use these components.

  7. As before, try to organize the structure of your page into several segments or rows and organize the code for generating HTML in your rule to reflect this same structure. Then piece together the various parts of the page as you have seen before (if you have more than one part) and, finally, as a last step, use the html/4 predicate to generate the content for the body of your HTML webpage.

Whether you followed our suggestions above or not, make sure your welcoming page looks inviting!

Run It!

Make sure you have added the c10 pattern to the agent’s agenda in the dialog_init.mod2g file. Then test your agent. When you run your conversational agent, you should:

...