mirror of
https://github.com/csunny/DB-GPT.git
synced 2026-01-13 19:55:44 +00:00
29 lines
723 B
Python
29 lines
723 B
Python
from fastapi import (
|
|
APIRouter,
|
|
Request,
|
|
Body,
|
|
status,
|
|
HTTPException,
|
|
Response,
|
|
BackgroundTasks,
|
|
)
|
|
|
|
from fastapi.responses import JSONResponse, HTMLResponse
|
|
from fastapi.responses import StreamingResponse, FileResponse
|
|
from fastapi.encoders import jsonable_encoder
|
|
from fastapi.exceptions import RequestValidationError
|
|
|
|
from pilot.openapi.api_view_model import (
|
|
Result,
|
|
ConversationVo,
|
|
MessageVo,
|
|
ChatSceneVo,
|
|
)
|
|
|
|
|
|
async def validation_exception_handler(request: Request, exc: RequestValidationError):
|
|
message = ""
|
|
for error in exc.errors():
|
|
message += ".".join(error.get("loc")) + ":" + error.get("msg") + ";"
|
|
return Result.faild(code="E0001", msg=message)
|