Skip to content

Commit

Permalink
Merge pull request #86 from cfusterbarcelo/main
Browse files Browse the repository at this point in the history
Interface Changes
  • Loading branch information
oeway authored Mar 12, 2024
2 parents d1fb5c7 + 271dda1 commit cbd86da
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
Binary file added bioimageio_chatbot/static/bridget-bmz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 22 additions & 19 deletions bioimageio_chatbot/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
BioImage.IO Chatbot
</div>
<div id="assistant-buttons">
<button class="btn" onclick="switchAssistant('Melman')">Melman</button>
<button class="btn" onclick="switchAssistant('King Julien')">King Julien</button>
<button class="btn" onclick="switchAssistant('Kowalski')">Kowalski</button>
<button type="button" class="btn btn-secondary" data-assistant="Melman">BIASeeker</button>
<button type="button" class="btn btn-secondary" data-assistant="Bridget">BIAExecutor</button>
<button type="button" class="btn btn-secondary" data-assistant="Nina">BIATutor</button>
</div>
</div>

Expand Down Expand Up @@ -436,6 +436,12 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
let mountedFolder;
let extensions = [];
const registeredExtensions = []
const assistantIcons = {
"Melman": "/bioimageio_chatbot/static/melman-bmz.png",
"Bridget": "/bioimageio_chatbot/static/bridget-bmz.png",
"Nina": "/bioimageio_chatbot/static/nina-bmz.png"
};

function fileSelected() {
var input = document.getElementById('fileUpload');
var label = document.getElementById('paperclipIcon');
Expand Down Expand Up @@ -595,18 +601,13 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
const spinner = `<div class="spinner"></div>`; // Spinner HTML
const enableCodeInterpreter = urlParams.get('enable-code-interpreter') === "true";
let assistantName = urlParams.get('assistant') || "Melman";

// add button class primary to the selected assistant button
// use assistant-buttons to find the buttons container
const assistantButtons = document.getElementById('assistant-buttons')
for (let button of assistantButtons.children) {
if (button.textContent === assistantName) {
button.classList.add('btn-primary')
}
else{
button.classList.remove('btn-primary')
button.classList.add('btn-secondary')
}
}
$('#assistant-buttons button[data-assistant="' + assistantName + '"]')
.removeClass('btn-secondary')
.addClass('btn-primary');

let shortIntroMessage = `Hi there! I'm ${assistantName}, how can I assist you today?`;


Expand Down Expand Up @@ -875,11 +876,12 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
initializeService();
}

window.switchAssistant = (aName)=>{
const url = new URL(window.location.href)
url.searchParams.set('assistant', aName)
window.open(url.toString(), '_self')
}
$('#assistant-buttons button').click(function() {
const assistantName = $(this).data('assistant');
const url = new URL(document.location.href);
url.searchParams.set('assistant', assistantName);
document.location.href = url.toString();
});

$('#reset-btn').click(function () {
resetChat(); // Call the reset function when the "Reset" button is clicked
Expand Down Expand Up @@ -1092,9 +1094,10 @@ <h3 class="text-center">Welcome to BioImage.IO Chatbot</h3>
}

function appendRobotMessage(htmlMessage, messageId) {
const iconUrl = assistantIcons[assistantName];
const messageContainer = `<div class="message-container robot-message" id="container-${messageId}">
<div class="rounded-icon-container">
<img style="width: 20px;" src="https://bioimage.io/static/img/bioimage-io-icon.svg" alt="Melman the Giraffe" width="30" height="30">
<img src="${iconUrl}" alt="${assistantName}" width="20" height="20">
</div>
<div class="message-content markdown-body">
<h3 id="spinner-${messageId}" style="display:none;"><div class="spinner" style='display: inline-block;width:25px;height:25px;margin-bottom:-4px;'></div>🤔Thinking...</h3>
Expand Down
Binary file added bioimageio_chatbot/static/melman-bmz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bioimageio_chatbot/static/nina-bmz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ duckduckgo-search==5.0
langchain-openai==0.0.8
rank-bm25==0.2.2
html2text==2020.1.16
setuptools

0 comments on commit cbd86da

Please sign in to comment.