vn6295337's picture
Initial commit: RAG Document Assistant with Zero-Storage Privacy
f866820
"""FastAPI application for RAG backend."""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from src.api.routes import router
app = FastAPI(
title="RAG Document Assistant API",
description="REST API for RAG-based document querying",
version="1.0.0"
)
# CORS middleware for React frontend
# Allow Vercel deployments and local development
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://localhost:5174",
"http://localhost:5175",
"http://127.0.0.1:5173",
"http://127.0.0.1:5174",
"http://127.0.0.1:5175",
],
allow_origin_regex=r"https://.*\.(vercel\.app|hf\.space)",
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include API routes
app.include_router(router, prefix="/api")
@app.get("/")
async def root():
return {"message": "RAG Document Assistant API", "docs": "/docs"}