DialogFlow parameter reprompt after validation

放肆的年华 提交于 2019-12-12 17:01:21

问题


I have an intent where bot is asking for date to the user. The users might say today, last week, last monday etc.
If the user is saying things like last week or last month (basically things which cannot be converted into an exact date), then bot should prompt again please enter exact date to proceed.

Case 1: taking @sys.date

I have marked this entity as required and set prompt please enter the date, now every time user is saying last week, it is not being detected by @sys.date and user is getting same prompt again and again.

Case 2: taking @sys.date-time

If i take @sys.date-time i am able to get all kind of inputs.
If user said last week, last months etc then I will get startDate in parameter value, if user said today, there will be direct value in parameter.
This can be processed in webhook for slotfilling as well, we can set parameter value to null and invoke same intent again by I am not able to figure out how to set different prompt

params = req['queryResult']['parameters']
date = params['date']
if 'startDate' in date:
    print('inside startDate')
    res = json.dumps({
        'followupEventInput' : {
            'name' : 'e_date',
            "parameters": {
                "date": '',                 
                }
            }
        })

By above code, intent is triggered again but prompt is again same which we have set in DialogFlow console.

I had to take @sys.date as entity because it offers date.recent option which is suitable for my use case, by taking @sys.date-time or @sys.date-period the date DialogFlow is catching is not correct. For example if today is tuesday and user said last monday then Dialogflow will catch monday of last week, not the most recent monday. And there are many cases like this if we are not taking date.recent


回答1:


I recommend to create a other intent having training phrases like: last week or last month. Then have this response prompt the user to be more specific on a date.



来源:https://stackoverflow.com/questions/52575649/dialogflow-parameter-reprompt-after-validation

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