【问题标题】:The app Google Assistant - Dialogflow failed to show a table card应用 Google 助理 - Dialogflow 未能显示表格卡片
【发布时间】:2020-08-07 12:22:51
【问题描述】:

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

 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

【问题讨论】:

    标签: google-cloud-functions dialogflow-es actions-on-google dialogflow-es-fulfillment


    【解决方案1】:

    由于表格卡片不可交互,如果您只显示表格,它就会离开对话,因为表格从不期望用户提供任何东西。

    一旦发送了如下表响应,请尝试添加另一个响应。这将保持对话并继续进行。简单地说,球将在用户场上。

    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
      })
    

    【讨论】:

    • 谢谢,但仍然没有回复。表卡前conv.ask(conversation response)系统会响应
    • 是的,你是对的。我错过了第一个。编辑未来的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-04-19
    • 1970-01-01
    • 2023-03-23
    • 2020-03-17
    • 2020-01-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多