* Remove outdated documentation files: Quick Start Guide, Apache AGE Analysis, and Scratchpad. * Add multi-tenant testing strategy and ADR index documentation - Introduced ADR 008 detailing the multi-tenant testing strategy for the ./starter environment, covering compatibility and multi-tenant modes, testing scenarios, and implementation details. - Created a comprehensive ADR index (README.md) summarizing all architecture decision records related to the multi-tenant implementation, including purpose, key sections, and reading paths for different roles. * feat(docs): Add comprehensive multi-tenancy guide and README for LightRAG Enterprise - Introduced `0008-multi-tenancy.md` detailing multi-tenancy architecture, key concepts, roles, permissions, configuration, and API endpoints. - Created `README.md` as the main documentation index, outlining features, quick start, system overview, and deployment options. - Documented the LightRAG architecture, storage backends, LLM integrations, and query modes. - Established a task log (`2025-01-21-lightrag-documentation-log.md`) summarizing documentation creation actions, decisions, and insights.
1.9 KiB
1.9 KiB
Action Plan: API Refactoring & WebUI Cleanup
Objective
Refactor the Tenant API to follow multi-tenant best practices by removing explicit tenant_id from path parameters and relying on context injection. Update the WebUI to consume these new endpoints.
Phase 1: Backend API Refactoring (lightrag/api/routers/tenant_routes.py)
1.1 Introduce Context-Aware Endpoints
- Create
/tenants/meendpoint to retrieve current tenant info based on context. - Create
/knowledge-basesendpoints (GET, POST) that infertenant_idfromTenantContext. - Create
/knowledge-bases/{kb_id}endpoints (GET, PUT, DELETE) that infertenant_idfromTenantContext.
1.2 Deprecate/Secure Explicit Path Endpoints
- Mark
/tenants/{tenant_id}endpoints as deprecated or restrict them to "super-admin" roles only. - Ensure
list_tenants(/tenants) is protected or strictly rate-limited.
1.3 Update Dependency Injection
- Ensure
get_tenant_contextis used consistently across all new endpoints.
Phase 2: Frontend WebUI Refactoring (lightrag_webui/src/api/tenant.ts)
2.1 Update API Client
- Implement
fetchCurrentTenantusing/tenants/me. - Update
fetchKnowledgeBasesPaginatedto use/knowledge-bases. - Update
createKnowledgeBase,updateKnowledgeBase,deleteKnowledgeBaseto use/knowledge-basesendpoints.
2.2 Context Management
- Ensure the frontend sets the
X-Tenant-IDheader (or relies on subdomain) for all requests. - Remove
tenantIdarguments from API functions where it's no longer needed (or make them optional for backward compatibility).
Phase 3: Cleanup & Verification
3.1 Remove Dead Code
- Remove unused API functions in frontend.
- Remove unused routes in backend (after verification).
3.2 Testing
- Verify that a user logged in as Tenant A cannot access Tenant B's data via the new endpoints.
- Verify that the WebUI still functions correctly with the new API structure.