【发布时间】:2018-05-03 14:58:40
【问题描述】:
我正在尝试创建一个机器人,我需要在其中添加一个 pdf 文件作为附件,当用户单击它时,它应该在网络浏览器中打开或下载。 我已经尝试过这样做,但正如您在enter image description here 中看到的那样,当我点击它时没有任何反应。
添加pdf附件的代码是:
private static Attachment GetInlineAttachment()
{
var imagePath = System.Web.HttpContext.Current.Server.MapPath("~/Files/mutuelle.pdf");
// var imageData = Convert.ToBase64String(File.ReadAllBytes(imagePath));
return new Attachment
{
Name = "mutuelle.pdf",
ContentType = "application/pdf",
ContentUrl = imagePath
};
}
[LuisIntent("Mutuelle")]
public async Task MutuelleIntent(IDialogContext context, LuisResult result)
{
var replyMessage = context.MakeMessage();
try
{
Attachment attachment = GetInlineAttachment();
replyMessage.Attachments = new List<Attachment> { attachment };
await context.PostAsync(" Vous retrouverez dans le document ci-dessous toutes les prestations prise en charge par notre mutuelle.");
await context.PostAsync(replyMessage);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
context.Wait(MessageReceived);
}
有人可以帮帮我吗?
【问题讨论】:
-
你想使用什么渠道?
-
我目前正在使用模拟器,但我的目标是在 Azure 上使用(我认为)网络聊天频道
标签: .net pdf botframework azure-language-understanding