Download src/main.py from mrmayankmathurorg/Customer-EMAIL-Agent: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/mrmayankmathurorg/Customer-EMAIL-Agent/resolve/main/src/main.py
- Command line
-
hf download hf://spaces/mrmayankmathurorg/Customer-EMAIL-Agent/src/main.py
-
curl -L -o main.py https://huggingface.co/spaces/mrmayankmathurorg/Customer-EMAIL-Agent/resolve/main/src/main.py
1.47 kB
| """ | |
| Customer Support Email Agent — FastAPI Application Entry Point | |
| """ | |
| from pathlib import Path | |
| from fastapi import FastAPI | |
| from fastapi.staticfiles import StaticFiles | |
| from fastapi.responses import FileResponse | |
| from src.api.routes import router | |
| from src.core.config import settings | |
| from src.core.logging import setup_logging | |
| # Resolve static directory | |
| _STATIC_DIR = Path(__file__).resolve().parent.parent / "static" | |
| def create_app() -> FastAPI: | |
| """Application factory.""" | |
| setup_logging() | |
| app = FastAPI( | |
| title="Customer Support Email Agent", | |
| description="AI-powered email support agent using LangGraph", | |
| version="0.1.0", | |
| debug=settings.DEBUG, | |
| ) | |
| from fastapi.middleware.cors import CORSMiddleware | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # For production, we can refine this to the Vercel URL | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(router, prefix="/api/v1") | |
| # Serve static files (CSS, JS, images) | |
| if _STATIC_DIR.exists(): | |
| app.mount("/static", StaticFiles(directory=str(_STATIC_DIR)), name="static") | |
| async def health_check(): | |
| return {"status": "ok"} | |
| async def serve_dashboard(): | |
| """Serve the main dashboard UI.""" | |
| return FileResponse(str(_STATIC_DIR / "index.html")) | |
| return app | |
| app = create_app() | |