Spaces:
Sleeping
Sleeping
File size: 884 Bytes
f37bf1d fbdfc24 f37bf1d 8badae9 f37bf1d fbdfc24 f37bf1d fbdfc24 f37bf1d fbdfc24 f37bf1d fbdfc24 8badae9 fbdfc24 f37bf1d 8badae9 f37bf1d |
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 |
# api/main.py - MAIN FILE (Clean & Simple)
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from api.config import settings
from api.utils import lifespan
from api.routes import (
home_router,
chat_router,
sessions_router,
health_router
)
# Create FastAPI app
app = FastAPI(
title=settings.APP_TITLE,
version=settings.APP_VERSION,
description=settings.APP_DESCRIPTION,
lifespan=lifespan
)
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=settings.CORS_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(home_router)
app.include_router(chat_router)
app.include_router(sessions_router)
app.include_router(health_router)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=7860) |