本文介绍了几秒钟后自动自动显示评分卡以获取用户反馈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在C#中使用框架v4制作的机器人.我希望我的机器人在机器人闲置后或在用户未响应机器人的情况下获取用户反馈.我制作了卡,但没有任何逻辑可在我的机器人中实现上述功能.我还要附上我制作的银行卡代码.还有我的卡的图像.任何人都可以调查一下,并帮助我实现此实现.在此处输入图片描述

I have a bot made using framework v4 in c#. I want that my bot take user feedback once the bot goes idle, or in the case user doesn't responded to bot.I have made my card but not getting any logic to implement above mention feature in my bot. I am also attaching the code of card i made. Also the image of my card.Can any look into it and help me out with this implementation.enter image description here

{
  "type": "AdaptiveCard",
  "body": [
{
  "type": "TextBlock",
  "size": "Medium",
  "weight": "Bolder",
  "color": "Accent",
  "text": "Rate your experience!"
},
{
  "type": "TextBlock",
  "separator": true,
  "text": "Please rate your experience! Your feedback is very appreciated and will help improve your experience in the future. ",
  "wrap": true
},
{
  "type": "ColumnSet",
  "spacing": "Medium",
  "columns": [
    {
      "type": "Column",
      "selectAction": {
        "type": "Action.Submit",
        "data": "awful"
      },
      "items": [
        {
          "type": "Image",
          "horizontalAlignment": "Center",
          "url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
        },
        {
          "type": "TextBlock",
          "horizontalAlignment": "Center",
          "text": "Awful"
        }
      ],
      "width": "stretch"
    },
    {
      "type": "Column",
      "selectAction": {
        "type": "Action.Submit",
        "data": "bad"
      },
      "items": [
        {
          "type": "Image",
          "horizontalAlignment": "Center",
          "url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
        },
        {
          "type": "TextBlock",
          "horizontalAlignment": "Center",
          "text": "Bad"
        }
      ],
      "width": "stretch"
    },
    {
      "type": "Column",
      "selectAction": {
        "type": "Action.Submit",
        "data": "normal"
      },
      "items": [
        {
          "type": "Image",
          "horizontalAlignment": "Center",
          "url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
        },
        {
          "type": "TextBlock",
          "horizontalAlignment": "Center",
          "text": "normal"
        }
      ],
      "width": "stretch"
    },
    {
      "type": "Column",
      "selectAction": {
        "type": "Action.Submit",
        "data": "good"
      },
      "items": [
        {
          "type": "Image",
          "horizontalAlignment": "Center",
          "url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
        },
        {
          "type": "TextBlock",
          "horizontalAlignment": "Center",
          "text": "Good"
        }
      ],
      "width": "stretch"
    },
    {
      "type": "Column",
      "selectAction": {
        "type": "Action.Submit",
        "data": "terrific"
      },
      "items": [
        {
          "type": "Image",
          "horizontalAlignment": "Center",
          "url": "https://upload.wikimedia.org/wikipedia/commons/1/18/Five-pointed_star.svg"
        },
        {
          "type": "TextBlock",
          "horizontalAlignment": "Center",
          "text": "Terrific"
        }
      ],
      "width": "stretch"
    }
  ]
},
{
  "type": "Input.Text",
  "id": "comment",
  "placeholder": "Add a comment",
  "isMultiline": true
}
 ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.0",
   "actions":
[
  {
    "type": "Action.Submit",
    "title": "OK",
   // "data":  "ok"
  }
]}

推荐答案

没有内置方法可以执行此操作,也没有标准"建议.但是,我们通常建议:

There isn't a built-in way to do this, nor is there a "standard" suggestion. However, we typically recommend:

  1. 在每条消息上,启动一个异步计时器.您可以在bot中执行此操作,但是最好在bot外部执行此操作,例如使用Azure Functions或其他方法.该答案的其余部分将假定计时器位于机器人外部.确保计时器还跟踪与计时器相关的sessionReference .
  2. 每当与conversationReference相匹配的用户发送消息时,重新启动计时器
  3. 计时器到期后,将事件与用户和对话信息(可能通过ChannelData)发送给bot,让bot知道计时器已过期.您还可以创建一个单独的端点并在此处进行监视,因此您不需要活动方案.代替/api/messages,您可以使用/api/expiredTimers之类的东西.
  4. 一旦收到过期的计时器事件,向用户发送主动消息,以进行以下操作:1)查看他们是否仍然在那里,或者2)结束对话.
  1. On each message, start an asynchronous timer. You can do this in the bot, but it would be better to do outside of the bot, like with Azure Functions or something. The rest of this answer will assume the timer is outside of the bot. Ensure the timer also keeps track of the conversationReference related to the timer.
  2. Restart the timer each time the user matching that conversationReference sends a message
  3. Once the timer expires, send an event to the bot with the user and conversation information (maybe through ChannelData), letting the bot know the timer has expired. You could also create a separate endpoint and monitor there, so you don't need the activity scheme; instead of /api/messages, you could use something like /api/expiredTimers.
  4. Once the expired timer event is received, send a proactive message to the user to either 1) see if they're still there, or 2) end the conversation.

这篇关于几秒钟后自动自动显示评分卡以获取用户反馈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:54
查看更多