Hello,
Thanks for this great lib.
I wondered why you are changed the map given to intent Map given to the function handleRequest has changed from action map to intent map ?
Maybe you can add if intent.name not exist in the map, search the action name ?
Thanks
I don't think it's meant to be prescriptive. You can do whatever you want in your project
The Dialogflow action name is still surfaced in agent.action if you'd still like to use it. This change was made to simplify the path from the matched intent to the code you want to run. If you want to use the same function handler for an intent you can still map the same function to multiple intent names in your intent map.
Is there some use case that is made more difficult by intent mapping vs action mapping?
@patou the alternative is to pass a function that returns a Promise. This gives you the flexibility to use actions to trigger handlers.
agent.handleRequest(handlers[agent.action])
I just wonder know why you have changed this thing.
But the action in dialogflow will not have any meaning ?
The problem I see with this is for multilingual applications :
For me the intent name is different in each language because it's translated in each language.
Have you taken a look at the multilingual sample?
My thought was that different languages would require different fulfillment. Is that not the case for your Dialogflow agent?
For some reason I really don't like the fulfillment function called is mapped on the intent name. In the Dialogflow console you specify an action to be used for the intent, it is to be expected this action is used in the fulfillment. Actions could be reused this way in multiple intents. I know I can handle this myself in the way I want, but don't see how this makes things simpler.
@patou I am creating a dialog in 4 languages, but the intent names I use are all the same, do you really have different flows for the different languages? As far as I can tell the name if the intent is not used for the intent matching, only the training phrases are. Those can be translated in different languages for the same intent (with the same intent name)
@matthewayne Personally I want to keep all dialog texts out of the fulfillment handler and use fullfilment only for things not possible in a dialog, such as calling a back-end service.
I now see a trend where a big part of the dialog is created inside the fulfillment handler. I know I don't have to do this myself, but I am not sure this is a move in the right direction or sets a right example.
Here is how I do it:
In my dialogs the fulfillment calls the a method based on the action name used in the Intent.
So action-name instead of intent-name mapping. Then the action triggers an event for the dialog to continue using agent.setFollowupEvent() (with parameters if needed). Another Intent 'listens' to this event, it has no training phrases and outputs the (translatable) response at Responses. In case the used language matters, this is also passed along to the back-end service, so if a text (like a product name) needs to be returned, it is returned in the correct language.
@rogierhofboer Thanks for the response. I agree with you, just the instant name is translated in each language.
I want the same method for not have text. I will use this.
I write a mail to dialogflow to add the ability to use responses with variables from the fulfillment and give your comment in exemple.
Thanks.
@patou I don't know if we mean the same, but you can use variables from the fulfillment.
If from your handler you do:
agent.setFollowupEvent({ "name": "myevent", "parameters" : { "score": "89"}});
and create an intent where add myevent to Events, you can use #myevent.taste to get the value good, both as values for a parameter at Action and parameters and at Responses, for example:
The score is #myevent.score points.
(Event parameters are set as context variables with a lifetime of 0.)
If your action needs to return text, my solution is to pass the current language (it is in the intent request) to the back-end service, so it can return the text in the right language. Then by setting the followup event, the next (multi-language) intent is triggered and gets the text in the right language as input parameter.
So in my view there is no functionality missing, it is only I don't 'like' a lot of text / dialog is added to action handlers.
guys i know this is off the topic But can anyone please help me with my issue?
To brief in about my problem
i want to trigger the" actions on google helper intents" from my code webhook / flask application.
Few more details:
->am using python and i have used heroku virtual environment for deploying the app
i have tried to import googlemaps and call geolocate method but it is expecting atleaset one attribute and i am unable to figure out what is the input parameter
Thanks in advance any help is appreciated
@nuronics Please create a new issue
i would like to map actions (not intends) too. I want to modify every response in a specific way (add a 'can I do anything else for you?' like ending). If i can trigger this on action name, i dont have to modify code, and can make it work just by adding a new intent. This could be done by others, not familiar to the code, ad well....
For now i'll use the default (intentMap.set(null, addAnythingElseToResponse);)
(not well documented by the way, ill create a PR)
also, using the action would decouple the intentname (owned by the dialogflow intent list owner) from the name used in the code (owned by the developer of the API). I think this would be better. It is convenient to be able to leave the action blank, but that could be solved by using action if its there, or else intent....
Most helpful comment
For some reason I really don't like the fulfillment function called is mapped on the intent name. In the Dialogflow console you specify an action to be used for the intent, it is to be expected this action is used in the fulfillment. Actions could be reused this way in multiple intents. I know I can handle this myself in the way I want, but don't see how this makes things simpler.
@patou I am creating a dialog in 4 languages, but the intent names I use are all the same, do you really have different flows for the different languages? As far as I can tell the name if the intent is not used for the intent matching, only the training phrases are. Those can be translated in different languages for the same intent (with the same intent name)
@matthewayne Personally I want to keep all dialog texts out of the fulfillment handler and use fullfilment only for things not possible in a dialog, such as calling a back-end service.
I now see a trend where a big part of the dialog is created inside the fulfillment handler. I know I don't have to do this myself, but I am not sure this is a move in the right direction or sets a right example.
Here is how I do it:
In my dialogs the fulfillment calls the a method based on the action name used in the Intent.
So action-name instead of intent-name mapping. Then the action triggers an event for the dialog to continue using agent.setFollowupEvent() (with parameters if needed). Another Intent 'listens' to this event, it has no training phrases and outputs the (translatable) response at Responses. In case the used language matters, this is also passed along to the back-end service, so if a text (like a product name) needs to be returned, it is returned in the correct language.