javascript - Watson Assistant Webchat 删除会话后聊天图标也消失了吗?
问题描述
javascript 新手我正在使用 Watson 助手网络聊天框架 ( https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-events#windowclose ) 进行网络集成。我可以更新 CSS 变量和其他配置,但是当我删除用户会话时,最小化聊天机器人图标也会消失。
window.watsonAssistantChatOptions = {
carbonTheme: 'g10',
enableFocusTrap: true,
onLoad: function(instance) {
// Instance method to adjust specific CSS variables
instance.updateCSSVariables({
'BASE-font-family': '"Times New Roman", Times, serif',
'BASE-width':'460px',
'BASE-height':'500px',
'$interactive-01': '#5dd7ec',
'$interactive-03':'#002d9c',
'$interactive-04':'#002d9c'
});
instance.openWindow();
instance.writeableElements.headerBottomElement.innerHTML = ' Powered By <a href="https://teledental.com"><strong>TeleDental</strong></a>';
instance.render();
function handler(event)
{
instance.destroySession();
instance.destroy();
resolve();
}
instance.on({ type: "window:close", handler: handler });
}
};
setTimeout(function(){
const t=document.createElement('script');
t.src="https://web-chat.global.assistant.watson.appdomain.cloud/loadWatsonAssistantChat.js";
document.head.appendChild(t);
});
解决方案
你想达到什么目的?
instance.destroy()
将拆除整个网络聊天并删除启动器和与网络聊天相关的所有其他 UI 元素。这就是导致您所看到的内容的原因。(https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methods#destroy)。
instance.destroySession()
将删除与网络聊天相关的所有浏览器存储,因此,例如,如果您想将用户从您的网站中注销,则不会留下任何识别数据。(https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methods#destroySession)
当有人简单地关闭聊天时,我认为您不想调用这些方法中的任何一种,他们可能只是在看屏幕上的其他内容并想回到聊天中,但也许我错过了您的最终目标是什么这里。
推荐阅读
- javascript - player.playVideo 不是函数
- python - 用标签替换熊猫数据框中的值
- celery - Celery-Flower 添加额外的标签
- ios - Swift 使用 API 请求重构嵌套函数
- python - 如何使用 pysnmp 解析 SNMP 表响应中的 OID 数据?
- java - 为什么关于打印语句的okhttp RequestBody错误
- react-leaflet - 如何在反应传单中访问折线内的标记
- swift - 不断检索到目的地 MapKIt 的时间
- java - 遍历列表并将数字加 1 插入到列表的下一个位置
- google-cloud-platform - 将 PubSub 确认时间增加到 600 秒以上,或者在 pub-sub 中设置火灾并忘记长时间运行的云运行作业