This commit is contained in:
superobk
2024-03-27 16:10:46 +08:00
parent 0549a033e1
commit 229501515a
6 changed files with 41 additions and 20 deletions

View File

@ -4,6 +4,7 @@ from fastapi import FastAPI, Request, status
from fastapi.responses import JSONResponse
from src.blackbox.blackbox_factory import BlackboxFactory
import uvicorn
app = FastAPI()
@ -11,7 +12,6 @@ blackbox_factory = BlackboxFactory()
@app.post("/")
async def blackbox(blackbox_name: Union[str, None] = None, request: Request = None):
print(blackbox_name)
if not blackbox_name:
return await JSONResponse(content={"error": "blackbox_name is required"}, status_code=status.HTTP_400_BAD_REQUEST)
try:
@ -22,4 +22,7 @@ async def blackbox(blackbox_name: Union[str, None] = None, request: Request = No
@app.post("/workflows")
async def workflows(reqest: Request):
print("workflows")
print("workflows")
if __name__ == "__main__":
uvicorn.run("main:app", host="127.0.0.1", port=8000, log_level="info")