I am building a Chainlit application with a custom react front-end. I am using the latest version of Chainlit which allows mounting chainlit as an app on its own. I am then mounting my custom react front-end on a separate path using StaticFiles
as below
app = FastAPI()
mount_chainlit(app=app, target="cl_app.py", path="/chainlit")
app.mount("/", StaticFiles(directory="../frontend/dist/", html=True), name="app")
With the above code, I am able to navigate to the /chainlit
route to render the chainlit application mounted on that route but if I navigate to the root path /
, I get a 404
.
If I swap the other in which these routes are defined as below
app = FastAPI()
app.mount("/", StaticFiles(directory="../frontend/dist/", html=True), name="app")
mount_chainlit(app=app, target="cl_app.py", path="/chainlit")
then the /
works and perfectly renders my custom react front-end but then /chainlit
results in 404 not found.
So my observation is that whatever route I configure last fails to be found. I suspect that using /
for the react front-end might be causing some issues somewhere but not sure where or what.