【问题标题】:Cards are not showing the Dialogflow messenger?卡片没有显示 Dialogflow 信使?
【发布时间】:2021-01-05 05:17:47
【问题描述】:

我是 google Dialogflow 的新手,并尝试在 Dialogflow Messenger 中添加卡片。 下面是我在 Dialogflow Messenger 上显示卡片的代码。请帮帮我。 卡没有出现在信使中。 我也创建了一个调用卡片的意图。

  function welcome(agent) {
    agent.add(`Welcome to my agent!`);
  }
 
  function fallback(agent) {
    agent.add(`I didn't understand`);
    agent.add(`I'm sorry, can you try again?`);
  }

  // // Uncomment and edit to make your own intent handler
  // // uncomment `intentMap.set('your intent name here', yourFunctionHandler);`
  // // below to get this function to be run when a Dialogflow intent is matched
   function cards(agent) {
     agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`);
     agent.add(new Card({
      title: 'Title: this is a card title',
      imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png',
      text: 'This is the body text of a card. You can even use line\n breaks and emoji! ????',
      buttonText: 'This is a button',
      buttonUrl: 'https://assistant.google.com/'
      })
      );}

  // Run the proper function handler based on the matched Dialogflow intent name
  let intentMap = new Map();
  intentMap.set('Default Welcome Intent', welcome);
  intentMap.set('Default Fallback Intent', cards);
  //intentMap.set('Dialogflow Cards', cards);
  // intentMap.set('your intent name here', googleAssistantHandler);
  agent.handleRequest(intentMap);
});

【问题讨论】:

    标签: dialogflow-es dialogflow-es-fulfillment


    【解决方案1】:

    Cards 是 Google 助理元素,只会在支持 Google 助理的设备或平台上显示。 Dialogflow 的网络模拟器仅支持基于文本的响应。

    如果您想查看卡片响应,您应该通过集成选项卡将您的项目与 Google 助理集成,并在 Google 助理模拟器或真正的 Google 助理设备上测试您的机器人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 2020-08-20
      • 1970-01-01
      • 2020-11-20
      • 2018-01-26
      • 1970-01-01
      相关资源
      最近更新 更多