- Enhanced graph_routes.py and query_routes.py to support multi-tenant architecture by introducing tenant-specific RAG instances. - Updated create_graph_routes and create_query_routes functions to accept rag_manager for tenant management. - Added get_tenant_rag dependency to all relevant endpoints to ensure tenant context is utilized for operations. - Modified Vite configuration to include comprehensive API proxy rules for seamless interaction with backend services. - Implemented cascade delete functionality in tenant_service.py for tenant and knowledge base deletions. - Added detailed logging and error handling for tenant operations. - Created audit logs documenting the multi-tenant implementation process and decisions made.
2.1 KiB
2.1 KiB
Task Log: Multi-Tenant Filtering & API Tab Fix
Date: 2025-01-27 12:30 Mode: beastmode
Todo List Status
- Step 1: Pipeline/Document routes multi-tenant filtering (completed earlier)
- Step 2: Graph routes multi-tenant filtering (10 endpoints updated)
- Step 3: Query/Retrieval routes multi-tenant filtering (3 endpoints updated)
- Step 4: Update lightrag_server.py to pass rag_manager to all routes
- Step 5: Fix API tab visibility - Add /static proxy for Swagger UI assets
- Step 6: Restart Vite dev server to apply proxy configuration change (user action required)
Actions
- Updated
graph_routes.py: Addedget_tenant_ragdependency to all 10 graph endpoints - Updated
query_routes.py: Addedget_tenant_ragdependency to 3 query endpoints (/query,/query/stream,/query/data) - Updated
lightrag_server.py: Passrag_managertocreate_graph_routes()andcreate_query_routes() - Updated
vite.config.ts: Added/staticproxy to fix Swagger UI asset loading
Decisions
- Used same multi-tenant pattern across all routes:
get_tenant_ragdependency returns tenant-specific LightRAG instance - API tab fix: Added
/staticproxy rather than changing Swagger UI configuration
Next Steps
- Restart Vite dev server (Ctrl+C and
bun run dev) to apply proxy configuration change - Test API tab now shows Swagger UI
- Test graph/retrieval operations filter by KB when switching knowledgebases
Lessons/Insights
- Swagger UI loads from
/docsbut assets come from/static/swagger-ui/*- both paths need proxying - Vite's
base: '/webui/'setting redirects non-proxied paths, causing 404s for Swagger assets - Proxy configuration changes require dev server restart to take effect
Files Modified
lightrag/api/routers/graph_routes.py- Multi-tenant support for all graph endpointslightrag/api/routers/query_routes.py- Multi-tenant support for all query endpointslightrag/api/lightrag_server.py- Pass rag_manager to graph and query route creatorslightrag_webui/vite.config.ts- Added/staticproxy for Swagger UI assets