Dialogflow CX $param not showing in agent text - dialogflow-cx

I am getting into CX and have a simple agent going but I cannot get the agent to respond with my filled parameter.
I have a page that asks for #DrinkFrequency and #DrinkChoice, I see both get filled correctly when I test the agent and $page.params.status = FINAL takes me to my next page that says
So you drink $session.params.DrinkFrequency and prefer to drink $session.params.DrinkChoice
But the agent says exactly that, it does not replace $session.params.DrinkFrequency or $session.params.DrinkChoice with the values the user gave. I know it must be a simple issue but I have tried to write $session.params.DrinkFrequency in a few different ways and I looked at the existing tutorial bots and they also have it with just the $ sign. Am I not saving the user given value?
The page that gets the values has the two parameters and they ask for the value in their "Initial prompt fulfillment" field.

You're referring to the entity type, while the display name is the name of your parameter.
If you replace $session.params.DrinkFrequency with $session.params.frequency and $session.params.DrinkChoice with $session.params.preference it should work.

Related

JavaScript: how to trigger update form after setting input

I am writing a simple App Inventor program to populate a Covid-19 school health check page. I am stuck on selecting a school. Normally you type in a school name, the page finds string matches and you select from the list of string matched school. I am able to simply set the field manually but the rest of the form doesn't update. I know I must trigger an update but I cannot make head or tails of how this page works.
image of school selection
typing in part of school name
From the Chrome console I can do the following:
x = document.getElementsByClassName("k-textbox")
x[1].value = "Horace"
From the picture you can see the text was updated to "Horace" but the results have not updated. What should I do to force an update so the results list shows proper matches? Also, how do I query the matching results so I can confirm that my input was explicit enough to return a single match? FYI, this form entry page will be hidden to the user.
You can get the kendoDropDownList, call the read method from it's dataSource, and pass the locationName value of what you want. This won't set the text in the textbox, but it will filter your list down like you want.
To test, click on the input, open your console, and run the following:
$('#Location').data('kendoDropDownList').dataSource.read({ locationName: 'horace' })

How to use IBM Watson Context variables without entities?

Hi all Watson Developers!
I have a question, exposing that I need to know a bit more about context variables!
A user enters "Who owns the boat DUO ?" and my Dialog then uses the Intent "#owner_of_boatname" That works!
I then want to store the boatname in a variable $boatname, to pass it on to my webhook, as the value "$boatname".
If I create an entity with a list containing all possible boatnames, then it works, but what if I do not have all boatnames, and just want to pick up the $boatname from the user, and pass in on to the weebhook ? How do I fill out the handler then ?
I've tried to just put in "DUO" as value to my webhook, and that works fine, so the webhook itself works - I just need to be able to transfer variables to it!
How ?
Thanks a lot
Lars ;-) enter image description here
The ideal solution for this question should use A.I model created in Watson Knowledge Studio to identify names in user's text and deploy it to Natural Language Understanding instance which you would use the extract the name.
However, we can make a simpler solution, we must assume that the name of the boat will always be at the end of user's input and we can use a regular expression on Watson Assistant to extrat the name. You have to create a node before you pass to the webhook just to identify that user will pass the name of the boat, for example:
Assistant: What is the name of your boat?
User: The name of my boat is boatname
The node that return "What is the name of your boat?" should jump to a node and wait to user request and the condition of this node should always be true. When the user says "The name of my boat is boatname" the node with the condition always true should have context variable with the following regex expression in value context area:
"<? input.text.extract('\s\"?(\w+)\"?$',0) ?>"
This regex rule identify the last word of a phrase with double quotes or not.
Once you have extracted the boat's name you can make the node request you webhook.
Here we are using the SpeL language to access the assistant payload to extrat the last word of a phrase. You can find more information about functions on context variables here here.

Watson Assistant Slots: how to allow the user to re-enter data using non-dictionary entities?

I want to capture the following input from the user and am using these entities:
First and last names: use sys-person (I extract first and last names later using a cloud action).
Email address: use pattern entity, name #contactEmail and value "email" pattern \b[A-Za-z0-9._%+-]+#([A-Za-z0-9-]+.)+[A-Za-z]{2,}\b
Mobile Number: use pattern entity, name #contactPhone and value "mobileNumber" pattern ^[1-9][0-9]{7}[0-9]+$
Slots
I created a node with slots:
The setup is as follows:
Check for:
Check for: #sys-person.literal Save it as $person If not present: Type your name
Check for: #contactEmail.literal Save it as $email If not present: Type your email
Check for: #contactPhone.literal Save it as $contactPhone If not present: Type your mobile.
This all works perfectly and I get the name, email address and Phone number.
The Challenge
But I want the user to be able to confirm that the details are correct.
So I have an intent called #response_yes which is activated by things like "yes", "yep", etc.
And I have a fourth slot that checks for #response_yes.
Check for #response_yes, store the value in $confirmed, if not present ask "Got $person, $contactEmail, $contactPhone is that correct?"
If #response_yes is not found, then it displays the values already typed and asks if they are correct and waits for user input.
After the user has responded, then if the #reponse_yes intent is still not found, then:
Respond with, "Let's start again".
Also, we need to clear the values already typed:
Here's where it goes wrong
When I try the chatbot, the node collects the input correctly and displays the values correctly and asks if they are correct. I type "no", the #response_no intent is correctly divined and I would expect the prompt for the first slot to show again, but it doesn't.
No matter what I type at that point, the assistant bypasses the top three slots and drops to the fourth one again. It's as if I need to clear the entities, not the variables.
What am I doing wrong? How do I make the top slot work again?!
Aaaaargh.
For anyone who's interested, I simply didn't reset the values to null.
I guess I assumed that leaving the value blank was the same as null. Not so. Once I did this, the system worked perfectly:

Web Scrape returns N/A, not sure how to keep the data returning

totally new here & figured you guys will know the answer before I can even come near figuring this out.
I have a google form, feeding a live google sheet which users submit car reg numbers.
My goal is to have the reg number display the make, model besides the reg.
I have implemented an importXML function & the cell I expect to see the data loads up for a few minutes, then reverts to "N/A" or sometimes doesn't pull the data at all, but manually visiting the URL does return the data.
The import XML function uses a cell, made up of URL string, then adds the Reg/VIN input by form submission. That cell looks something like this "basicvehicledetails.com/reg" and returns the Class on the webpage relevant for Make/Model in separate cells.
I need the data to stay once it is returned, but don't know how to do that.
Another option is a car check website that requires a login, and then the reg to be input & searched before a webpage returns in-depth data on the car, is this something I can get to export to google sheet/excel spreadsheet?
I'm really stuck for this one, and would really appreciate any help as updating each car manually is painful.
try like:
=REGEXREPLACE(QUERY(ARRAY_CONSTRAIN(IMPORTDATA(
"https://www.motorcheck.ie/free-car-check/?vrm=152D1234"),5000,1),
"where Col1 contains 'dark-left'", 0), "</?\S+[^<>]*>", )
UPDATE:
=IMPORTHTML("https://www.cartell.ie/ssl/servlet/beginStarLookup?registration=152D1234",
"table", 1)

Is is possible to use variable in dialog prompt in LUIS?

In LUIS if you require some parameters for an action, and add a prompt question, if the parameter is missing, it will send the prompt as a dialog option in the answer.
In my case I have 2 required parameters, and if the 2nd one is missing (the quantity) I'd like the prompt asking for clarification to use the value of the other parameter's value.
For example:
query: I would like to buy tickets to toronto.
dialog prompt should
be: How many tickets to toronto?
I tried setting the prompt to something like "how many tickets to {location}" but obviously this doesn't work.
I haven't found any information on this so I think it's just not possible but I'd like confirmation.
I don't think this is possible out of the box. However, I believe it could be done if you start overriding things here and there.
The main problem is that the LuisActionDialog (the dialog that prompts for parameters) is not receiving the original LuisResult model (which makes sense since it's not serializable).
So, I think that to start looking into this, you will have to:
Override the MessageReceived method from the LuisDialog class, in order to create a new dialog that handles the parameters. Please note that overriding the MakeLuisActionDialog method won't be enough, per what I explained before about not receiving the original LuisResult.
Create a new dialog similar to the LuisActionDialog, that will do what the current dialog does but also performs the prompts manipulation that you are looking to have.

Resources