Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page should contain instructions for how to talk with your agent and a start button. We have left some spots for you to fill in your instructions. You can use these slots, but you can also design your own start page. The start page, however, does need to meet some requirements which are mentioned in the User Study section. As a start, put something useful here for your team members. What exactly to put on this page will get clearer towards the end of the project, once you have a working agent, and should be completed at that time. So Hence, make sure to revise this page again later during the project!  

...

  1.  Consider the condition that needs to be true succeed when you generate this page (Hint: look at the start page rule body and how the first parameter of the page/3 predicate is used in that rule).

  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 bot 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 atom needs to be able to add a variable later(the bot’s name) read means that in this second atom there should be a placeholder for the variable with the name of the agent. Read the Visual Support: A 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, thus and the predicate should return the variable Template.

  4. Now we need to get the botagent'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. Save Retrieve the name of the bot as agent in a variable.

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

  6. Lastly, you should take use the variable returned from applyTemplate 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 returned by that returns the page function as you can see in the head of the rule.

Warning

To test, go to dialog_init on line 24, put c10 into the agenda, and run your agent. The line should look like this: insert(agenda([c10])). Note that unless the corresponding c10 pattern and response are also completed in the pattern.pl and reponses.pl , your code will not yet work. Therefore, check with your team members to make sure that they are done with that part. 

...

Most of the rules that you need to complete in the html.pl file for this page has have already been provided to you. All What you still now need to do is specify the conditions to show this page. This page should be shown when there is still a long list of recipes that match with the requests made thus far by a user. For now, as As a start, show this page when the number of filtered recipes is still above 15 and the user is still trying to reduce the list (which is implemented by the a50recipeSelect pattern).

  1. Add a condition that says we should be at the a50recipeSelect step in order to show this page.

  2. Now we need to fetch a list of IDs of the filtered recipes and save that variable as Recipes. There is already a predicate defined that can do this for you somewhere in the bot’s code. 

  3. Measure the length of the list of Recipes. The length should be saved as N (so it matches with the variable naming later in the rule) .

  4. Add a condition that makes sure N is above 15.

The Second Recipe Selection Page (visuals for a50recipeSelect pattern)

...

  1. Add a condition that says we should be at the a50recipeSelect step in order to show this page.

  2. Fetch the list of the IDs of the filtered recipes and name give that variable Recipesthe name ‘Recipes’

  3. Measure the length of the recipe list, and save that variable as 'N'

  4. The final part of this condition should be as follows: ( your count constraint or [YOUR COUNT CONSTRAINT] ; memoryKeyValue('show', 'true') )

...

  1. Make sure this page is shown at the right time.

  2. Retrieve the following information by putting the appropriate predicates in the places indicated in the rule by comments and by using the variable names indicated below.

    1. We need to retrieve the chosen recipe from memory. Find the necessary predicate and name that variable Recipe‘Recipe’.

    2. The previous step retrieves the Recipe ID, but we also need the recipe name. Use a variable called Name ‘Name’ for this.

    3. Retrieve the time needed to complete the recipe in a variable named Minutes‘Minutes’.

    4. Retrieve the number of servings in a variable called Persons‘Persons’.

  3. To retrieve a list of the recipe steps and a list of ingredients, you will need to implement two additional predicates need to be implementedin recipe_selection.pl. The predicates that we need to implement can be found in the recipe_selection.pl file and are labeled with the comment %For Visual Support to-do

    1. The first of the two predicates is a rule that returns a list of ingredients ingredients(RecipeID, IngredientList) :-

      1. Find a built-in Prolog predicate (part of the Prolog language) that you can use for returning a set of ingredients that match a specific goal

      . Use this predicate to specify the ingredient rule.For ingredients use the function from above and to simplify your goal
      1. (i.e. the recipe we are looking at). This predicate should take a list, check elements in the list for compliance with a condition (goal of filtering), then return a list of the elements that comply. When you find the predicate, be sure to read what arguments it takes in the Prolog documentation. You can use Google or look here: https://www.swi-prolog.org/.

      2. In the database, find the predicate that is used to store ingredient information.

      3. Now that we have found the necessary predicate, we need to define the “goal”, i.e. the condition an ingredient has to fulfill to be added to the set. We only want ingredients for a recipe with a certain RecipeID. We will use the predicate in Step 3(a)(i) to retrieve a set of ingredients (list without repetition). We want to output a list of ingredients ('List') by inputting all available ingredient information ('Information') where the inputted recipe ID ('RecipeID') and Information match with the arguments in a predicate with ingredient information found in the database. Those that match should be returned in a List which is outputted by the rule as ‘IngredientList’.

        1. To simplify the condition, you can use the caret (^) in Prolog by defining your goal/ condition in the set predicate with the following syntax:

RecipeID^(

...

databaseIngredientPredicate(RecipeID, inputted Information variable to be filtered))

  1. Find another built-in Prolog predicate to retrieve a list of the recipe steps without changing their order. There is no repetition, so this predicate does not need to remove duplicates (as in the previous step).

  2. Your rule for retrieving the steps needs to use the accompanying rule getStepString in your goal of the built-in Prolog predicate, so your goal should look as follows: ​​RecipeID^getStepStringRecipeID^getStepString(RecipeID, Step).

  3. Go back to html.pl and to a50recipeConfirm

    1. Save the recipe steps as Steps‘Steps’

    2. Save the list of ingredients as Ingredients‘Ingredients’

  4. Figure out a way to add the recipe picture to this page wherever you would like.  You will have to look around or at some bootstrap documentation to complete this step.

...

If you fill in all the blanks described on this instruction page, the visuals will function, but they are not yet very supportive nor very pretty. If you have done this right, however, it will already give you a pass for the project (assuming other parts work well too!). If you would like to go for a higher gradereward for the agent design, you will need to get more creative. Consider how you can redesign and extend the pages that you created above. Think about what will support your users and what will improve user experience. Try and make it visually appealing (though of course, that is subjective!). You can use the material in the visual support guide or any other documentation that you can find. Remember, though, that the visuals should support the conversation, not the other way around! . Good luck!