我想在机器人给出每个响应后在我的聊天机器人中捕获用户行为。它基本上是 Facebook 中的一个反馈、喜欢/不喜欢按钮。
在 MS bot 框架中是否有可能?
我想在机器人给出每个响应后在我的聊天机器人中捕获用户行为。它基本上是 Facebook 中的一个反馈、喜欢/不喜欢按钮。
在 MS bot 框架中是否有可能?
您可以使用富卡或英雄卡实现feedback yes no
按钮或按钮。like
许多消息传递通道提供附加更丰富对象的能力。Bot Framework 能够将丰富的卡片呈现为附件。支持多种类型的卡:英雄卡、缩略图卡、收据卡、签到卡、动画卡、视频卡和音频卡。一旦选择了所需的卡片类型,它就会映射到附件数据结构中。查看 CardsDialog 类中的关键代码,其中消息活动的 message.Attachments 属性填充了卡片附件。
public async Task DisplaySelectedCard(IDialogContext context, IAwaitable<string> result)
{
var selectedCard = await result;
var message = context.MakeMessage();
var attachment = GetSelectedCard(selectedCard);
message.Attachments.Add(attachment);
await context.PostAsync(message);
context.Wait(this.MessageReceivedAsync);
}
英雄卡
英雄卡是多用途卡;它主要包含一个大图像、一个按钮和一个“点击操作”,以及要在卡片上显示的文本内容。查看 CardsDialog 类中的 GetHeroCard 方法以获取英雄卡示例。
private static Attachment GetHeroCard()
{
var heroCard = new HeroCard
{
Title = "BotFramework Hero Card",
Subtitle = "Your bots — wherever your users are talking",
Text = "Build and connect intelligent bots to interact with your users naturally wherever they are, from text/sms to Skype, Slack, Office 365 mail and other popular services.",
Images = new List<CardImage> { new CardImage("https://sec.ch9.ms/ch9/7ff5/e07cfef0-aa3b-40bb-9baa-7c9ef8ff7ff5/buildreactionbotframework_960.jpg") },
Buttons = new List<CardAction> { new CardAction(ActionTypes.OpenUrl, "Get Started", value: "https://docs.microsoft.com/bot-framework") }
};
return heroCard.ToAttachment();
}
我已经创建了一个样本。与您分享图像。单击“是”时,它也会显示一张卡片以进行评分。