INNER CODE UNIT · Python

general_exception_handler

cqzyys/lang-agent · lang-agent-backend/lang_agent/main.py:126

    async def general_exception_handler(request: Request, exc: Exception):
        logger.error(exc)
        return JSONResponse(
            status_code=404,
            content=ApiResponse(
                success=False,
                error=error_to_str(exc),
                status_code=404,
            ).model_dump(),
        )


def run(host, port):
    # 初始化FastAPI
    app = FastAPI(title="Lang-Agent集成API", version="1.0.0", lifespan=lifespan)

    # 跨域配置
    app.add_middleware(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…