choizhang
commited on
Commit
·
c9b5d82
1
Parent(s):
4421a58
Change to hash routing, webuiInitialize controls project prefix
Browse files- lightrag/api/webui/assets/index-CH-3l4_Z.css +0 -0
- lightrag/api/webui/assets/index-CJz72b6Q.js +0 -0
- lightrag/api/webui/index.html +0 -0
- lightrag/api/webui/logo.png +0 -3
- lightrag_webui/index.html +1 -1
- lightrag_webui/src/AppRouter.tsx +3 -3
- lightrag_webui/src/api/lightrag.ts +3 -3
- lightrag_webui/src/features/LoginPage.tsx +1 -1
- lightrag_webui/src/lib/constants.ts +2 -1
- lightrag_webui/tsconfig.json +1 -1
- lightrag_webui/vite.config.ts +3 -2
lightrag/api/webui/assets/index-CH-3l4_Z.css
DELETED
Binary file (47.7 kB)
|
|
lightrag/api/webui/assets/index-CJz72b6Q.js
DELETED
Binary file (1.8 MB)
|
|
lightrag/api/webui/index.html
DELETED
Binary file (458 Bytes)
|
|
lightrag/api/webui/logo.png
DELETED
Git LFS Details
|
lightrag_webui/index.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8" />
|
5 |
-
<link rel="icon" type="image/svg+xml" href="
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7 |
<title>Lightrag</title>
|
8 |
</head>
|
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8" />
|
5 |
+
<link rel="icon" type="image/svg+xml" href="logo.png" />
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7 |
<title>Lightrag</title>
|
8 |
</head>
|
lightrag_webui/src/AppRouter.tsx
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import {
|
2 |
// import { useAuthStore } from '@/stores/state'
|
3 |
import { Toaster } from 'sonner'
|
4 |
import App from './App'
|
@@ -22,7 +22,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|
22 |
const AppRouter = () => {
|
23 |
return (
|
24 |
<ThemeProvider>
|
25 |
-
<
|
26 |
<Routes>
|
27 |
<Route path="/login" element={<LoginPage />} />
|
28 |
<Route
|
@@ -35,7 +35,7 @@ const AppRouter = () => {
|
|
35 |
/>
|
36 |
</Routes>
|
37 |
<Toaster position="top-center" />
|
38 |
-
</
|
39 |
</ThemeProvider>
|
40 |
)
|
41 |
}
|
|
|
1 |
+
import { HashRouter as Router, Routes, Route } from 'react-router-dom'
|
2 |
// import { useAuthStore } from '@/stores/state'
|
3 |
import { Toaster } from 'sonner'
|
4 |
import App from './App'
|
|
|
22 |
const AppRouter = () => {
|
23 |
return (
|
24 |
<ThemeProvider>
|
25 |
+
<Router>
|
26 |
<Routes>
|
27 |
<Route path="/login" element={<LoginPage />} />
|
28 |
<Route
|
|
|
35 |
/>
|
36 |
</Routes>
|
37 |
<Toaster position="top-center" />
|
38 |
+
</Router>
|
39 |
</ThemeProvider>
|
40 |
)
|
41 |
}
|
lightrag_webui/src/api/lightrag.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import axios, { AxiosError } from 'axios'
|
2 |
-
import { backendBaseUrl } from '@/lib/constants'
|
3 |
import { errorMessage } from '@/lib/utils'
|
4 |
import { useSettingsStore } from '@/stores/settings'
|
5 |
import { useAuthStore } from '@/stores/state'
|
@@ -169,8 +169,8 @@ axiosInstance.interceptors.response.use(
|
|
169 |
sessionStorage.clear();
|
170 |
useAuthStore.getState().logout();
|
171 |
|
172 |
-
if (window.location.pathname !==
|
173 |
-
window.location.href =
|
174 |
}
|
175 |
|
176 |
return Promise.reject(error);
|
|
|
1 |
import axios, { AxiosError } from 'axios'
|
2 |
+
import { backendBaseUrl, webuiPrefix } from '@/lib/constants'
|
3 |
import { errorMessage } from '@/lib/utils'
|
4 |
import { useSettingsStore } from '@/stores/settings'
|
5 |
import { useAuthStore } from '@/stores/state'
|
|
|
169 |
sessionStorage.clear();
|
170 |
useAuthStore.getState().logout();
|
171 |
|
172 |
+
if (window.location.pathname !== `${webuiPrefix}/#/login`) {
|
173 |
+
window.location.href = `${webuiPrefix}/#/login`;
|
174 |
}
|
175 |
|
176 |
return Promise.reject(error);
|
lightrag_webui/src/features/LoginPage.tsx
CHANGED
@@ -51,7 +51,7 @@ const LoginPage = () => {
|
|
51 |
<CardHeader className="flex items-center justify-center space-y-2 pb-8 pt-6">
|
52 |
<div className="flex flex-col items-center space-y-4">
|
53 |
<div className="flex items-center gap-3">
|
54 |
-
<img src="
|
55 |
<ZapIcon className="size-10 text-emerald-400" aria-hidden="true" />
|
56 |
</div>
|
57 |
<div className="text-center space-y-2">
|
|
|
51 |
<CardHeader className="flex items-center justify-center space-y-2 pb-8 pt-6">
|
52 |
<div className="flex flex-col items-center space-y-4">
|
53 |
<div className="flex items-center gap-3">
|
54 |
+
<img src="logo.png" alt="LightRAG Logo" className="h-12 w-12" />
|
55 |
<ZapIcon className="size-10 text-emerald-400" aria-hidden="true" />
|
56 |
</div>
|
57 |
<div className="text-center space-y-2">
|
lightrag_webui/src/lib/constants.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import { ButtonVariantType } from '@/components/ui/Button'
|
2 |
|
3 |
-
export const backendBaseUrl = ''
|
|
|
4 |
|
5 |
export const controlButtonVariant: ButtonVariantType = 'ghost'
|
6 |
|
|
|
1 |
import { ButtonVariantType } from '@/components/ui/Button'
|
2 |
|
3 |
+
export const backendBaseUrl = 'http://localhost:9621/'
|
4 |
+
export const webuiPrefix = '/webui'
|
5 |
|
6 |
export const controlButtonVariant: ButtonVariantType = 'ghost'
|
7 |
|
lightrag_webui/tsconfig.json
CHANGED
@@ -26,5 +26,5 @@
|
|
26 |
"@/*": ["./src/*"]
|
27 |
}
|
28 |
},
|
29 |
-
"include": ["src", "vite.config.ts"]
|
30 |
}
|
|
|
26 |
"@/*": ["./src/*"]
|
27 |
}
|
28 |
},
|
29 |
+
"include": ["src", "vite.config.ts", "src/vite-env.d.ts"]
|
30 |
}
|
lightrag_webui/vite.config.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import { defineConfig } from 'vite'
|
2 |
import path from 'path'
|
3 |
-
|
4 |
import react from '@vitejs/plugin-react-swc'
|
5 |
import tailwindcss from '@tailwindcss/vite'
|
6 |
|
@@ -12,7 +12,8 @@ export default defineConfig({
|
|
12 |
'@': path.resolve(__dirname, './src')
|
13 |
}
|
14 |
},
|
15 |
-
base: '
|
|
|
16 |
build: {
|
17 |
outDir: path.resolve(__dirname, '../lightrag/api/webui'),
|
18 |
emptyOutDir: true
|
|
|
1 |
import { defineConfig } from 'vite'
|
2 |
import path from 'path'
|
3 |
+
import { webuiPrefix } from '@/lib/constants'
|
4 |
import react from '@vitejs/plugin-react-swc'
|
5 |
import tailwindcss from '@tailwindcss/vite'
|
6 |
|
|
|
12 |
'@': path.resolve(__dirname, './src')
|
13 |
}
|
14 |
},
|
15 |
+
// base: import.meta.env.VITE_BASE_URL || '/webui/',
|
16 |
+
base: webuiPrefix,
|
17 |
build: {
|
18 |
outDir: path.resolve(__dirname, '../lightrag/api/webui'),
|
19 |
emptyOutDir: true
|