feat:接入mcp,为模型提供图表信息
This commit is contained in:
@@ -5,15 +5,15 @@ from fastapi import APIRouter
|
||||
from app.common.response import ApiResponse, success_response
|
||||
from app.core.exceptions import BizException
|
||||
from app.resources.component import get_catalog_cache
|
||||
from app.schemas.component_resource import ComponentCatalog
|
||||
from app.resources.material_fields import frontend_catalog
|
||||
|
||||
router = APIRouter(prefix="/materials", tags=["Material"])
|
||||
|
||||
|
||||
@router.get("")
|
||||
async def list_materials() -> ApiResponse[ComponentCatalog]:
|
||||
# 直接返回启动时载入的内存缓存,不查库
|
||||
async def list_materials() -> ApiResponse[dict]:
|
||||
# 直接使用启动时载入的内存缓存,不查库;属性面板 setters 由字段定义派生
|
||||
catalog = get_catalog_cache()
|
||||
if catalog is None:
|
||||
raise BizException(503, "物料目录尚未加载")
|
||||
return success_response(catalog)
|
||||
return success_response(frontend_catalog(catalog))
|
||||
|
||||
Reference in New Issue
Block a user