相关疑难解决方法(0)

DialogFlow V2 Webhook - 在异步请求之后立即预测语音响应

我有一个DialogFlow V2 node.js webhook.

我有一个用webhook动作调用的意图:

const { WebhookClient } = require('dialogflow-fulfillment');
const app = new WebhookClient({request: req, response: res});

function exampleIntent(app) {

   app.add("Speak This Out on Google Home!");   // this speaks out fine. no error. 
}
Run Code Online (Sandbox Code Playgroud)

现在,如果我有一个成功完成的异步请求,并且我在成功块中执行app.add,如下所示:

 function exampleIntent(app) {  
      myClient.someAsyncCall(function(result, err) {
          app.add("This will not be spoken out");  // no dice  :(
      }
      // app.add("but here it works... so it expects it immediately");
  }
Run Code Online (Sandbox Code Playgroud)

...然后Dialog Flow不会等待语音返回.我在Response对象中得到错误:

  "message": "Failed to parse Dialogflow response into AppResponse, exception …
Run Code Online (Sandbox Code Playgroud)

node.js actions-on-google api-ai dialogflow-es

5
推荐指数
1
解决办法
4435
查看次数