From 321f0a94a0611d725f10b8e7e1eb1d38d8cfffe5 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Wed, 29 Jan 2025 16:46:46 -0500 Subject: [PATCH 1/3] adding landing page --- bin/chat-fastapi.py | 127 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 1 deletion(-) diff --git a/bin/chat-fastapi.py b/bin/chat-fastapi.py index d9537de..b6c3277 100644 --- a/bin/chat-fastapi.py +++ b/bin/chat-fastapi.py @@ -7,7 +7,7 @@ from chainlit.utils import mount_chainlit from dotenv import load_dotenv from fastapi import FastAPI, Request, Response -from fastapi.responses import RedirectResponse +from fastapi.responses import RedirectResponse, HTMLResponse load_dotenv() @@ -172,4 +172,129 @@ async def verify_captcha(request: Request): return redirect_response +# Landing page at /chat/ +@app.get("/chat/") +async def landing_page(): + html_content = """ + + + + + + +
+ +

Meet the React-to-Me AI Chatbot!

+

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.

+

We created a model called React-to-Me which interacts in a conversational way, based on content in the Reactome Knowledgebase.

+

We are excited to introduce React-to-Me to get users’ feedback and learn about its strengths and weaknesses. Please try it now and provide us your feedback.

+ + + +
+

+ Personalized: Log into React-to-Me for enhanced features, such as an increased query allowance and securely stored chat history so you can revisit your conversations in the future. +

+ Personal +
+ +
+

+ Guest: Interact with React-to-Me as a guest. Your conversations will not be stored. +

+ Guest +
+
+ + + """ + return HTMLResponse(content=html_content) + + +# Ensure all other endpoints remain mounted mount_chainlit(app=app, target="bin/chat-chainlit.py", path=CHAINLIT_URI) + From 26e3a4111029720af61e4c031ffc6aafaa39d2b3 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Thu, 30 Jan 2025 10:21:36 -0500 Subject: [PATCH 2/3] cleaning up code --- bin/chat-fastapi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/chat-fastapi.py b/bin/chat-fastapi.py index b6c3277..67a08f9 100644 --- a/bin/chat-fastapi.py +++ b/bin/chat-fastapi.py @@ -172,7 +172,6 @@ async def verify_captcha(request: Request): return redirect_response -# Landing page at /chat/ @app.get("/chat/") async def landing_page(): html_content = """ @@ -290,7 +289,7 @@ async def landing_page(): - + """ return HTMLResponse(content=html_content) From 54dc6df7b1cd023cd82ff3c84f9ea254f2c5f549 Mon Sep 17 00:00:00 2001 From: Adam Wright Date: Thu, 30 Jan 2025 10:25:57 -0500 Subject: [PATCH 3/3] chainging order in header for fastapi script --- bin/chat-fastapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/chat-fastapi.py b/bin/chat-fastapi.py index 67a08f9..34402eb 100644 --- a/bin/chat-fastapi.py +++ b/bin/chat-fastapi.py @@ -7,7 +7,7 @@ from chainlit.utils import mount_chainlit from dotenv import load_dotenv from fastapi import FastAPI, Request, Response -from fastapi.responses import RedirectResponse, HTMLResponse +from fastapi.responses import HTMLResponse, RedirectResponse load_dotenv()