簡體   English   中英

應用 Google 助理 - Dialogflow 未能顯示表格卡片

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

我在添加這樣的表卡時遇到了一個新問題,即使是 static 表,也不是動態的

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

[截圖]app報錯,但是響應debug還是給一張表卡

因為,表格卡片是不可交互的,如果你只顯示表格,它就會離開對話,因為表格從不期望用戶提供任何東西。

一旦發送了如下表響應,請嘗試添加另一個響應。 這將保持對話並繼續進行。 簡單地說,球將在用戶場上。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM