如何在Dialogflow/Api.ai中管理5秒响应超时限制? [英] How to manage the 5 seconds response timeout limit in Dialogflow / Api.ai?

查看:120
本文介绍了如何在Dialogflow/Api.ai中管理5秒响应超时限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Dialogflow创建一个代理/机器人,该代理/机器人通过诸如我需要从HR来信来证明地址"之类的操作项来响应不同类型的用户查询.这需要机器人从公司的数据库中获取一些信息,并通过在人力资源部提供的模板化信函文件中填充检索到的信息来生成文档/信函.执行此操作的逻辑已经编写在python文件中.数据库集成是使用Webhooks完成的.

I am using Dialogflow to create an agent / bot which responds to different types of user queries with action items like "I need to get a letter from the HR for address proof". This needs the bot to fetch some information from the company's database and generate a document / letter by populating that retrieved information in a templated letter file provided by the Human Resource. The logic to do this action is already written in a python file. The database integration is done using Webhooks.

问题在于,解释用户请求,打开数据库并检索所需信息的完整过程需要5秒钟以上的时间,而这恰好是Dialogflow代理的响应超时限制.我对此进行了一些研究,发现我们不能提高此限制,但可以通过异步调用使会话保持活动状态.我找不到合适的资源来提供答案.

The problem is that this complete process of interpreting the user's request, opening the database and retrieving the required information takes more than 5 seconds, which happens to be the response timeout limit for Dialogflow agents. I have done some research on this and found out that we cannot increase this limit but we can keep the session alive through asynchronous calls. I am not able to find the right resource which provides the answer.

所以,我的问题是-

我们可以在dialogflow中进行异步调用吗?

Can we make asynchronous calls in dialogflow?

如果是,那么我们如何通过json将异步数据发送到Dailogflow代理?

If yes, then how do we send asynchronous data through json to Dailogflow agent?

还有其他方法可以解决5秒钟的响应超时限制吗?

Is there any other way to tackle this 5 seconds response timeout limit?

提前谢谢!

推荐答案

我刚刚检查了实现文档页,确实有5秒的超时限制.

I have just checked the Actions on Google documentation and the Fulfillment documentation pages, and indeed there is a 5-second timeout limit.

这可能不是最好的解决方案,并且可能无法满足您的情况,但请考虑给定的严格5秒钟窗口(我们希望确保动态对话而不会冒着用户等待太久的风险)

This may not be the nicest of the solutions and may not fit your case, but considering the given the strict 5-second window (we want to ensure a dynamic conversation without risking the user waiting for too long)

您以第一个意图异步开始计算,然后返回给用户,并告诉他们在完成计算的同时几秒钟内请求结果.它将被保存在用户的专用空间中,这时用户将触发第二个意图,该意图将要求结果同时已经被预先计算,因此您只需获取并返回它们即可.

You start the computation with your first intent asynchronously and go back to the user and tell them to request the results in a few seconds, in the meantime when the computation is completed. It will be saved in a private space for the user, at which point the user will trigger a second intent that will request the results that in the meantime will have been pre-computed, so you can just fetch and return them.

这篇关于如何在Dialogflow/Api.ai中管理5秒响应超时限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆