Skip to content
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

BUG: Double root_path #1397

Open
marsanla opened this issue Oct 3, 2024 · 2 comments
Open

BUG: Double root_path #1397

marsanla opened this issue Oct 3, 2024 · 2 comments
Labels
bug Something isn't working frontend Pertains to the frontend. needs-triage

Comments

@marsanla
Copy link

marsanla commented Oct 3, 2024

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:

  1. Run the Chainlit app with FastAPI.
  2. Mount Chainlit under a URL folder mount_chainlit(app=app, target='chat/main.py', path='/chat').
  3. Try to access a resource from the frontend (tasklist).
  4. 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

Captura de pantalla 2024-10-03 a las 6 24 27 Captura de pantalla 2024-10-03 a las 6 25 16

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.

@dosubot dosubot bot added bug Something isn't working frontend Pertains to the frontend. labels Oct 3, 2024
@dokterbob
Copy link
Collaborator

@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?

@Chainlit Chainlit deleted a comment from dosubot bot Oct 3, 2024
@dokterbob
Copy link
Collaborator

In addition, could you please share the code for a complete minimal example which demonstrates the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Pertains to the frontend. needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants