feat: 权限与日志治理完善,MinIO 独立部署与 tiktoken 离线打包适配

- 后端:强化平台/审批/资源/系统接口权限校验与操作日志,更新权限设计文档与测试用例
- 存储:新增 MinIO 独立部署适配(端口 19000/19001),外部端点与 host-gateway 互通
- 离线:打包 tiktoken cl100k_base 词表进镜像,避免无网环境联网下载
- 其他:算力节点接口微调,前端微调创建页小修,忽略 MinIO 运行时数据

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wuyongtao
2026-08-12 15:21:23 +08:00
parent 2f64086177
commit 5ecca9f0bc
26 changed files with 101600 additions and 129 deletions

View File

@@ -2,6 +2,8 @@
from app.core.logging import get_logger
from app.db.platform_store import get_platform_store
from app.core.config import get_settings
from app.modules.storage.minio_store import ObjectStorageError, get_object_storage
router = APIRouter()
logger = get_logger(__name__)
@@ -9,10 +11,30 @@ logger = get_logger(__name__)
@router.get("/health")
async def health_check() -> dict[str, object]:
logger.info("health check requested")
# Health endpoints are called frequently by Docker and the frontend.
# Keep failures visible without emitting one INFO line per probe.
logger.debug("health check requested")
storage_status: dict[str, object] = {"enabled": get_settings().minio_enabled, "status": "disabled"}
if get_settings().minio_enabled:
try:
get_object_storage().ensure_bucket()
storage_status = {
"enabled": True,
"status": "ready",
"endpoint": get_settings().minio_endpoint,
"bucket": get_settings().minio_bucket,
}
except (ObjectStorageError, OSError) as exc:
logger.warning("MinIO health check failed: %s", exc)
storage_status = {
"enabled": True,
"status": "unavailable",
"endpoint": get_settings().minio_endpoint,
"error": str(exc),
}
return {
"code": 0,
"message": "ok",
"data": get_platform_store().health_metrics(),
"data": {**get_platform_store().health_metrics(), "storage": storage_status},
}