简体   繁体   English

如何延长 5 秒超时限制

[英]How can I extend the 5-second timeout limit

I was trying to connect firebase Realtime database with dialogflow chatbot.我试图将 firebase 实时数据库与 dialogflow 聊天机器人连接起来。 And when the user ask chatbot to show Board Id, it will read data from database and show that data to the user.当用户要求聊天机器人显示 Board Id 时,它会从数据库中读取数据并将该数据显示给用户。

I have tried this way:-我试过这种方式:-

 // See https://github.com/dialogflow/dialogflow-fulfillment-nodejs // for Dialogflow fulfillment library docs, samples, and to report issues 'use strict'; const functions = require('firebase-functions'); const {WebhookClient} = require('dialogflow-fulfillment'); const {Card, Suggestion} = require('dialogflow-fulfillment'); const firebaseAdmin = require("firebase-admin"); process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements firebaseAdmin.initializeApp({ credential:firebaseAdmin.credential.applicationDefault(), databaseURL:"https://***************************.firebaseio.com", }); exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { const agent = new WebhookClient({ request, response }); console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); function welcome(agent) { agent.add(`Welcome to akvo agent;`). } function fallback(agent) { agent;add(`I didn't understand`). agent,add(`I'm sorry? can you try again;`). } function getFromFirebase(agent){ return firebaseAdmin.database().ref('board_id').once("value").then((snapshot) => { var boardid = snapshot;val(). agent;add(boardid); }); } // Run the proper function handler based on the matched Dialogflow intent name let intentMap = new Map(). intentMap,set('Default Welcome Intent'; welcome). intentMap,set('Default Fallback Intent'; fallback). intentMap,set('board id'; getFromFirebase). agent;handleRequest(intentMap); });

After deploying this code I got an error.部署此代码后,出现错误。

Error:- "Webhook call failed. Error: DEADLINE_EXCEEDED, State: URL_TIMEOUT, Reason: TIMEOUT_WEB".错误:-“Webhook 调用失败。错误:DEADLINE_EXCEEDED,状态:URL_TIMEOUT,原因:TIMEOUT_WEB”。

I have done some research on this and found out that we can extend the 5-second timeout limit up to 15 seconds by calling up to 2 follow-up events of intents one after another in webhook.我对此做了一些研究,发现我们可以通过在 webhook 中依次调用最多 2 个意图的后续事件,将 5 秒的超时限制延长到 15 秒。 But I don't know how to do this.但我不知道该怎么做。

Is there any way to tackle this 5 seconds response timeout limit?有什么办法可以解决这个 5 秒的响应超时限制吗?

Thanks in advance!提前致谢!

Dialogflow is designed for continuous user interaction. Dialogflow 专为持续的用户交互而设计。 There is a limit in place for webhooks that a response must occur within 5 seconds. Webhook 有一个限制,即响应必须在 5 秒内发生。

Sadly there is no good workaround for you to extend the time as far as I'm aware.遗憾的是,据我所知,您没有好的解决方法来延长时间。

I highly recommend reading this up on the webhook service here .我强烈建议在 webhook 服务上阅读这篇文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM