11 Commits

Author SHA1 Message Date
Milin
4dbd5e3899 Merge branch 'main' into optimize-config-management
# Conflicts:
#	env.example
#	lightrag/api/utils_api.py
2025-03-31 11:29:29 +08:00
Milin
088fc19318 feat(config): Refactor configuration management
- Optimize JWT Auth module to load configuration via `global_args`.
- Decouple configuration-related code from `utils_api.py`, and add a new `config.py` file for unified configuration management.
- Adjust configuration import in `lightrag_server.py`, `auth.py`, and `document_routes.py` to be introduced through `global_args`.
2025-03-31 11:19:47 +08:00
yangdx
c590d5878c refactor: standardize .env loading behavior across modules
- Use .env from current folder for each lightrag instance
- Allow different .env files for different instances
- Make OS env vars take precedence over .env file
2025-03-29 03:37:23 +08:00
Milin
b868dddac5 feat(webui): Display logged-in username
- Add username display in the `SiteHeader` component.
- Update logout button text to include username.
- Add `username` field in auth state.
- Optimize token parsing logic to extract username information.
- pre-commit fix
2025-03-24 15:59:18 +08:00
Milin
4dfdb9032c feat(auth): Implement multi-user login support
- Add an `accounts` dictionary in `AuthHandler` to store multiple user account information.
- Modify login logic to support multiple user account verification.
- Update environment variable example, add description for `AUTH_ACCOUNTS` variable.
- Adjust authentication status check logic, use `auth_handler.accounts` to determine if authentication is configured.
2025-03-24 14:34:31 +08:00
yangdx
53396e4d82 Fixlinting 2025-03-21 16:56:47 +08:00
yangdx
67eee2d2d5 Prioritize OS environment variables over .env file to improve Docker compatibility for the server 2025-03-21 13:27:12 +08:00
yangdx
43996656d3 Fix linting 2025-03-18 03:30:43 +08:00
yangdx
f8440c8f80 feat(auth): implement auto guest mode and enhance token system
- Add role-based token system with metadata support
- Implement automatic guest mode for unconfigured authentication
- Create new /auth-status endpoint for authentication status checking
- Modify frontend to auto-detect auth status and bypass login when appropriate
- Add guest mode indicator in site header for better UX

This change allows users to automatically access the system without manual
login when authentication is not configured, while maintaining secure
authentication when credentials are properly set up.
2025-03-18 02:56:02 +08:00
Milin
c015296081 refactor(api): Fix issues reported by pre-commit
- Modified code layout and formatting in multiple files, improving code readability.
  - Updated import statements, removing unused libraries.
  - Simplified the writing of some functions and exception handling.
2025-03-06 14:23:52 +08:00
Milin
63aa4f9dfc feat(api): Add user authentication functionality
- Implement JWT-based user authentication logic
- Add login endpoint and token validation middleware
- Update API routes with authentication dependencies
- Add authentication-related environment variables
- Optimize requirements.txt with necessary dependencies
2025-03-05 11:09:31 +08:00