本文介绍了Dialogflow v2 API和Actions v2 API:必须设置MalformedResponse'final_response'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与Dialgoflow v2 API一起使用Google Actions v2 API。

I'm trying to start working on Google Actions v2 API together with Dialgoflow v2 API.

我有以下示例(到目前为止在Dialogflow->实现Webhook中)取自官方的Google Actions ,但不幸的是,我一直收到 MalformedResponse'final_response'必须设置错误。 p>

I have the following example (so far in Dialogflow -> Fulfillment Webhook) taken from official Google Actions Migration Guide , but unfortunately I keep getting MalformedResponse 'final_response' must be set error.

'use strict';

const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');

const app = dialogflow();

app.intent('Default Welcome Intent', conv => {
  conv.ask('How are you?');
});

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

然后响应为:

{
  "responseMetadata": {
    "status": {
      "code": 13,
      "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
      "details": [
        {
          "@type": "type.googleapis.com/google.protobuf.Value",
          "value": "{\"id\":\"542fe4a8-6017-429f-81c3-61ba568e3659\",\"timestamp\":\"2018-04-19T20:16:25.606Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1524168985362\"}"
        }
      ]
    }
  }
}

请问为什么会这样?

推荐答案

更改此行:

conv.ask('你好吗?');

为此:

conv.close('你好吗?');

c lost 方法为您配置必需的 final_response 字段

the close method configures the required final_response field for you

这篇关于Dialogflow v2 API和Actions v2 API:必须设置MalformedResponse'final_response'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 16:33