How to repeat last response of bot in dialogflow

这一生的挚爱 提交于 2020-03-04 07:22:10

问题


I am new to dialogflow.I want to know there is any way on dialogflowto repeat last response of bot ,if I tell "repeat". I have lot of follow-up intent so for each intents not possible to make a follow-up intent Repeat.


回答1:


Libraries like multivocal store the last response and provide a handler for a "repeat" intent that will play the response again.

So all you need to do is use the library and create an Intent such as this with "multivocal.repeat" set as the action and the webhook fulfillment enabled, and it will handle repeats for you:

If you look at the JSON that gets generated as part of each reply, you'll see that it creates a short-lived context with what was just sent. (Here's just a small part of the JSON that illustrates this.)

    {
        "name": "projects/vodo/agent/sessions/A...w/contexts/multivocal_repeat",
        "lifespanCount": 1,
        "parameters": {
            "Ssml": "I'm sorry, I don't know about an attribute named Alpha. What would you like to do now?",
            "Text": "I'm sorry, I don't know about an attribute named Alpha. What would you like to do now?"
        }
    }
],
"payload": {
    "google": {
        "richResponse": {
            "items": [
                {
                    "simpleResponse": {
                        "ssml": "<speak>I'm sorry, I don't know about an attribute named Alpha. What would you like to do now?</speak>",
                        "displayText": "I'm sorry, I don't know about an attribute named Alpha. What would you like to do now?"
                    }
                }
            ]
        },

(Note that I'm the lead maintainer for multivocal, as discussed in the comments below.)




回答2:


There is no out of the box solution. We didn't implement it yet, but we decided that we would just store the latest output in the context and give it out again when the user asks to repeat it. For that you would need to use a webhook which sets the context as required.



来源:https://stackoverflow.com/questions/55160588/how-to-repeat-last-response-of-bot-in-dialogflow

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