r/GoogleAssistantDev • u/qriss • May 20 '19
User specific entities not present as session entities when using direct invocations. Is there a solution?
When adding session entities through the Dialogflow API (apparently currently not working properly with V2), there is a certain delay until the session entities appear in Dialogflow.
This delay can be handled somewhat when the writing of the session entities happens while the conversation is ongoing but it becomes a problem when the user is directly invoking an intent that relies on the session entities. So something like 'Ok Google, what's the status of XYZ?'. In that case Dialogflow is only matching with the developer entities and cannot find a match with the user specific session entities since they are not present yet. The matching seams to happen before any code is run on the fulfillment side. So if the session entities are pushed with the first intent that is sent to the fulfillment (a failed match) it works afterwards. So some seconds later the exact same phrase will match with the session entities since they have now been successfully added.
I've been looking into keeping a copy of the users entities in userStorage to possibly speed up the first API call, instead of getting the entities from a database every time. But so far the delay is still to great for this to work. Or the api push always happens after the match anyways, in which case it's not a problem of timing.
Of course I could add all user entities to the developer entities but that is not very practical either since those entities are supposed to be private.
Is there any way around this?
2
u/afirstenberg GDE May 20 '19
The way I handle this now (or when it worked, anyway) was to leave this as
@sys.anyand then try to do the matching locally when first invoked. This is non-optimal.I've considered something similar where the only thing the Welcome Intent does with invocations such as this load the Session Entity and then call Dialogflow's
detectIntent()via API to do the processing, but this seems kinda messy.