Rag_Chatbot / app /main.py
Claude Code - Backend Implementation Specialist
Add Docker deployment configuration for Hugging Face Spaces
36bfe21
raw
history blame contribute delete
930 Bytes
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.config import get_settings
from app.api.routes import chat, health
# Initialize settings
settings = get_settings()
# Create FastAPI app
app = FastAPI(
title="Physical AI RAG Backend",
description="RAG-powered chatbot backend for Physical AI textbook",
version="1.0.0"
)
# Configure CORS
app.add_middleware(
CORSMiddleware,
allow_origins=[settings.frontend_url, "http://localhost:3000", "https://*.vercel.app"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(health.router, prefix="/api", tags=["health"])
app.include_router(chat.router, prefix="/api/chat", tags=["chat"])
@app.get("/")
async def root():
"""Root endpoint."""
return {
"message": "Physical AI RAG Backend",
"version": "1.0.0",
"docs": "/docs"
}