|
|
@@ -3,6 +3,7 @@ import json
|
|
|
import uuid
|
|
|
from fastapi import FastAPI, HTTPException, Request
|
|
|
from fastapi.responses import JSONResponse
|
|
|
+from fastapi.middleware.cors import CORSMiddleware
|
|
|
from pydantic import BaseModel
|
|
|
from utils.params import TaskStatusParam, DecodeListParam,TopicListParam,EvaluateListParam,EvaluateStatusParam,DecodeWorkflowParam
|
|
|
from dotenv import load_dotenv, find_dotenv
|
|
|
@@ -32,6 +33,13 @@ app = FastAPI()
|
|
|
|
|
|
scheduler = TaskScheduler()
|
|
|
|
|
|
+app.add_middleware(
|
|
|
+ CORSMiddleware,
|
|
|
+ allow_origins=["*"],
|
|
|
+ allow_credentials=True,
|
|
|
+ allow_methods=["*"],
|
|
|
+ allow_headers=["*"],
|
|
|
+)
|
|
|
|
|
|
@app.exception_handler(HTTPException)
|
|
|
async def http_exception_handler(request: Request, exc: HTTPException):
|
|
|
@@ -233,4 +241,3 @@ def get_evaluate_result(param: EvaluateStatusParam):
|
|
|
"error":error_reason,
|
|
|
}
|
|
|
}
|
|
|
-
|