From 5fef68b62fb29c2f1dc4561de7898189b37f22b3 Mon Sep 17 00:00:00 2001 From: choizhang Date: Sat, 15 Mar 2025 00:52:21 +0800 Subject: [PATCH] Language switching and merging Add the webuiInitialize variable, dev: '', build:'/webui' --- lightrag/api/webui/index.html | 17 ----------------- lightrag_webui/src/components/AppSettings.tsx | 9 +++++++-- lightrag_webui/src/features/LoginPage.tsx | 6 ++---- lightrag_webui/src/features/SiteHeader.tsx | 8 +++++--- lightrag_webui/src/lib/constants.ts | 2 +- lightrag_webui/src/locales/en.json | 1 + lightrag_webui/src/locales/zh.json | 1 + 7 files changed, 17 insertions(+), 27 deletions(-) delete mode 100644 lightrag/api/webui/index.html diff --git a/lightrag/api/webui/index.html b/lightrag/api/webui/index.html deleted file mode 100644 index 49fc0ea6..00000000 --- a/lightrag/api/webui/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - Lightrag - - - - -
- - diff --git a/lightrag_webui/src/components/AppSettings.tsx b/lightrag_webui/src/components/AppSettings.tsx index 284ad67f..8f1407a7 100644 --- a/lightrag_webui/src/components/AppSettings.tsx +++ b/lightrag_webui/src/components/AppSettings.tsx @@ -5,8 +5,13 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { useSettingsStore } from '@/stores/settings' import { PaletteIcon } from 'lucide-react' import { useTranslation } from 'react-i18next' +import { cn } from '@/lib/utils' -export default function AppSettings() { +interface AppSettingsProps { + className?: string +} + +export default function AppSettings({ className }: AppSettingsProps) { const [opened, setOpened] = useState(false) const { t } = useTranslation() @@ -27,7 +32,7 @@ export default function AppSettings() { return ( - diff --git a/lightrag_webui/src/features/LoginPage.tsx b/lightrag_webui/src/features/LoginPage.tsx index ceb7e337..a79e225c 100644 --- a/lightrag_webui/src/features/LoginPage.tsx +++ b/lightrag_webui/src/features/LoginPage.tsx @@ -9,8 +9,7 @@ import { Card, CardContent, CardHeader } from '@/components/ui/Card' import Input from '@/components/ui/Input' import Button from '@/components/ui/Button' import { ZapIcon } from 'lucide-react' -import ThemeToggle from '@/components/ThemeToggle' -import LanguageToggle from '@/components/LanguageToggle' +import AppSettings from '@/components/AppSettings' const LoginPage = () => { const navigate = useNavigate() @@ -44,8 +43,7 @@ const LoginPage = () => { return (
- - +
diff --git a/lightrag_webui/src/features/SiteHeader.tsx b/lightrag_webui/src/features/SiteHeader.tsx index 4f494026..1cdc7531 100644 --- a/lightrag_webui/src/features/SiteHeader.tsx +++ b/lightrag_webui/src/features/SiteHeader.tsx @@ -1,7 +1,6 @@ import Button from '@/components/ui/Button' -import { SiteInfo } from '@/lib/constants' +import { SiteInfo, webuiPrefix } from '@/lib/constants' import AppSettings from '@/components/AppSettings' -import LanguageToggle from '@/components/LanguageToggle' import { TabsList, TabsTrigger } from '@/components/ui/Tabs' import { useSettingsStore } from '@/stores/settings' import { useAuthStore } from '@/stores/state' @@ -67,7 +66,7 @@ export default function SiteHeader() { return (
- + +
diff --git a/lightrag_webui/src/lib/constants.ts b/lightrag_webui/src/lib/constants.ts index 47b1124f..5f960b30 100644 --- a/lightrag_webui/src/lib/constants.ts +++ b/lightrag_webui/src/lib/constants.ts @@ -1,6 +1,6 @@ import { ButtonVariantType } from '@/components/ui/Button' -export const backendBaseUrl = 'http://localhost:9621/' +export const backendBaseUrl = '' export const webuiPrefix = '' export const controlButtonVariant: ButtonVariantType = 'ghost' diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json index 7e9623f2..079b784d 100644 --- a/lightrag_webui/src/locales/en.json +++ b/lightrag_webui/src/locales/en.json @@ -12,6 +12,7 @@ "retrieval": "Retrieval", "api": "API", "projectRepository": "Project Repository", + "logout": "Logout", "themeToggle": { "switchToLight": "Switch to light theme", "switchToDark": "Switch to dark theme" diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index 57c3d5ad..9cb0cf2f 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -12,6 +12,7 @@ "retrieval": "检索", "api": "API", "projectRepository": "项目仓库", + "logout": "退出登录", "themeToggle": { "switchToLight": "切换到浅色主题", "switchToDark": "切换到深色主题"