Fix routes (#3790)

This commit is contained in:
Chenlei Hu 2024-06-19 22:36:31 -04:00 committed by GitHub
parent 028a583bef
commit d7f0964266
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -538,7 +538,9 @@ class PromptServer():
# prefix are supported.
api_routes = web.RouteTableDef()
for route in self.routes:
assert isinstance(route, web.RouteDef)
# Custom nodes might add extra static routes. Only process non-static
# routes to add /api prefix.
if isinstance(route, web.RouteDef):
api_routes.route(route.method, "/api" + route.path)(route.handler, **route.kwargs)
self.app.add_routes(api_routes)
self.app.add_routes(self.routes)