yangdx
commited on
Commit
·
507cacb
1
Parent(s):
6fd7cb8
Added auth mode status to health check endpoint.
Browse files- Introduced auth_mode in health check response
- Updated App.tsx to handle guest mode logic
lightrag/api/lightrag_server.py
CHANGED
@@ -417,6 +417,13 @@ def create_app(args):
|
|
417 |
# Get update flags status for all namespaces
|
418 |
update_status = await get_all_update_flags_status()
|
419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
return {
|
421 |
"status": "healthy",
|
422 |
"working_directory": str(args.working_dir),
|
@@ -440,6 +447,7 @@ def create_app(args):
|
|
440 |
"update_status": update_status,
|
441 |
"core_version": core_version,
|
442 |
"api_version": __api_version__,
|
|
|
443 |
}
|
444 |
|
445 |
# Custom StaticFiles class to prevent caching of HTML files
|
|
|
417 |
# Get update flags status for all namespaces
|
418 |
update_status = await get_all_update_flags_status()
|
419 |
|
420 |
+
username = os.getenv("AUTH_USERNAME")
|
421 |
+
password = os.getenv("AUTH_PASSWORD")
|
422 |
+
if not (username and password):
|
423 |
+
auth_mode = "disabled"
|
424 |
+
else:
|
425 |
+
auth_mode = "enabled"
|
426 |
+
|
427 |
return {
|
428 |
"status": "healthy",
|
429 |
"working_directory": str(args.working_dir),
|
|
|
447 |
"update_status": update_status,
|
448 |
"core_version": core_version,
|
449 |
"api_version": __api_version__,
|
450 |
+
"auth_mode": auth_mode,
|
451 |
}
|
452 |
|
453 |
# Custom StaticFiles class to prevent caching of HTML files
|
lightrag_webui/src/App.tsx
CHANGED
@@ -61,10 +61,11 @@ function App() {
|
|
61 |
try {
|
62 |
const status = await getAuthStatus();
|
63 |
if (status.core_version || status.api_version) {
|
|
|
64 |
// Update version info while maintaining login state
|
65 |
useAuthStore.getState().login(
|
66 |
token,
|
67 |
-
|
68 |
status.core_version,
|
69 |
status.api_version
|
70 |
);
|
|
|
61 |
try {
|
62 |
const status = await getAuthStatus();
|
63 |
if (status.core_version || status.api_version) {
|
64 |
+
const isGuestMode = status.auth_mode === 'disabled' || useAuthStore.getState().isGuestMode;
|
65 |
// Update version info while maintaining login state
|
66 |
useAuthStore.getState().login(
|
67 |
token,
|
68 |
+
isGuestMode,
|
69 |
status.core_version,
|
70 |
status.api_version
|
71 |
);
|
lightrag_webui/src/api/lightrag.ts
CHANGED
@@ -44,6 +44,7 @@ export type LightragStatus = {
|
|
44 |
update_status?: Record<string, any>
|
45 |
core_version?: string
|
46 |
api_version?: string
|
|
|
47 |
}
|
48 |
|
49 |
export type LightragDocumentsScanProgress = {
|
|
|
44 |
update_status?: Record<string, any>
|
45 |
core_version?: string
|
46 |
api_version?: string
|
47 |
+
auth_mode?: 'enabled' | 'disabled'
|
48 |
}
|
49 |
|
50 |
export type LightragDocumentsScanProgress = {
|