feat: add new folder
This commit is contained in:
36
gig-poc/apps/api/app/main.py
Normal file
36
gig-poc/apps/api/app/main.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from app.api.routes import router
|
||||
from app.core.config import get_settings
|
||||
from app.core.logging import configure_logging, logger
|
||||
from app.db.base import Base
|
||||
from app.db.session import engine
|
||||
from app.services.rag.lightrag_adapter import LightRAGAdapter
|
||||
|
||||
|
||||
settings = get_settings()
|
||||
configure_logging(settings.log_level)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(_: FastAPI):
|
||||
Base.metadata.create_all(bind=engine)
|
||||
try:
|
||||
LightRAGAdapter(settings).ensure_ready()
|
||||
except Exception:
|
||||
logger.exception("Qdrant initialization skipped during startup")
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(title=settings.app_name, lifespan=lifespan)
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
app.include_router(router)
|
||||
Reference in New Issue
Block a user