Open Jimmy-Newtron opened 1 week ago
I am also facing issues with Custom Endpoints with the new release. I can't use GET endpoints.
They route the base URL https:{HOST_NAME}:8000/
which is Chainlit Frontend.
The first code works partially, but the following forks better:
from chainlit.server import app
from prometheus_fastapi_instrumentator import Instrumentator
from starlette.routing import BaseRoute, Route
from src.core.routers import your_routers
serve_route: list[BaseRoute] = [
r for r in app.router.routes if isinstance(r, Route) and r.name == "serve"
]
for route in serve_route:
app.router.routes.remove(route)
app.include_router(your_routers)
Instrumentator().instrument(app).expose(app, tags=["monitoring"])
app.router.routes.extend(serve_route)
This is my solution to patch and temporarily fix the issue caused by the serve route
Originally posted by @Jimmy-Newtron in https://github.com/Chainlit/chainlit/issues/1064#issuecomment-2186946521