File size: 1,189 Bytes
4cab845 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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"
} |