You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This new way to handle resources access is breaking the custom endpoints that I add to the server
This is my solution to patch and temporarily fix the issue caused by the serve route
from chainlit.server import app
from starlette.routing import BaseRoute, Route
from src.core.routers import admin
routes: list[BaseRoute] = [
r for r in app.router.routes if isinstance(r, Route) and r.name != "serve"
]
serve_route = [
r for r in app.router.routes if isinstance(r, Route) and r.name == "serve"
]
app.router.routes = routes
app.include_router(admin.router)
app.router.routes.extend(serve_route)
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 #1064 (comment)
The text was updated successfully, but these errors were encountered: