adding template for refactored rest service app

This commit is contained in:
SwiftyOS
2024-09-17 11:51:46 +02:00
parent 3d4aca9fcc
commit 8d0bbc5ffe
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from autogpt_server.server.utils import get_user_id
from autogpt_server.server.routes import root_router, agents_router, blocks_router
app = FastAPI()
app.include_router(root_router)
app.include_router(agents_router)
app.include_router(blocks_router)
def handle_internal_http_error(request: Request, exc: Exception):
return JSONResponse(
status_code=500,
content={"message": str(exc)},
)
app.add_exception_handler(500, handle_internal_http_error)

View File

@@ -0,0 +1,3 @@
from .agents import router as agents_router
from .root import router as root_router
from .blocks import router as blocks_router