For a simple parameter, I can easily set the default value, However I want to mark the parameter as "is list" and then set a default value to it. How can I achieve this?
It was much needed feature for me and I have asked this to Dialoglflow support team. But they said for list value, they have no such support right now. So I have created one workaround.
Let's say "location" is list entity. So you need to create another entity i.e. "location_default" ( can be any name convention).
Value of "location" entity will always be taken from parameter i.e $Location.
Value of "location_default" entity will be #search-context.location where "search-context" is the context maintained between different intents and values are passed through this context.
Hence, everytime you have one extra parameter carrying default value. So, at any step, where "location" entity is empty and "location_default" is not, just assign it back i.e assign value of "location_default" to "location"
Value can be assigned via "context api" mentioned in Reference link of Dialogflow Forums.
Hope this solution works for you, as its working like a charm for me.
I'd suggest adding the "default" value as context when you send the initial request to api.ai - that might do it (I'm not sure if the user provides the parameter in their request if it will override, but I would expect it to).
Related
I am having an issue where dialogflow does a really bad job of matching paramters.
At first I was trying to use specific fields types like #sys.geo-city-us and #sys.given-name, but when I entered a name like Jones it matched it as a city even though I was answering the question about my name.
In the above example I answered the name question and it matched it to the company even though name and company are #sys.any entities. I don't understand why in response to a question for a specific parameter with the entity type of any it fails to match and tries to plug it into another parameter value.
Is there something I am missing about how parameters are matched?
I think this weirdness may be related to doing both #sys.any and setting is list. I ended up doing #sys.any without is list set for the name and then parsing out the names in the code. Then I left city as #sys.geo-city-us. This seems to work for my specific case but I would caution others that multiple #sys.any fields can cause some weirdness, especially with is list set.
I wish there was a setting that when I ask for X whatever the user relies is taken in as X, because that is not what #sys.any is doing.
A number of my Intents respond to the same words - "yes" and "no".
I'm using the inline editor to handle requests/responses.
Because many of the intents respond to the same words "yes"/"no" I set up one entity called response.
So for Intent1 under the Action and parameters tab there is:
parameter: intent1response, entity: #response, value: $intent1response
For Intent2 there is:
parameter: intent2response, entity: #response, value: $intent2response
So basically i'm just changing the parameter and value for each intent but using the same entity.
But that doesn't seem to work and is messing around with contexts, etc. When I change the entity to be unique for each Intent things seem to work fine.
Just wondering if that's correct. I was also just hoping for clarification re: the input box under Actions and Parameters that says "Enter action name" - when an action name is entered here what happens with this action name in fulfilment? Can I just call it to get the parameter?
The short answer is yes, you can use the same Entity in multiple Intents.
The action you specify is passed along to your fulfillment. It isn't a parameter, but is a field that is included.
I'm working my way through the tutorial and I am pretty sure I'm following it closely but it doesn't seem to be working.
I think I've successfully connected the value with the entity, then referenced said value in the response. But it seems like the entity is not responding.
You don't show the text response, but it seems unlikely this will do what you think it does.
As you've written it, the Intent will match if a user says something like "What is the February 10th"? Which doesn't make much sense.
Specifying a parameter against the sample phrase means that you expect the user to say something that matches that parameter in that place. In this case, you're saying the parameter is of type #sys.date, so you're expecting them to say a date of some sort (there are a variety of possible things that will match).
If you want the user to say "What is the date?" as a phrase, then the "date" part shouldn't be associated with a parameter. You'll then need to fill in some value for the reply - likely through a webhook.
Here's what's in my intent:
API.AI seems to resolve the query correctly (red boxes)
It also invokes the right action (blue box and blue arrow)
But the parameter value of "flightId" is empty where it should be 78160 (green boxes)
What is the reason of the problem and why is the score only 0.67?
Update: I just wonder if this is a problem with api.ai because when I remove webhook fulfilment (not shown in the picture), the parameter value for flightId is still empty. BTW, this worked yesterday with a webhook fulfiment. The problem is the parameter value for flightId is missing before any code in the webhook gets executed.
I figured out the problem. The picture does not show, but the problem was I unknowingly created a new entity type called #flightId. The new entity type works similar to an enum type. The first time I ran it, the value was added to the enum collection (can be seen in the entities page) automatically. When I ran with any other values, the parameter will be empty. Until I add them to the enum collection (annotate as matthewayne called it).
So to fix, the problem, I removed the new entity type #flightId completely. No need to make a new entity type. Just make it a #sys.any. There might be some other built-in types that might work as well (#sys.any does not seem like too strongly-typed).
Side note: Now that I read matthewayne's 3rd comment, it kind of makes sense. But the term annotate didn't mean much to me in the beginning.
The technical term given in many articles for this is Template Variables. I am trying to understand how we can find the variable name given in the controller for a specific field of Shopware 5 front end (ex. Product Name)
For example, I can see the template variable for article name has been given as $sArticle.articleName. I found this when I checked the source code manually.
Let’s say I want to find the discount value given for particular product, How can I print this on my theme? What variable I should use and what is the easy way to find it.
I can assign values from back end for all the variables but my question is how I can access them on my theme file when I update my theme when it comes to technical development side.
Please Note: I am trying to understand the shopware5 technical side.
Using the {debug} function will usually give you a list of all assigned variables. This list should also include a variable $Controller which will give you a hint to the currently related Controller.
Unfortunately you are not able to identify where the assigned variables come from. Due to the event driven architecture of Shopware the variables can be assigned to the view after the request has been dispatched to the related Controller. This means that variables might he assigned through third party plugins as well as specific event listeners and store front decorators (in Shopware 5).
Kind regards!
If you want to use your variables inside the template you have to write a plugin and assign your controller-variables to the view.
Check out Globale Variablen im Template verwenden in the shopware documentation.
If you want to use see which variables are allready assigned, you can use {debug} in the template. Also {$sArticle|var_dump} is really helpful, if you want to debug a specific variable ($sArticle} in this example).
You have to known that shopware assigns the members of an object to the view.