Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .chainlit/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ github = "https://github.com/reactome/reactome_chatbot/issues"

# Specify a Javascript file that can be used to customize the user interface.
# The Javascript file can be served from the public directory.
# custom_js = "/public/test.js"
custom_js = "/public/custom.js"

# Specify a custom meta image url.
# custom_meta_image_url = "https://chainlit-cloud.s3.eu-west-3.amazonaws.com/logo/chainlit_banner.png"
Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
data/
embeddings/
embeddings_bak/
csv_files/
Expand Down
6 changes: 4 additions & 2 deletions bin/chat-fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,17 @@ async def landing_page():
<body>
<div class="container">
<div class="logo">
<img src="https://reactome.org/templates/favourite/images/logo/logo.png" alt="Reactome Logo">
<a href="https://reactome.org" target="_blank">
<img src="https://reactome.org/templates/favourite/images/logo/logo.png" alt="Reactome Logo">
</a>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding reactome.org hyperlink to /chat landing page Reactome header logo image

</div>
<h1>Meet the React-to-Me AI Chatbot!</h1>
<p class="centered-text">Your new guide to Reactome. Whether you're looking for specific genes and pathways or just browsing, our AI Chatbot is here to assist you!</p>

<div class="button-container">
<a class="button" href="$CHAINLIT_URL/chat/guest/" target="_blank">Guest Access</a>
<a class="button" href="$CHAINLIT_URL/chat/personal/" target="_blank">Log In</a>
<a class="button feedback-button" href="https://forms.gle/Rvzb8EA73yZs7wd38" target="_blank">Feedback</a>
<a class="button feedback-button" href="mailto:help@reactome.org" target="_blank">Feedback</a>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback button link to Reactome Help email instead of old survey

</div>

<p class="left-justified">Choose <strong>Guest Access</strong> to try the chatbot out. <strong>Log In</strong> will give an increased query allowance and securely stores your chat history so you can save and continue conversations.</p>
Expand Down
7 changes: 7 additions & 0 deletions chainlit.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ Explore pathways such as:

Happy exploring with React-to-me!

## _Disclaimer_

_This chatbot uses large language model (LLM) technology to assist with questions about the Reactome Knowledgebase. Responses are generated automatically and may contain inaccuracies, outdated information or speculative language._

_The information you provide may be retained in accordance with Reactome’s AI provider’s retention policy, which is located [here](https://openai.com/enterprise-privacy/). Do not share sensitive, personal or confidential information._

_The chatbot does not substitute for expert curation or peer-reviewed sources and is not a suitable resource for clinical decisions. Users are responsible for validating any output before using it for research, publication, or medical decisions. Any use of this chatbot is subject to Reactome’s [disclaimer](https://reactome.org/about/disclaimer)._
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add long disclaimer to Readme section

8 changes: 1 addition & 7 deletions config_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ messages:

welcome:
message: |-
Welcome to {chat_profile}, your interactive chatbot for exploring Reactome!
Welcome to {chat_profile}, your interactive chatbot for exploring **[Reactome](https://reactome.org/)**!
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to Reactome.org at chat start

Ask me about biological pathways and processes.
trigger:
event: on_chat_start

survey_message:
message: |-
We hope you're enjoying your experience with React-to-me! We'd love to hear your feedback to make it even better. Please take a few minutes to fill out our [survey](https://forms.gle/Rvzb8EA73yZs7wd38).
trigger:
after_messages: 3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove survey message

demo-message:
message: |-
Hello!
Expand Down
64 changes: 64 additions & 0 deletions public/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Replace the contents of the Chainlit watermark/footer
*/
(function () {
const CUSTOM_FOOTER_HTML = `
<div class="text-xs text-muted-foreground text-center">
<span>
<em>
<strong>Disclaimer:</strong>
Our chatbot uses AI to assist you.
Responses are generated automatically and may not always be accurate.
Do not share sensitive, personal or confidential information.
For more information, please click on the “Readme” icon at the top-right of this window.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add short disclaimer in place of "Built with Chainlit" footer

</em>
</span>
</div>
`.trim();

const WATERMARK_SELECTOR = 'a.watermark';
const APPLIED_ATTR = 'data-custom-watermark';

function replaceFooterContents(root = document) {
const nodes = root instanceof Element
? root.querySelectorAll(WATERMARK_SELECTOR)
: document.querySelectorAll(WATERMARK_SELECTOR);

nodes.forEach((el) => {
if (!(el instanceof HTMLElement)) return;
if (el.getAttribute(APPLIED_ATTR) === '1') return;

el.innerHTML = CUSTOM_FOOTER_HTML;

// disable the link behaviour
el.removeAttribute('href');
el.removeAttribute('target');
el.style.pointerEvents = 'none';

el.setAttribute(APPLIED_ATTR, '1');
});
}

// Initial run (in case the element is already present).
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => replaceFooterContents(document));
} else {
replaceFooterContents(document);
}

// Re-apply on future UI updates (SPA re-renders).
const mo = new MutationObserver((mutations) => {
for (const m of mutations) {
for (const node of m.addedNodes) {
if (node instanceof Element) {
// If the watermark itself is added or its parent subtree changes, update.
if (node.matches?.(WATERMARK_SELECTOR) || node.querySelector?.(WATERMARK_SELECTOR)) {
replaceFooterContents(node);
}
}
}
}
});

mo.observe(document.documentElement, { childList: true, subtree: true });
})();
1 change: 1 addition & 0 deletions public/elements/SearchResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const SearchResults = () => {
<a
key={result.id}
href={result.url}
target="_blank"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open search result links in a new tab

className="flex flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
>
<div className="flex w-full flex-col gap-1">
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/favicon.svg
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using SVG favicon instead of low-resolution image - no longer appears pixelated when enlarged for login interface

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/util/embedding_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ def get_dict(cls) -> dict[str, Path]:
return cls._get().embeddings

@classmethod
def get_dir(cls, key: str) -> Path:
return EM_ARCHIVE / cls._get().embeddings[key]
def get_dir(cls, key: str) -> Path | None:
if key in cls._get().embeddings:
return EM_ARCHIVE / cls._get().embeddings[key]
else:
return None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes KeyError bug when an unused embeddings bundle is missing


@classmethod
def get_model(cls, key: str) -> str:
Expand Down