[英]how to remove the title of the iframe in bot framework web chat
I got the iFrame for my bot that uses Microsoft bot framework by registering the bot with them. 通过为我的机器人注册iFrame,该机器人使用了Microsoft机器人框架。 Now, I need to remove/change the title of that bot from "chat" to another custom one.
现在,我需要将该机器人的标题从“聊天”中删除/更改为另一个自定义标题。
How can I do this? 我怎样才能做到这一点?
Thanks in advance. 提前致谢。
I need to remove/change the title of that bot from "chat" to another custom one
我需要将该机器人的标题从“聊天”中删除/更改为另一个自定义标题
To redesign and customize web chat interface, you can try to clone the repo , modify the source code, and compile into your own version. 要重新设计和定制Web聊天界面,您可以尝试克隆存储库 ,修改源代码并编译成您自己的版本。 To achieve your requirement: changing the title of web chat, you can find and modify the following code snippet in Chat.tsx .
要实现您的要求:更改网络聊天的标题,您可以在Chat.tsx中找到并修改以下代码片段。
<div className="wc-header">
<span>{ typeof state.format.chatTitle === 'string' ? state.format.chatTitle : state.format.strings.title }</span>
</div>
Simply modify it with below code and compile it: 只需使用以下代码对其进行修改并进行编译:
<span>{ typeof state.format.chatTitle === 'string' ? "my chat bot" : "my chat bot" }</span>
Use it in my website, which works for me. 在适合我的网站上使用它。
It isn't possible to edit the title when you use the iFrame without 'hacks' like modifying the DOM with CSS overrides. 使用iFrame时,如果没有“ hacks”(例如使用CSS覆盖修改DOM),就无法编辑标题。 However you don't have to edit / fork the WebChat code itself, as proposed in other answers.
但是,您不必像其他答案中所建议的那样编辑/创建WebChat代码本身。 It is possible to pass a custom title / empty title using ChatProps .
可以使用ChatProps传递自定义标题/空标题。
Have a look at the possibilities to include the WebChat on your own website . 看一下将WebChat包含在您自己的网站中的可能性。 Then pass the
chatTitle
parameter to change the title to your preference. 然后传递
chatTitle
参数将标题更改为您的首选项。
Rules for chatTitle:
chatTitle规则:
- undefined or true is passed, we will show the header with default text (locale-sensitive)
传递了undefined或true,我们将显示带有默认文本的标题(对语言环境敏感)
- false (or falsy except undefined) is passed, we will remove the header
如果传递了false(或除未定义之外为falsy),我们将删除标头
- a string is passed, we will show the header with the text
传递了一个字符串,我们将显示带有文本的标题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.