Open Jimmy-Newtron opened 5 months 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)
@Jimmy-Newtron where would this patch suppose to be included in? the chainlit repo itself or your own chainlit app?
My patch is on the your own app code, but it would be nice to avoid patching the code by having a chainlit fix
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