获取不成功的 webhook 调用:无法将 JSON 转换为 @assistant/conversation 中 table 的 ExecuteHttpResponse

Getting Unsuccessful webhook call: Failed to translate JSON to ExecuteHttpResponse for table in @assistant/conversation

我正在尝试使用新的 @assistant/conversation 在我的云函数中显示 table 和数据数组,但是当我测试操作时我收到如下错误

webhook 调用失败:无法将 JSON 转换为 ExecuteHttpResponse

但是当我检查日志时,我得到的行值如下所示

 {
  "responseJson": {
    "session": {
      "id": "ABwppHE5M8EGlWf3YmpUUGPQ5xxHh-cb2QYyF_YUarZbF_jXq-Ad2iKDtyI8XAyvWPp4hHnQockBWMZuQA",
      "params": {},
      "languageCode": ""
    },
    "prompt": {
      "override": false,
      "content": {
        "table": {
          "button": {},
          "columns": [
            "Date",
            "Time",
            "Place"
          ],
          "image": {},
          "rows": [
            "20-10-2020",
            "11:20",
            "Test"
          ],
          "subtitle": "",
          "title": ""
        }
      }
    }
  }
}

下面是我在conv

中添加table的实现
const tempDatas = ['20-10-2020', '11:20', 'Test'];
  conv.add(
    new Table({
      dividers: true,
      columns: ['Date', 'Time', 'Place'],
      rows: tempDatas
    })
  );

我在 google-actions 插件中使用了相同的逻辑,它在那里工作 fine.I 已经导入 Table 如下所示

const { conversation, Table } = require('@assistant/conversation');

已解决问题。新的动作构建器提供的结构与旧的稍有不同

新结构:

conv.add(new Table({
    'title': 'Table Title',
    'subtitle': 'Table Subtitle',
    'image': ASSISTANT_LOGO_IMAGE,
    'columns': [{
      'header': 'Column A',
    }, {
      'header': 'Column B',
    }, {
      'header': 'Column C',
    }],
    'rows': [{
      'cells': [{
        'text': 'A1',
      }, {
        'text': 'B1',
      }, {
        'text': 'C1',
      }],
    }, {
      'cells': [{
        'text': 'A2',
      }, {
        'text': 'B2',
      }, {
        'text': 'C2',
      }],
    }, {
      'cells': [{
        'text': 'A3',
      }, {
        'text': 'B3',
      }, {
        'text': 'C3',
      }],
    }],
  }));

你可以像下面这样简化它,这就是我上面问题的解决方案

const tableRows = [];
tablesRows.push({ 'cells': [{ 'text': moment(data.date).format('DD-MM-YYYY') }, { 'text': data.time }, { 'text': data.place }] });


conv.add(new Table({
    'columns': [{
      'header': 'Date',
    }, {
      'header': 'Time',
    }, {
      'header': 'Place',
    }],
    'rows': tablesRows,
  }));

有关详细信息,请访问 conversation components