簡體   English   中英

如何延長 5 秒超時限制

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

我試圖將 firebase 實時數據庫與 dialogflow 聊天機器人連接起來。 當用戶要求聊天機器人顯示 Board Id 時,它會從數據庫中讀取數據並將該數據顯示給用戶。

我試過這種方式:-

 // 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); });

部署此代碼后,出現錯誤。

錯誤:-“Webhook 調用失敗。錯誤:DEADLINE_EXCEEDED,狀態:URL_TIMEOUT,原因:TIMEOUT_WEB”。

我對此做了一些研究,發現我們可以通過在 webhook 中依次調用最多 2 個意圖的后續事件,將 5 秒的超時限制延長到 15 秒。 但我不知道該怎么做。

有什么辦法可以解決這個 5 秒的響應超時限制嗎?

提前致謝!

Dialogflow 專為持續的用戶交互而設計。 Webhook 有一個限制,即響應必須在 5 秒內發生。

遺憾的是,據我所知,您沒有好的解決方法來延長時間。

我強烈建議在 webhook 服務上閱讀這篇文章

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM