Commit graph

52 commits

Author SHA1 Message Date
Raphaël MANSUY
1530450b0f cherry-pick 2496d871 2025-12-04 19:18:59 +08:00
Raphaël MANSUY
494135b19b cherry-pick 78ccc4f6 2025-12-04 19:18:41 +08:00
Raphaël MANSUY
215d392896 cherry-pick 04d23671 2025-12-04 19:18:35 +08:00
Raphaël MANSUY
78c1c69b0a cherry-pick be9e6d16 2025-12-04 19:18:16 +08:00
Raphaël MANSUY
922c2e7f7f cherry-pick c0b1552e (resolved) 2025-12-04 19:17:47 +08:00
BukeLy
f7b500bca2 feat: Add workspace isolation support for pipeline status
Problem:
In multi-tenant scenarios, different workspaces share a single global
pipeline_status namespace, causing pipelines from different tenants to
block each other, severely impacting concurrent processing performance.

Solution:
- Extended get_namespace_data() to recognize workspace-specific pipeline
  namespaces with pattern "{workspace}:pipeline" (following GraphDB pattern)
- Added workspace parameter to initialize_pipeline_status() for per-tenant
  isolated pipeline namespaces
- Updated all 7 call sites to use workspace-aware locks:
  * lightrag.py: process_document_queue(), aremove_document()
  * document_routes.py: background_delete_documents(), clear_documents(),
    cancel_pipeline(), get_pipeline_status(), delete_documents()

Impact:
- Different workspaces can process documents concurrently without blocking
- Backward compatible: empty workspace defaults to "pipeline_status"
- Maintains fail-fast: uninitialized pipeline raises clear error
- Expected N× performance improvement for N concurrent tenants

Bug fixes:
- Fixed AttributeError by using self.workspace instead of self.global_config
- Fixed pipeline status endpoint to show workspace-specific status
- Fixed delete endpoint to check workspace-specific busy flag

Code changes: 4 files, 141 insertions(+), 28 deletions(-)

Testing: All syntax checks passed, comprehensive workspace isolation tests completed
(cherry picked from commit eb52ec94d7)
2025-12-04 19:11:16 +08:00
yangdx
35dd68d767 Refine gitignore to only exclude root-level test files
(cherry picked from commit a790f081dc)
2025-12-04 19:11:09 +08:00
yangdx
06ceae92ab Add project intelligence files for AI agent collaboration
- Add .clinerules with technical patterns
- Create Agments.md for Codex agent guidance
- Ensures consistent behavior across all team members

(cherry picked from commit 577b9e6882)
2025-12-04 19:05:56 +08:00
Raphael MANSUY
fe9b8ec02a
tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4)
* feat: Implement multi-tenant architecture with tenant and knowledge base models

- Added data models for tenants, knowledge bases, and related configurations.
- Introduced role and permission management for users in the multi-tenant system.
- Created a service layer for managing tenants and knowledge bases, including CRUD operations.
- Developed a tenant-aware instance manager for LightRAG with caching and isolation features.
- Added a migration script to transition existing workspace-based deployments to the new multi-tenant architecture.

* chore: ignore lightrag/api/webui/assets/ directory

* chore: stop tracking lightrag/api/webui/assets (ignore in .gitignore)

* feat: Initialize LightRAG Multi-Tenant Stack with PostgreSQL

- Added README.md for project overview, setup instructions, and architecture details.
- Created docker-compose.yml to define services: PostgreSQL, Redis, LightRAG API, and Web UI.
- Introduced env.example for environment variable configuration.
- Implemented init-postgres.sql for PostgreSQL schema initialization with multi-tenant support.
- Added reproduce_issue.py for testing default tenant access via API.

* feat: Enhance TenantSelector and update related components for improved multi-tenant support

* feat: Enhance testing capabilities and update documentation

- Updated Makefile to include new test commands for various modes (compatibility, isolation, multi-tenant, security, coverage, and dry-run).
- Modified API health check endpoint in Makefile to reflect new port configuration.
- Updated QUICK_START.md and README.md to reflect changes in service URLs and ports.
- Added environment variables for testing modes in env.example.
- Introduced run_all_tests.sh script to automate testing across different modes.
- Created conftest.py for pytest configuration, including database fixtures and mock services.
- Implemented database helper functions for streamlined database operations in tests.
- Added test collection hooks to skip tests based on the current MULTITENANT_MODE.

* feat: Implement multi-tenant support with demo mode enabled by default

- Added multi-tenant configuration to the environment and Docker setup.
- Created pre-configured demo tenants (acme-corp and techstart) for testing.
- Updated API endpoints to support tenant-specific data access.
- Enhanced Makefile commands for better service management and database operations.
- Introduced user-tenant membership system with role-based access control.
- Added comprehensive documentation for multi-tenant setup and usage.
- Fixed issues with document visibility in multi-tenant environments.
- Implemented necessary database migrations for user memberships and legacy support.

* feat(audit): Add final audit report for multi-tenant implementation

- Documented overall assessment, architecture overview, test results, security findings, and recommendations.
- Included detailed findings on critical security issues and architectural concerns.

fix(security): Implement security fixes based on audit findings

- Removed global RAG fallback and enforced strict tenant context.
- Configured super-admin access and required user authentication for tenant access.
- Cleared localStorage on logout and improved error handling in WebUI.

chore(logs): Create task logs for audit and security fixes implementation

- Documented actions, decisions, and next steps for both audit and security fixes.
- Summarized test results and remaining recommendations.

chore(scripts): Enhance development stack management scripts

- Added scripts for cleaning, starting, and stopping the development stack.
- Improved output messages and ensured graceful shutdown of services.

feat(starter): Initialize PostgreSQL with AGE extension support

- Created initialization scripts for PostgreSQL extensions including uuid-ossp, vector, and AGE.
- Ensured successful installation and verification of extensions.

* feat: Implement auto-select for first tenant and KB on initial load in WebUI

- Removed WEBUI_INITIAL_STATE_FIX.md as the issue is resolved.
- Added useTenantInitialization hook to automatically select the first available tenant and KB on app load.
- Integrated the new hook into the Root component of the WebUI.
- Updated RetrievalTesting component to ensure a KB is selected before allowing user interaction.
- Created end-to-end tests for multi-tenant isolation and real service interactions.
- Added scripts for starting, stopping, and cleaning the development stack.
- Enhanced API and tenant routes to support tenant-specific pipeline status initialization.
- Updated constants for backend URL to reflect the correct port.
- Improved error handling and logging in various components.

* feat: Add multi-tenant support with enhanced E2E testing scripts and client functionality

* update client

* Add integration and unit tests for multi-tenant API, models, security, and storage

- Implement integration tests for tenant and knowledge base management endpoints in `test_tenant_api_routes.py`.
- Create unit tests for tenant isolation, model validation, and role permissions in `test_tenant_models.py`.
- Add security tests to enforce role-based permissions and context validation in `test_tenant_security.py`.
- Develop tests for tenant-aware storage operations and context isolation in `test_tenant_storage_phase3.py`.

* feat(e2e): Implement OpenAI model support and database reset functionality

* Add comprehensive test suite for gpt-5-nano compatibility

- Introduced tests for parameter normalization, embeddings, and entity extraction.
- Implemented direct API testing for gpt-5-nano.
- Validated .env configuration loading and OpenAI API connectivity.
- Analyzed reasoning token overhead with various token limits.
- Documented test procedures and expected outcomes in README files.
- Ensured all tests pass for production readiness.

* kg(postgres_impl): ensure AGE extension is loaded in session and configure graph initialization

* dev: add hybrid dev helper scripts, Makefile, docker-compose.dev-db and local development docs

* feat(dev): add dev helper scripts and local development documentation for hybrid setup

* feat(multi-tenant): add detailed specifications and logs for multi-tenant improvements, including UX, backend handling, and ingestion pipeline

* feat(migration): add generated tenant/kb columns, indexes, triggers; drop unused tables; update schema and docs

* test(backward-compat): adapt tests to new StorageNameSpace/TenantService APIs (use concrete dummy storages)

* chore: multi-tenant and UX updates — docs, webui, storage, tenant service adjustments

* tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency

- gpt5_nano_compatibility: add pytest-asyncio markers, skip when OPENAI key missing, prevent module-level asyncio.run collection, add conftest
- Ollama tests: add server availability check and skip markers; avoid pytest collection warnings by renaming helper classes
- Graph storage tests: rename interactive test functions to avoid pytest collection
- Document & Tenant routes: support external_ids for idempotency; ensure HTTPExceptions are re-raised
- LightRAG core: support external_ids in apipeline_enqueue_documents and idempotent logic
- Tests updated to match API changes (tenant routes & document routes)
- Add logs and scripts for inspection and audit
2025-12-04 16:04:21 +08:00
yangdx
0b45d463df Add .clinerules to .gitignore 2025-08-15 00:43:45 +08:00
yangdx
ecd7777e61 Update OpenAI embedding handling for both list and base64 embeddings
- Fix OpenAI embedding array parsing
- Improve embedding data type safety
2025-08-09 08:40:33 +08:00
yangdx
8dd3069005 feat: add tiktoken cache directory support for offline deployment
- Mount tiktoken cache volume in docker-compose
- Add TIKTOKEN_CACHE_DIR environment variable
- Update env.example with tiktoken cache configuration
- Added /data to gitignore
- Added tiktoken env example
2025-08-05 14:22:19 +08:00
yangdx
d94b5f07a4 Update .gitignore 2025-06-02 17:26:00 +08:00
Daniel.y
dbad528e62
Update .gitignore 2025-03-13 02:19:23 +08:00
yangdx
5b70d34822 Fix get single node subgrap problem
- Replaced MATCH with OPTIONAL MATCH
- Add memory-bank directory for Cline to .gitignore
2025-03-13 02:14:02 +08:00
zrguo
1611400854 fix demo 2025-03-03 18:33:42 +08:00
yangdx
8fb3670ac7 Add additional log-related patterns to gitignore 2025-03-02 02:26:21 +08:00
yangdx
a8abcf14ac Fit linting 2025-02-20 04:12:21 +08:00
yangdx
36de7e3197 Add test_* pattern to .gitignore for unit test files 2025-02-20 03:46:36 +08:00
zrguo
fc6dff04ff fix logger level 2025-02-17 15:10:15 +08:00
yangdx
8f6e9fcf50 Merge branch 'main' into add-env-settings 2025-02-16 22:34:39 +08:00
yangdx
cfb49fc013 Delete inline comment about config.ini 2025-02-16 22:31:12 +08:00
Yannick Stephan
50919442e9 Improve git and docker ignore 2025-02-15 00:58:24 +01:00
Saifeddine ALOUI
06c9e4e454 Fixed missing imports bug and fixed linting 2025-01-25 00:55:07 +01:00
Saifeddine ALOUI
34018cb1e0 Separated llms from the main llm.py file and fixed some deprication bugs 2025-01-25 00:11:00 +01:00
jin
6ae8647285 support pipeline mode 2025-01-16 12:58:15 +08:00
jin
957bcf8659 Organize files
move some test files from root to example
2025-01-07 13:51:20 +08:00
Saifeddine ALOUI
9921223281 Merge remote-tracking branch 'upstream/main' 2024-12-25 18:04:02 +01:00
Saifeddine ALOUI
848465d5d7 precommit tested 2024-12-24 10:35:00 +01:00
Luca Congiu
725d5af215 Refactor code formatting and update requirements for improved clarity and consistency 2024-12-24 09:56:33 +01:00
Luca Congiu
58e74d5fb2 Added Azure OpenAI api sample with streaming 2024-12-23 14:34:34 +01:00
Saifeddine ALOUI
fe6ebfa995 Fixed linting 2024-12-19 11:44:01 +01:00
Saifeddine ALOUI
d8f4f3eede Added a fastapi service 2024-12-16 01:05:49 +01:00
jin
26ae240c65 Logic Optimization 2024-11-25 13:40:38 +08:00
jin
89c2de54a2 Optimization logic 2024-11-25 13:29:55 +08:00
jin
8bc5d4efff add Oracle support 2024-11-12 09:59:12 +08:00
LarFii
b49f73181c update 2024-11-11 17:54:22 +08:00
LarFii
4c0352ee2b Add delete method 2024-11-11 17:48:40 +08:00
jin
b1cf41d242 fix bug 2024-11-11 15:19:42 +08:00
wiltshirek
f40725feeb Merge branch 'main' into main 2024-11-01 16:50:45 -04:00
Ken Wiltshire
b41d990fd6 securing for production with env vars for creds 2024-11-01 11:01:50 -04:00
Ken Wiltshire
e966a14418 set kg by start param, defaults to networkx 2024-11-01 08:47:52 -04:00
Ken Wiltshire
e4509327dd index to neo4j working and tested. check queires next. 2024-10-30 17:48:14 -04:00
Ken Wiltshire
01b7df7afa inference running locally. use neo4j next 2024-10-27 15:37:41 -04:00
Andrii Lazarchuk
392bf05be1 Merge remote-tracking branch 'origin/main' into fix-ollama-integration 2024-10-21 12:00:37 +00:00
Andrii Lazarchuk
25a2dd41c1 Add ability to passadditional parameters to ollama library like host and timeout 2024-10-21 11:55:46 +00:00
Andrii Lazarchuk
108fc4a1ee Add ability to passadditional parameters to ollama library like host and timeout 2024-10-21 11:53:06 +00:00
LarFii
bcd81e3a50 Add visualization methods 2024-10-20 23:08:26 +08:00
nongbin
d78c78276b ignore idea files 2024-10-20 10:04:34 +08:00
nongbin
6206e0e340 add visualizing graph 2024-10-20 09:55:52 +08:00