Google Assistant flow with multiple actions_intent_OPTION handlers

℡╲_俬逩灬. 提交于 2019-12-04 19:04:53

FINALLY works! Thanks @Prisoner!

In Dialogflow...

  1. First list, define the output context
  2. Second list, define the input context and output context
  3. Question after the second list, define the input context

In your webhook...

(The missing piece of the puzzle that made it work) Set the output context for the list options

{
    "speech": "",
    "displayText": "",
    "data": { "google": { ... } },
    "contextOut": [
        {
            "name": "carouselExample",
            "lifespan": 0,
            "parameters": null
        }
    ]
}

Broadly speaking, the problem is that Dialogflow doesn't know where in the conversation you are when it gets the action_intent_OPTION event. For that event, it doesn't try to do Entity matching, but the issue of conversational context is a problem in general (what happens, for example, if you have two different option carousels which have overlapping answers?).

The solution is twofold:

  1. When you send back the response that includes the option information, you should also set an outgoing Context. You can include other information in this Context, but in your case it sounds mostly like you just want to keep track of where you are in the conversation.

  2. You can then differentiate the two Intents with the option event by specifying which context each should be triggered for. Dialogflow will match both the event and the context to determine the best Intent to use.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!