机器人框架中的以下代码在机器人模拟器中呈现照片,但不在 Web 频道中呈现照片。 如何在网络频道中获取用户照片渲染?
var reply = context.Activity.CreateReply();
var photoResponse = await client.GetPhoto();
var photoText = string.Empty;
if (photoResponse != null)
{
var replyAttachment = new Attachment(photoResponse.ContentType, photoResponse.Base64string);
reply.Attachments.Add(replyAttachment);
}
答。文本 = $"你好 {照片文本} {用户.显示名称} [{用户.邮件}] 今天我能帮你什么?
如果您使用的是 directline ,它仅支持 4MB 的消息大小,图像的 base64string 可能非常大,导致消息超过 4MB。模拟器中不存在此限制,这就是您在模拟器中没有收到错误的原因
尝试使用 contenturl 而不是 base64string 并检查它是否正常工作。