【发布时间】:2017-10-23 22:18:33
【问题描述】:
我正在尝试将 channelData 与从页面中的机器人网络聊天控件发送的每条消息一起注入。我环顾四周,发现了这个示例 (https://cmsdk.com/javascript/how-to-send-custom-channel-data-when-using-web-chat-client-with-bot-framework.html),我的代码如下所示。
问题是这在 Chrome 中有效,但扩展运算符 (...) 在 Edge 或 IE 上无效。是否有适用于所有浏览器的替代语法?
var user = {
id: '@User.Identity.Name',
name: '@User.Identity.Name'
};
var bot = {
id: BotId,
name: 'BotName'
};
var botConnect = new BotChat.DirectLine({
secret: '@ViewData["BotSecret"]',
webSockets: 'true'
});
var v = { ...botConnect };
debugger;
BotChat.App({
botConnection: {
...botConnect,
postActivity: activity => {
activity.channelData = {
StudentId: '@User.Identity.Name'
};
return botConnect.postActivity(activity);
}
},
user: user,
bot: bot,
resize: 'detect'
}, document.getElementById("bot"));
【问题讨论】:
-
我认为您需要手动启用实验性功能才能使其正常工作,并且不希望最终用户必须这样做。而且我认为 IE 没有解决方法。
标签: javascript botframework webchartcontrol