Merge pull request #1078 from danielaskdd/fix-frontend-dev-mode

Explicitly set API docs and schema URLs.
This commit is contained in:
Daniel.y
2025-03-13 12:42:24 +08:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -177,6 +177,9 @@ def create_app(args):
if api_key if api_key
else "", else "",
version=__api_version__, 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"}], openapi_tags=[{"name": "api"}],
lifespan=lifespan, lifespan=lifespan,
) )

View File

@@ -26,7 +26,9 @@ export default defineConfig({
target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621', target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621',
changeOrigin: true, changeOrigin: true,
rewrite: endpoint === '/api' ? rewrite: endpoint === '/api' ?
(path) => path.replace(/^\/api/, '') : undefined (path) => path.replace(/^\/api/, '') :
endpoint === '/docs' || endpoint === '/openapi.json' ?
(path) => path : undefined
} }
]) ])
) : {} ) : {}