From ef754a43002cddfa3da036d95445e8928552e778 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 13 Mar 2025 12:38:33 +0800 Subject: [PATCH] Explicitly set API docs and schema URLs. - Set OpenAPI schema URL to `/openapi.json` - Set docs URL to `/docs` - Set redoc URL to `/redoc` - Update Vite config for API docs routing - Ensure proper path handling for docs endpoints --- lightrag/api/lightrag_server.py | 3 +++ lightrag_webui/vite.config.ts | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index fd09a691..f4b21e66 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -177,6 +177,9 @@ def create_app(args): if api_key else "", version=__api_version__, + openapi_url="/openapi.json", # Explicitly set OpenAPI schema URL + docs_url="/docs", # Explicitly set docs URL + redoc_url="/redoc", # Explicitly set redoc URL openapi_tags=[{"name": "api"}], lifespan=lifespan, ) diff --git a/lightrag_webui/vite.config.ts b/lightrag_webui/vite.config.ts index 09ecd7ea..b05bf2fa 100644 --- a/lightrag_webui/vite.config.ts +++ b/lightrag_webui/vite.config.ts @@ -26,7 +26,9 @@ export default defineConfig({ target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621', changeOrigin: true, rewrite: endpoint === '/api' ? - (path) => path.replace(/^\/api/, '') : undefined + (path) => path.replace(/^\/api/, '') : + endpoint === '/docs' || endpoint === '/openapi.json' ? + (path) => path : undefined } ]) ) : {}