mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix: use hardcoded list and dictionary mapping for router registry
Replace dynamic import-based router discovery with an explicit hardcoded list of APIs that have routers. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
03a31269ad
commit
49005f1a39
5 changed files with 39 additions and 68 deletions
|
|
@ -14,7 +14,7 @@ from typing import Any
|
|||
from fastapi import FastAPI
|
||||
|
||||
from llama_stack.core.resolver import api_protocol_map
|
||||
from llama_stack.core.server.fastapi_router_registry import build_router, has_router
|
||||
from llama_stack.core.server.fastapi_router_registry import build_router
|
||||
from llama_stack_api import Api
|
||||
|
||||
from .state import _protocol_methods_cache
|
||||
|
|
@ -77,14 +77,13 @@ def create_llama_stack_app() -> FastAPI:
|
|||
],
|
||||
)
|
||||
|
||||
# Include routers for APIs that have them (automatic discovery)
|
||||
# Include routers for APIs that have them
|
||||
protocols = api_protocol_map()
|
||||
for api in protocols.keys():
|
||||
if has_router(api):
|
||||
# For OpenAPI generation, we don't need a real implementation
|
||||
router = build_router(api, None)
|
||||
if router:
|
||||
app.include_router(router)
|
||||
# For OpenAPI generation, we don't need a real implementation
|
||||
router = build_router(api, None)
|
||||
if router:
|
||||
app.include_router(router)
|
||||
|
||||
# Get all API routes (for legacy webmethod-based routes)
|
||||
from llama_stack.core.server.routes import get_all_api_routes
|
||||
|
|
@ -96,7 +95,7 @@ def create_llama_stack_app() -> FastAPI:
|
|||
|
||||
for api, routes in api_routes.items():
|
||||
# Skip APIs that have routers - they're already included above
|
||||
if has_router(api):
|
||||
if build_router(api, None) is not None:
|
||||
continue
|
||||
|
||||
for route, webmethod in routes:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue