Open johntrimble opened 7 months ago
I have the same problem. The autoreload (the -w
option) doesn't seem to work properly. One I change something in the code and press Ctrl-S
to save, the changes are detected, but then the whole program breaks:
2024-03-20 21:30:35 - Your app is available at http://localhost:8003 2024-03-20 21:31:11 - 1 change detected 2024-03-20 21:31:11 - File modified: config.py. Reloading app... 2024-03-20 21:31:13 - You need to configure at least an on_chat_start or an on_message callback ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 250, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/applications.py", line 116, in call await self.middleware_stack(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/middleware/errors.py", line 151, in call await self.app(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/middleware/cors.py", line 75, in call await self.app(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app raise exc File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app await app(scope, receive, sender) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/routing.py", line 746, in call await route.handle(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/starlette/routing.py", line 459, in handle await self.app(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/engineio/async_drivers/asgi.py", line 58, in call await self.engineio_server.handle_request(scope, receive, send) File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/socketio/async_server.py", line 448, in handle_request return await self.eio.handle_request(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/engineio/async_server.py", line 286, in handle_request socket = self._get_socket(sid) ^^^^^^^^^^^^^^^^^^^^^ File "/home/roman/miniconda3/envs/chainlit/lib/python3.11/site-packages/engineio/base_server.py", line 229, in _get_socket raise KeyError('Session is disconnected') KeyError: 'Session is disconnected'
I've tried running this on both Ubuntu and MacOS and I get the same results. Providing the output of using this on MacOS below.
Ran the following commands to install chain lit:
Ran
chainlit hello
and verified that it worked.Created demo.py and copied code from Quickstart in the README.md.
Then I ran:
Checked the browser and everything looked good. Then I ran:
These messages get printed in the terminal:
Checking the page I see "Could not reach the server".
Given the error message, I tried setting
enable_telemetry = false
in the.chainlit/config.toml
. Then I ran:Followed by:
Now I get the following in the terminal:
Checking the page I see "Could not reach the server". There is an "on_message" handler in the demo.py file, so I'm not sure what is wrong.
Output of
pip freeze
:Output of
python --version
: