From 2d0e53b6febef9a1ae434bb9fc57208c3b8138c6 Mon Sep 17 00:00:00 2001 From: Wanlu Lei <93822929+alalulu8668@users.noreply.github.com> Date: Sun, 2 Jun 2024 13:29:56 -0700 Subject: [PATCH] Update index.html (#397) fix the reloaded info for code interpreter --- public/chat/index.html | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/public/chat/index.html b/public/chat/index.html index 373190e3..f5bf9c1e 100644 --- a/public/chat/index.html +++ b/public/chat/index.html @@ -891,21 +891,27 @@

Welcome to BioImage.IO Chatbot

function setupCodeInterpreter() { // check if the browser is not Chromium based then tell the user to use Chromium based browser if (!window.showOpenFilePicker) { - const warning = document.createElement("div") - warning.classList.add("alert") - warning.classList.add("alert-warning") - warning.role = "alert" - warning.innerHTML = `Warning! While the code interpreter works in non-Chromium based browsers, the ability to mount data folders to the chatbot is only supported in Chromium based browsers (e.g. Chrome, Edge, Brave, etc.). Please use a Chromium based browser for full functionality.` - // insert the warning after the chat-dialog-header - $('#chat1 .chat-dialog-header').after(warning) + if (!document.getElementById('non-chromium-warning')) { + const warning = document.createElement("div") + warning.classList.add("alert") + warning.classList.add("alert-warning") + warning.id = "non-chromium-warning" + warning.role = "alert" + warning.innerHTML = `Warning! While the code interpreter works in non-Chromium based browsers, the ability to mount data folders to the chatbot is only supported in Chromium based browsers (e.g. Chrome, Edge, Brave, etc.). Please use a Chromium based browser for full functionality.` + // insert the warning after the chat-dialog-header + $('#chat1 .chat-dialog-header').after(warning) + } } - else{ - const info = document.createElement("div") - info.classList.add("alert") - info.classList.add("alert-info") - info.role = "alert" - info.innerHTML = `Info: The code interpreter runs entirely in-browser. Mounted data stays in-browser, won't be uploaded to any server. Code execution results, like print messages, are sent to the chat server. WARNING: Please ALWAYS keep a backup before mounting your data folder.` - $('#chat1 .chat-dialog-header').after(info) + else { + if (!document.getElementById('chromium-info')) { + const info = document.createElement("div") + info.classList.add("alert") + info.classList.add("alert-info") + info.id = "chromium-info" + info.role = "alert" + info.innerHTML = `Info: The code interpreter runs entirely in-browser. Mounted data stays in-browser, won't be uploaded to any server. Code execution results, like print messages, are sent to the chat server. WARNING: Please ALWAYS keep a backup before mounting your data folder.` + $('#chat1 .chat-dialog-header').after(info) + } } $('#console-btn').show() const bioengineStartupScript = ` @@ -1964,4 +1970,4 @@