Merge pull request #1154 from danielaskdd/main
Browse filesFix version display problem when server does not require auth
lightrag/api/webui/assets/index-BcBS1RaQ.css
ADDED
Binary file (53 kB). View file
|
|
lightrag/api/webui/assets/index-Cq65VeVX.css
DELETED
Binary file (53.1 kB)
|
|
lightrag/api/webui/assets/{index-D8-h_xyk.js → index-DpQ0dh7t.js}
RENAMED
Binary files a/lightrag/api/webui/assets/index-D8-h_xyk.js and b/lightrag/api/webui/assets/index-DpQ0dh7t.js differ
|
|
lightrag/api/webui/index.html
CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
|
|
lightrag_webui/src/AppRouter.tsx
CHANGED
@@ -43,7 +43,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|
43 |
|
44 |
if (!status.auth_configured && status.access_token) {
|
45 |
// If auth is not configured, use the guest token
|
46 |
-
useAuthStore.getState().login(status.access_token, true)
|
47 |
if (status.message) {
|
48 |
toast.info(status.message)
|
49 |
}
|
@@ -126,7 +126,7 @@ const AppContent = () => {
|
|
126 |
|
127 |
if (!status.auth_configured && status.access_token) {
|
128 |
// If auth is not configured, use the guest token
|
129 |
-
useAuthStore.getState().login(status.access_token, true)
|
130 |
if (status.message) {
|
131 |
toast.info(status.message)
|
132 |
}
|
|
|
43 |
|
44 |
if (!status.auth_configured && status.access_token) {
|
45 |
// If auth is not configured, use the guest token
|
46 |
+
useAuthStore.getState().login(status.access_token, true, status.core_version, status.api_version)
|
47 |
if (status.message) {
|
48 |
toast.info(status.message)
|
49 |
}
|
|
|
126 |
|
127 |
if (!status.auth_configured && status.access_token) {
|
128 |
// If auth is not configured, use the guest token
|
129 |
+
useAuthStore.getState().login(status.access_token, true, status.core_version, status.api_version)
|
130 |
if (status.message) {
|
131 |
toast.info(status.message)
|
132 |
}
|
lightrag_webui/src/stores/state.ts
CHANGED
@@ -88,20 +88,23 @@ const isGuestToken = (token: string): boolean => {
|
|
88 |
// Initialize auth state from localStorage
|
89 |
const initAuthState = (): { isAuthenticated: boolean; isGuestMode: boolean; coreVersion: string | null; apiVersion: string | null } => {
|
90 |
const token = localStorage.getItem('LIGHTRAG-API-TOKEN');
|
|
|
|
|
|
|
91 |
if (!token) {
|
92 |
return {
|
93 |
isAuthenticated: false,
|
94 |
isGuestMode: false,
|
95 |
-
coreVersion:
|
96 |
-
apiVersion:
|
97 |
};
|
98 |
}
|
99 |
|
100 |
return {
|
101 |
isAuthenticated: true,
|
102 |
isGuestMode: isGuestToken(token),
|
103 |
-
coreVersion:
|
104 |
-
apiVersion:
|
105 |
};
|
106 |
};
|
107 |
|
@@ -118,7 +121,6 @@ export const useAuthStore = create<AuthState>(set => {
|
|
118 |
login: (token, isGuest = false, coreVersion = null, apiVersion = null) => {
|
119 |
localStorage.setItem('LIGHTRAG-API-TOKEN', token);
|
120 |
|
121 |
-
// 存储版本信息到 localStorage
|
122 |
if (coreVersion) {
|
123 |
localStorage.setItem('LIGHTRAG-CORE-VERSION', coreVersion);
|
124 |
}
|
@@ -129,19 +131,22 @@ export const useAuthStore = create<AuthState>(set => {
|
|
129 |
set({
|
130 |
isAuthenticated: true,
|
131 |
isGuestMode: isGuest,
|
132 |
-
coreVersion,
|
133 |
-
apiVersion
|
134 |
});
|
135 |
},
|
136 |
|
137 |
logout: () => {
|
138 |
localStorage.removeItem('LIGHTRAG-API-TOKEN');
|
139 |
|
|
|
|
|
|
|
140 |
set({
|
141 |
isAuthenticated: false,
|
142 |
isGuestMode: false,
|
143 |
-
coreVersion:
|
144 |
-
apiVersion:
|
145 |
});
|
146 |
}
|
147 |
};
|
|
|
88 |
// Initialize auth state from localStorage
|
89 |
const initAuthState = (): { isAuthenticated: boolean; isGuestMode: boolean; coreVersion: string | null; apiVersion: string | null } => {
|
90 |
const token = localStorage.getItem('LIGHTRAG-API-TOKEN');
|
91 |
+
const coreVersion = localStorage.getItem('LIGHTRAG-CORE-VERSION');
|
92 |
+
const apiVersion = localStorage.getItem('LIGHTRAG-API-VERSION');
|
93 |
+
|
94 |
if (!token) {
|
95 |
return {
|
96 |
isAuthenticated: false,
|
97 |
isGuestMode: false,
|
98 |
+
coreVersion: coreVersion,
|
99 |
+
apiVersion: apiVersion
|
100 |
};
|
101 |
}
|
102 |
|
103 |
return {
|
104 |
isAuthenticated: true,
|
105 |
isGuestMode: isGuestToken(token),
|
106 |
+
coreVersion: coreVersion,
|
107 |
+
apiVersion: apiVersion
|
108 |
};
|
109 |
};
|
110 |
|
|
|
121 |
login: (token, isGuest = false, coreVersion = null, apiVersion = null) => {
|
122 |
localStorage.setItem('LIGHTRAG-API-TOKEN', token);
|
123 |
|
|
|
124 |
if (coreVersion) {
|
125 |
localStorage.setItem('LIGHTRAG-CORE-VERSION', coreVersion);
|
126 |
}
|
|
|
131 |
set({
|
132 |
isAuthenticated: true,
|
133 |
isGuestMode: isGuest,
|
134 |
+
coreVersion: coreVersion,
|
135 |
+
apiVersion: apiVersion
|
136 |
});
|
137 |
},
|
138 |
|
139 |
logout: () => {
|
140 |
localStorage.removeItem('LIGHTRAG-API-TOKEN');
|
141 |
|
142 |
+
const coreVersion = localStorage.getItem('LIGHTRAG-CORE-VERSION');
|
143 |
+
const apiVersion = localStorage.getItem('LIGHTRAG-API-VERSION');
|
144 |
+
|
145 |
set({
|
146 |
isAuthenticated: false,
|
147 |
isGuestMode: false,
|
148 |
+
coreVersion: coreVersion,
|
149 |
+
apiVersion: apiVersion
|
150 |
});
|
151 |
}
|
152 |
};
|