Initial commit: InternalAuditInterprise
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
"""AIAudit FastAPI 应用入口。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app import __version__
|
||||
from app.api.datahub import router as datahub_router
|
||||
from app.config import get_settings
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
# 启动时执行数据零出域红线校验,违规则阻断启动
|
||||
settings = get_settings()
|
||||
settings.validate_egress_policy()
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="AIAudit · 本地 AI 内审平台",
|
||||
version=__version__,
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
app.include_router(datahub_router)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health() -> dict:
|
||||
"""存活探针。"""
|
||||
return {"status": "ok", "version": __version__}
|
||||
|
||||
|
||||
@app.get("/health/config")
|
||||
def health_config() -> dict:
|
||||
"""配置/合规探针:暴露环境与 LLM provider 出域状态(不含密钥)。"""
|
||||
settings = get_settings()
|
||||
return {
|
||||
"env": settings.aiaudit_env.value,
|
||||
"llm_provider": settings.llm_provider.value,
|
||||
"egress_blocked_in_prod": settings.is_prod,
|
||||
}
|
||||
Reference in New Issue
Block a user