Chainlit / cookbook

Chainlit's cookbook repo
https://github.com/Chainlit/chainlit
726 stars 270 forks source link

Custom Frontend Example does not work with latest versions of chainlit(python backend and react frontend) #137

Closed abhat-koppert closed 1 day ago

abhat-koppert commented 3 weeks ago

My team and I were attempting to build a new chatbot using the custom frontend example you had provided. We previously got it working using chainlit==1.0.504 on the Python backend and "@chainlit/react-client": "^0.0.602" on the React frontend. With this new project, we attempted to use chainlit==1.1.402 on the Python backend and "@chainlit/react-client": "^0.1.2" on the React frontend.

We found that the calls to the custom-auth endpoint from the frontend to the backend worked fine. However, every other call fails(as seen in the first figure below) image

We also have the backend logs -

❯ uvicorn app:app --host 0.0.0.0 --port 8000
2024-08-19 11:14:28 - Chainlit data layer initialized
2024-08-19 11:14:28 - Loaded .env file
INFO:     Started server process [18180]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     127.0.0.1:51346 - "GET / HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:42248 - "GET /custom-auth HTTP/1.1" 200 OK
INFO:     127.0.0.1:42248 - "GET /custom-auth HTTP/1.1" 200 OK

Please see the most common log we have for the frontend which redirects us to App.tsx line 21. 127.0.0.1-1724059116573.log

Please let us know what the issue is since we are unable to find out why it fails to connect to the backend.

ModEnter commented 1 day ago

Hello, in the last version of the cookbook, uvicorn runs on port 80. Furthermore, this issue seems to be part of a larger problem, fixed in this PR : https://github.com/Chainlit/chainlit/pull/1337. It is still waiting to be merged, but it fixes this issue