应用 Google 助手 - Dialogflow 无法显示 table 卡片

The app Google Assistant - Dialogflow failed to show a table card

当我像这样添加 table 卡时,我遇到了一个新问题,即使是静态的 table,也不是动态的

 app.intent('static table',(conv)=>{
      conv.ask(new Table({
          dividers : true,
          columns: ['alpha', 'beta', 'price'],
          rows: [
              [`1`, `2`, `3`],
          ],
      }));
  })

app.intent('dynamic table',(conv)=>{
      let row=[];
      var i;
      for (var i=0;i< conv.data.alpha.length;i++){
        row.push([conv.data.alpha[i],`${conv.data.beta[i]}- ${conv.data.beta2[i]}`,`Rp.${conv.data.pricemin[i]}-${conv.data.pricemax[i]}`])
      }
      console.log(row);
      conv.ask(new Table({
          dividers : true,
          columns: ['alpha', 'beta', 'price'],
          rows: row,
      }));
  })

[screenshot]the app is error, but the response debug still give a table card

因为Table卡片不是interactable,如果你只显示table,它会离开对话,因为table 永远不要对用户有任何期望。

一旦发送了 table 响应,请尝试添加另一个响应,如下所示。这将保持对话并继续进行。只是球将在用户场。

app.intent('static table',(conv)=>{
      conv.ask('Here is table details'); // edit this is required
      conv.ask(new Table({
          dividers : true,
          columns: ['alpha', 'beta', 'price'],
          rows: [
              [`1`, `2`, `3`],
          ],
      }));
     conv.ask('Which response would you like to see next?'); // this is missing
  })