Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
6.25k stars 800 forks source link

/ws endpoint returns 404 #710

Closed palvarezcordoba closed 5 months ago

palvarezcordoba commented 5 months ago

Description

When I start a hello world app:

import chainlit as cl

@cl.on_message
async def main(message: str):
    await cl.Message(content=message).send()

I open the browser but get a "Could not reach the server" error msg. I can see this in the logs:

2024-01-31 00:39:22 - Loaded .env file
INFO:     Started server process [60436]
INFO:     Waiting for application startup.
2024-01-31 00:39:23 - Your app is available at http://localhost:8000
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     127.0.0.1:40616 - "GET / HTTP/1.1" 200 OK
INFO:     127.0.0.1:40616 - "GET /assets/index-d088547c.css HTTP/1.1" 200 OK
INFO:     127.0.0.1:40616 - "GET /assets/index-129021e3.js HTTP/1.1" 304 Not Modified
INFO:     127.0.0.1:40616 - "GET /auth/config HTTP/1.1" 200 OK
INFO:     127.0.0.1:40616 - "GET /favicon HTTP/1.1" 200 OK
INFO:     127.0.0.1:40616 - "GET /logo?theme=light HTTP/1.1" 200 OK
2024-01-31 00:39:26 - Translation file for es-ES not found. Using default translation en-US.
INFO:     127.0.0.1:40616 - "GET /project/settings?language=es-ES HTTP/1.1" 200 OK
INFO:     127.0.0.1:40616 - "GET /ws/socket.io/?EIO=4&transport=polling&t=OrSlUgf HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:40616 - "GET /ws/socket.io/?EIO=4&transport=polling&t=OrSlUpq HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:40616 - "GET /ws/socket.io/?EIO=4&transport=polling&t=OrSlV60 HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:40616 - "GET /auth/config HTTP/1.1" 200 OK
INFO:     127.0.0.1:40616 - "GET /ws/socket.io/?EIO=4&transport=polling&t=OrSlVfT HTTP/1.1" 404 Not Found

The problem seems to be related to dependencies. If I use a fresh venv, install chainlit and run the provided example, it works.

System info

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy
$ python -V
Python 3.11.6
$ pip -V
pip 23.3.2 from (redacted)/lib/python3.11/site-packages/pip (python 3.11)
$ pipenv --version
pipenv, version 2023.10.20
Pipfile ``` [[source]] url = "https://pypi.org/simple" verify_ssl = true name = "pypi" [packages] langchain = "~=0.0.1" fastapi = "*" openai = "*" tiktoken = "*" itsdangerous = "*" uvicorn = {extras = ["standard"], version = "*"} httpx = "*" pytest-httpx = "*" pyjwt = "*" msal = "*" gradio = "*" azure-monitor-opentelemetry = "*" opentelemetry-instrumentation-fastapi = "*" docx2txt = "*" pypdf = "*" azure-search-documents = "==11.4.0b8" azure-identity = "*" pymupdf = "*" pypdfium2 = "*" opentelemetry-instrumentation-httpx = "*" mistletoe = "*" pytest-recording = "*" pytest-randomly = "*" pytest-frozen-uuids = "*" flaky = "*" [dev-packages] mypy = "*" pre-commit = "*" black = "*" commitizen = "*" gradio = "*" pytest = "*" httpx = "*" types-requests = "*" pytest-mock = "*" locust = "*" reportlab = "*" python-docx = "*" pytest-asyncio = "*" ipython = "*" py-spy = "*" pysnooper = "*" freezegun = "*" fpdf = "*" pypdf2 = "*" pandas = "*" openpyxl = "*" pytest-sugar = "*" pytest-socket = "*" pytest-cov = "*" coverage = "*" hypothesis = "*" chainlit = "*" [requires] python_version = "3.11" ```

Pipfile.lock

https://gist.github.com/palvarezcordoba/0ec00322bb8ea7193a413a42b524e843

How to reproduce

pipenv shell
pipenv sync -d
chainlit run app.py

By the way, this is a cool project. Good job guys. I tried streamlit but it does not seem to support calling async functions from the app. I did a little hack to do it, but I ended up having strage problems, lol.

willydouhard commented 5 months ago

I think the problem is fast api. Version 0.109.0 is causing this issue.