简体   繁体   中英

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

I have a new issue when I add a table card like this, even static table, not dynamic

 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

Since, Table Cards are not interactable, if you only show the table, it leaves the conversation because the table never expect anything from user.

Try adding another response once the table response is sent like below one. This will hold the conversation and keep it going. Simply the ball will be in user court.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM