【问题标题】:Bot framework-Adaptive card-Unable to get dataBot框架-自适应卡-无法获取数据
【发布时间】:2022-02-25 22:45:33
【问题描述】:

我是机器人框架和学习的新手。在这里,我正在寻找我在用于聊天机器人的自适应卡中面临的解决方案。我了解到我们可以使用adaptivecards.io/designer根据我们的需要设计自适应卡,我们将卡作为json代码获取。

这是我的自适应卡的 json 代码

     {
 "type": "AdaptiveCard",
 "$schema": 
 "http://adaptivecards.io/schemas/adaptivecard.json",
 "version": "1.2",
 "msTeams": {
 "width": "full"
 },
 "body": [
 {
  "type": "TextBlock",
  "text": "Adaptive Card Example",
  "wrap": true,
  "size": "large",
  "weight": "bolder",
  "id": "title"
 },
 {
  "type": "Input.Text",
  "placeholder": "Provide your thoughts",
  "separator": true,
  "isMultiline": true,
  "id": "thoughts"
 },
 {
  "type": "ActionSet",
  "separator": true,
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Submit",
      "style": "positive",
      "id": "submit"
    }
  ]
 }
 ]
}

所以当我运行我的机器人并在模拟器中看到输出时,我可以看到自适应卡 adaptive card 当我输入并单击提交按钮时,它显示错误为 System.NullReferenceException 对象引用未设置为对象的实例。

请详细说明以解决此问题

【问题讨论】:

标签: c# visual-studio botframework chatbot adaptive-cards


【解决方案1】:

我使用了相同的自适应卡并且工作正常
使用 value 属性从自适应卡片读取值 ${turn.activity.value}

【讨论】:

  • 这就是我在 Input.Date 的情况下尝试做的事情。我将其保存到 user.period (根据我的变量名称)然后我想将其显示给用户要求确认。但它没有渲染..
  • 有什么问题?
  • 嘿 Vinoth,我终于想通了。问题是我没有看到聊天中打印的值。我检查了作曲家日志,我看到它在发布期间就在那里,并且我在该帖子之前设置了 user.date (在我的情况下)。将 set 属性移到附件活动之外允许我捕获它。
  • 这很棒的凝胶
猜你喜欢
  • 2020-03-21
  • 1970-01-01
  • 2020-05-30
  • 2018-10-31
  • 2019-03-31
  • 2019-07-23
  • 2018-03-21
  • 2020-07-30
  • 1970-01-01
相关资源
最近更新 更多