-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Chainlit mounting mechanism fails when FastAPI has root_path. #1440
Comments
Could be related to #1397 (but not sure) |
Hello @duarteocarmo! I'm here to help with any bugs, questions, or contributions you have regarding Chainlit. Let's tackle this together! It seems like the issue you're experiencing with the Chainlit app not loading correctly when using the To address this, you can use the from fastapi import FastAPI
from chainlit.utils import mount_chainlit
app = FastAPI(root_path="/api")
@app.get("/app")
def read_main():
return {"message": "Hello World from main app"}
# Specify the target module and the path where Chainlit should be mounted
target_module = "chat.py"
mount_path = "/chainlit"
# Mount the Chainlit app
mount_chainlit(app=app, target=target_module, path=mount_path) Make sure to replace For further reference, you might also want to check out GitHub issue #1330, which was resolved by addressing WebSocket connection problems when submounting Chainlit. This might provide additional insights into resolving your issue. |
I tested |
@duarteocarmo you just need to hack
|
I think this is fixed with the latest release |
Describe the bug
When I use the
root_path
option on my FastAPI application, the chainlit app stops working (it's fetching static assets from the wrong path)To Reproduce
run:
uvicorn app:app --reload
Go to
http://127.0.0.1:8000/chainlit/
and notice a white screen.Expected behavior
There's something funky with asset fetching. I tried debugging - but I am not sure what's happening. I do know it's related to assets and staticfiles.
Screenshots
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: