from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware import os from datetime import datetime app = FastAPI( title="Knowledge Assistant RAG API", description="API for document upload and knowledge base querying", version="1.0.0" ) # Configure CORS cors_origins = os.getenv("CORS_ORIGINS", "*").split(",") app.add_middleware( CORSMiddleware, allow_origins=cors_origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/") async def root(): """Root endpoint""" return { "message": "Knowledge Assistant RAG API", "status": "running", "timestamp": datetime.utcnow().isoformat() } @app.get("/health") async def health_check(): """Simple health check endpoint""" return { "status": "ok", "timestamp": datetime.utcnow().isoformat(), "service": "knowledge-assistant-api" } @app.get("/health/simple") async def simple_health_check(): """Simple health check endpoint for basic monitoring.""" return { "status": "ok", "timestamp": datetime.utcnow().isoformat(), "service": "knowledge-assistant-api" }