简体   繁体   English

使用Node.js Microsoft Bot Framework显示图像

[英]Display images using the Node.js Microsoft Bot Framework

So I have a first run dialog that asks the user to upload a photo. 因此,我有一个首次运行对话框,要求用户上传照片。 I do this via: 我这样做是通过:

builder.Prompts.attachment(session, "Thanks. Now upload a picture").

and then in the next part of the waterfall, saving the uploaded media to session.userData like so: 然后在瀑布的下一部分中,将上传的媒体保存到session.userData如下所示:

function(session, results) {
    //some other code
    builder.Prompts.attachment(session, "Thanks. Now upload a picture.");
},
function(session, results) {
    session.userData.profilePhoto = results.response;
    session.endDialog("All done.")
}

So, say I know want to display that photo. 所以,说我知道要显示该照片。 How would I do it? 我该怎么办?

I've tried sending a HeroCard with a CardImage : 我尝试发送带有HeroCardCardImage

var message = new builder.Message(session);

var att = new builder.HeroCard(session)
        .images([
            builder.CardImage.create(session, session.userData.profilePhoto)
        ])
        .buttons([
            builder.CardAction.openUrl(session, "http://google.com", "buttonText")
        ]);

message.addAttachment(att);
session.send(message)

but that didn't work (I also tried to do session.userData.profilePhoto.contentUrl for the CardImage but that didnt work as well). 但这是行不通的(我也尝试过为CardImage做session.userData.profilePhoto.contentUrl ,但这也行不通)。

How exactly am I suppose to display images? 我应该如何精确显示图像?

UserData is not intended to store large objects, only state. UserData并非旨在存储大型对象,而仅用于存储状态。 Data bags are limited to 64k. 数据包限制为64k。 You'll want to use your own storage mechanism for images. 您将需要使用自己的图像存储机制。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 聊天机器人-我可以在Microsoft机器人框架和机器人构建器中使用node.js显示html内容 - Chat bot-Can I display html content using node.js in Microsoft bot framework & bot builder 如何在Microsoft Bot Framework的node.js版本中“退出”? - How to 'exit' in the node.js version of Microsoft Bot Framework? 在Microsoft Bot Framework(Node.js)中的对话框之间切换 - Switches between Dialog in Microsoft Bot Framework (Node.js) 在Microsoft Bot Framework for Skype(node.js)中提示输入文件 - Prompt for file in Microsoft Bot Framework for Skype (node.js) Microsoft Bot Framework 3.15 中用于 Node.js 的“reloadAction”未传递“dialogArgs” - 'reloadAction' in Microsoft Bot Framework 3.15 for Node.js is not passing on 'dialogArgs' 带有node.js的Microsoft bot框架以及数据库和流 - microsoft bot framework with node.js plus database and flow Microsoft Bot Framework - 在多个对话框中使用变量 (node.js) - Microsoft Bot Framework - Using a variable across multiple dialogs (node.js) 在bot.use中设置event.textLocale(Node.js Microsoft Bot Framework) - Setting event.textLocale in bot.use (Node.js Microsoft Bot Framework) 如何为 bot 响应添加延迟,使其在 Microsoft Bot Framework Node.js 中感觉更真实? - How to add a delay to bot responses, so it feels more real in Microsoft Bot Framework Node.js? 什么决定了“bot.dialog”何时传递到 Microsoft Bot Framework 中瀑布的下一个 function? (Node.js) - What determines when 'bot.dialog' passes to the next function of the waterfall in Microsoft Bot Framework? (Node.js)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM