【发布时间】:2021-03-12 23:15:51
【问题描述】:
您好,我是 Microsoft Bot Framework 的新手,请原谅我的问题。
我正在尝试更改聊天机器人的样式,但遇到了无法通过 styleSet 禁用上传按钮的问题。
const styleOptions = {
hideUploadButton: true,
bubbleBackground: "red",
bubbleBorderStyle: "solid",
bubbleBorderRadius: "10px",
bubbleFromUserBackground: "#5ce9ff",
bubbleFromUserBorderRadius: "10px",
groupTimeStamp: 3000,
emojiSet: true,
timestampFormat: 'relative',
timestampColor: "red",
};
上面的代码工作正常,但是当我试图更改聊天机器人的背景图像时,我认为我需要通过 styleSet 传递 styleOptions,这就是其他一切正常工作的地方,而不是上传按钮,尽管我设置这是真的。
const styleOptions = {
hideUploadButton: true,
bubbleBackground: "red",
bubbleBorderStyle: "solid",
bubbleBorderRadius: "10px",
bubbleFromUserBackground: "#5ce9ff",
bubbleFromUserBorderRadius: "10px",
groupTimeStamp: 3000,
emojiSet: true,
timestampFormat: 'relative',
timestampColor: "red",
};
const styleSet = createStyleSet({
...styleOptions,
});
styleSet.activities = {
...styleSet.activities,
backgroundImage:
"url('https://i.pinimg.com/originals/79/5c/ab/795cabc4647f73b365e2e6eabd0f34dc.png')",
};
// render webchat
function renderWebChat(token, userId, enableWSS) {
console.log("starting webchat");
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: token,
// domain: '//' + window.location.host,
domain:
"https://bot-web-connector-dot-anna-dev-bot-services.df.r.appspot.com",
webSocket: !!enableWSS,
}),
styleSet,
store: store,
userID: userId,
username: "You",
locale: navigator.language || "en-SG",
},
document.getElementById("webchat")
);
}
我不知道为什么当我以这种方式实现我的代码时它不会成功,谁能告诉我我的错误。
【问题讨论】:
-
接受/赞成一个答案服务于更大的 Stack Overflow 社区和任何有类似问题的人。如果您觉得我的回答足够,请“接受”并点赞。如果没有,请告诉我我还能提供哪些帮助!
标签: javascript html botframework chatbot implementation