Dialogflow v2 API + Actions v2 API:MalformedResponse' final_response'必须设定

时间:2018-04-19 20:24:42

标签: actions-on-google dialogflow

我尝试与Dialgoflow v2 API一起开始使用Google Actions v2 API。

我有以下示例(目前为止在Dialogflow - > Fulfillment Webhook中)取自官方Google操作Migration Guide,但不幸的是我一直在 MalformedResponse' final_response'必须设置错误。

'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\"}"
        }
      ]
    }
  }
}

请知道为什么会发生这种情况?

1 个答案:

答案 0 :(得分:6)

更改此行:

conv.ask('How are you?');

到此:

conv.close('How are you?');

close方法为您配置所需的final_response字段