chainlit
chainlit copied to clipboard
BUG: Double root_path
Describe the bug
When running a Chainlit app with a FastAPI backend, everything works fine when using the standalone Chainlit app. However, the subpath is duplicated in the frontend when mounting Chainlit under a root URL path (e.g., /chat). For instance, if I attempt to access a resource (e.g. TaskList), it is rendered as http://localhost:8000/chat/project/file/0f7d5f5a-31f3-46ba-b261-7b2dc3ac3198?session_id=eb4613cf-059a-4853-943a-b57e43d4c5a8, causing the frontend to fail in loading resources.
To Reproduce Steps to reproduce the behavior:
- Run the Chainlit app with FastAPI.
- Mount Chainlit under a URL folder
mount_chainlit(app=app, target='chat/main.py', path='/chat'). - Try to access a resource from the frontend (tasklist).
- See the error where the path is duplicated (e.g.,
http://localhost:8000/chat/project/file/0f7d5f5a-31f3-46ba-b261-7b2dc3ac3198?session_id=eb4613cf-059a-4853-943a-b57e43d4c5a8).
Expected behavior
The expected behavior is that the frontend should not duplicate the subpath. The resource should be accessed correctly as http://localhost:8000/chat/project/file/0f7d5f5a-31f3-46ba-b261-7b2dc3ac3198?session_id=eb4613cf-059a-4853-943a-b57e43d4c5a8
Screenshots
Desktop (please complete the following information):
- OS: macOS Sonoma
- Browser: Chrome, Safari
- Version: Latest
Additional context The issue seems specific to the URL path duplication when Chainlit is mounted under a folder in FastAPI. When using the standalone app, the frontend works as expected.