레거시 모드
This commit is contained in:
23
api.py
23
api.py
@@ -1,7 +1,19 @@
|
||||
import logging
|
||||
|
||||
from config.env_setup import setup_environment
|
||||
|
||||
# 환경 변수 설정을 최우선으로 호출
|
||||
setup_environment()
|
||||
|
||||
# 로깅 기본 설정
|
||||
logging.basicConfig(
|
||||
level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s - %(message)s"
|
||||
)
|
||||
logger = logging.getLogger("startup")
|
||||
|
||||
from fastapi import FastAPI
|
||||
from router import deepseek_router
|
||||
from services.ocr_engine import init_engine
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s - %(message)s"
|
||||
@@ -14,6 +26,17 @@ app = FastAPI(
|
||||
)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup_event():
|
||||
"""FastAPI startup event handler."""
|
||||
logging.info("Application startup...")
|
||||
try:
|
||||
await init_engine()
|
||||
logging.info("vLLM engine initialized successfully.")
|
||||
except Exception as e:
|
||||
logging.error(f"vLLM engine init failed: {e}", exc_info=True)
|
||||
|
||||
|
||||
@app.get("/health/API", include_in_schema=False)
|
||||
async def health_check():
|
||||
return {"status": "API ok"}
|
||||
|
||||
Reference in New Issue
Block a user