Open marsanla opened 1 month ago
@marsanla Thanks for the feedback. Could you please indicate what version of chainlit you experience it with? If you haven't already, could you please try with 1.3.0rc0?
In addition, could you please share the code for a complete minimal example which demonstrates the issue?
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:
mount_chainlit(app=app, target='chat/main.py', path='/chat')
.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):
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.