首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在网络聊天中添加聊天机器人v4头像图标?

如何在网络聊天中添加聊天机器人v4头像图标?
EN

Stack Overflow用户
提问于 2019-07-17 18:10:42
回答 1查看 1.1K关注 0票数 2

我必须添加一个头像到机器人响应,但我找不到这样做的方法。

我尝试过botAvatarInitials和userAvatarInitials Change the avatar of the bot within the dialog box ,但这并不是我想要的。

代码语言:javascript
复制
    window.WebChat.renderWebChat({
        directLine: botConnection,
        styleOptions: styleOptions,
        botAvatarInitials: 'BOT',
        userAvatarInitials: 'YOU'
    }, document.getElementById('webchat'));

有使用图像的方法吗?或者至少改变头像的气泡颜色?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-17 18:37:42

可以,您可以使用this sample中所述的botAvatarImage属性来设置图像。

它看起来像这样:

代码语言:javascript
复制
const styleOptions = {
    botAvatarImage: 'https://docs.microsoft.com/en-us/azure/bot-service/v4sdk/media/logo_bot.svg?view=azure-bot-service-4.0',
    botAvatarInitials: 'BF',
    userAvatarImage: 'https://github.com/compulim.png?size=64',
    userAvatarInitials: 'WC'
};

window.WebChat.renderWebChat({
    directLine: botConnection,
    styleOptions
 }, document.getElementById('webchat'));

要设置头像气泡的背景,可以执行以下操作:

代码语言:javascript
复制
const styleOptions = {
    bubbleBackground: 'rgba(0, 0, 255, .1)',
    bubbleFromUserBackground: 'rgba(0, 255, 0, .1)'
};

window.WebChat.renderWebChat({
    directLine: botConnection,
    styleOptions
}, document.getElementById('webchat'));
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57073474

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档