new-feature:add a new feature in two utils
Some checks failed
Deploy to Staging / deploy (push) Has been cancelled
Lint Backend / lint-backend (push) Has been cancelled
Playwright Tests / changes (push) Has been cancelled
Playwright Tests / test-playwright (1, 4) (push) Has been cancelled
Playwright Tests / test-playwright (2, 4) (push) Has been cancelled
Playwright Tests / test-playwright (3, 4) (push) Has been cancelled
Playwright Tests / test-playwright (4, 4) (push) Has been cancelled
Playwright Tests / merge-playwright-reports (push) Has been cancelled
Playwright Tests / alls-green-playwright (push) Has been cancelled
Test Backend / test-backend (push) Has been cancelled
Test Docker Compose / test-docker-compose (push) Has been cancelled
Some checks failed
Deploy to Staging / deploy (push) Has been cancelled
Lint Backend / lint-backend (push) Has been cancelled
Playwright Tests / changes (push) Has been cancelled
Playwright Tests / test-playwright (1, 4) (push) Has been cancelled
Playwright Tests / test-playwright (2, 4) (push) Has been cancelled
Playwright Tests / test-playwright (3, 4) (push) Has been cancelled
Playwright Tests / test-playwright (4, 4) (push) Has been cancelled
Playwright Tests / merge-playwright-reports (push) Has been cancelled
Playwright Tests / alls-green-playwright (push) Has been cancelled
Test Backend / test-backend (push) Has been cancelled
Test Docker Compose / test-docker-compose (push) Has been cancelled
This commit is contained in:
@@ -5,7 +5,7 @@ from pydantic import BaseModel
|
|||||||
|
|
||||||
from app.api.deps import get_current_active_superuser
|
from app.api.deps import get_current_active_superuser
|
||||||
from app.models import Message
|
from app.models import Message
|
||||||
from app.utils import generate_test_email, send_email
|
from app.utils import generate_test_email, send_email, fast_json_response
|
||||||
|
|
||||||
router = APIRouter(prefix="/utils", tags=["utils"])
|
router = APIRouter(prefix="/utils", tags=["utils"])
|
||||||
|
|
||||||
@@ -43,5 +43,4 @@ async def bentoml_classifiy(data: ClassifyRequest):
|
|||||||
json={"text": f"{data.text}"}
|
json={"text": f"{data.text}"}
|
||||||
)
|
)
|
||||||
result = response.json()
|
result = response.json()
|
||||||
|
return fast_json_response(data=result)
|
||||||
return result
|
|
||||||
|
|||||||
@@ -121,3 +121,12 @@ def verify_password_reset_token(token: str) -> str | None:
|
|||||||
return str(decoded_token["sub"])
|
return str(decoded_token["sub"])
|
||||||
except InvalidTokenError:
|
except InvalidTokenError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
|
def fast_json_response(data=None, code=200, msg="success"):
|
||||||
|
return JSONResponse({
|
||||||
|
"code": code,
|
||||||
|
"data": data or {},
|
||||||
|
"msg": msg
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user