mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-02 19:05:10 -05:00
adding template for refactored rest service app
This commit is contained in:
21
rnd/autogpt_server/autogpt_server/server/new_rest_app.py
Normal file
21
rnd/autogpt_server/autogpt_server/server/new_rest_app.py
Normal 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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user