Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reload 'Info' bug for the chatbot #397

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions public/chat/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -891,21 +891,27 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
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 = `<strong>Warning!</strong> 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 = `<strong>Warning!</strong> 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 = `<strong>Info:</strong> 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 = `<strong>Info:</strong> 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 = `
Expand Down Expand Up @@ -1964,4 +1970,4 @@ <h3 id="spinner-${messageId}" style="display:none;"><div class="spinner" style='
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.3.0/github-markdown-light.css" />
</body>

</html>
</html>
Loading