27 lines
547 B
Python
27 lines
547 B
Python
|
|
"""X-Agents API Server."""
|
||
|
|
|
||
|
|
import sys
|
||
|
|
sys.path.insert(0, 'D:/Code/Project/X-Agents/core')
|
||
|
|
|
||
|
|
from fastapi import FastAPI
|
||
|
|
from fastapi.middleware.cors import CORSMiddleware
|
||
|
|
from .routes import router
|
||
|
|
|
||
|
|
app = FastAPI(title="X-Agents API")
|
||
|
|
|
||
|
|
# Add CORS middleware
|
||
|
|
app.add_middleware(
|
||
|
|
CORSMiddleware,
|
||
|
|
allow_origins=["*"],
|
||
|
|
allow_credentials=True,
|
||
|
|
allow_methods=["*"],
|
||
|
|
allow_headers=["*"],
|
||
|
|
)
|
||
|
|
|
||
|
|
# Include the router
|
||
|
|
app.include_router(router)
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
import uvicorn
|
||
|
|
uvicorn.run(app, host="0.0.0.0", port=8001)
|