更改了页面布局,调通了模型调用界面

This commit is contained in:
2026-01-13 12:09:41 +08:00
parent a3a19630b7
commit e1ab76a9a1
28 changed files with 6206 additions and 220 deletions

View File

@@ -32,36 +32,14 @@ def format_file_size(size_bytes: int) -> str:
class DatasetAPI(BaseAPI):
"""数据集管理 API - 自动注册到 /api/datasets 路径"""
"""数据集管理 API"""
def __init__(self):
# 重写初始化逻辑以设置正确的路由前缀
# 1. 手动设置 module_name
self.module_name = "api.datasets"
# 2. 创建路由器(使用期望的前缀)
from fastapi import APIRouter
self.router_prefix = "/api/datasets"
self.router = APIRouter(
prefix=self.router_prefix,
tags=["Datasets"]
)
# 3. 获取日志器
import sys
self.logger = __import__('src.utils.logger', fromlist=['get_logger']).get_logger(self.__class__.__module__)
# 4. 调用基类的自动注册此时router已被覆盖
# 注意我们不调用父类__init__而是手动调用_auto_register_routes
self._auto_register_routes()
# 5. 记录初始化
self.logger.info(
f"API模块初始化完成",
module=self.module_name,
prefix=self.router_prefix,
routes=len(self.router.routes)
)
"""初始化"""
# 在调用super().__init__()之前设置module_name
self._override_module_name = "datasets"
super().__init__()
self.logger.info("DatasetAPI 初始化完成")
@post("/upload", response_model=StandardResponse)
async def upload_dataset(
@@ -143,6 +121,12 @@ class DatasetAPI(BaseAPI):
Returns:
StandardResponse: 包含数据集列表的标准响应
"""
# 添加调试日志
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.info(f"list_datasets called with list_all={list_all}")
try:
if list_all:
# 列出data目录下的所有文件物理文件