choizhang commited on
Commit
ce48dbe
·
1 Parent(s): c4b1597

Language switching and merging

Browse files

Add the webuiInitialize variable, dev: '', build:'/webui'

lightrag/api/webui/index.html DELETED
Binary file (642 Bytes)
 
lightrag_webui/src/components/AppSettings.tsx CHANGED
@@ -5,8 +5,13 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
5
  import { useSettingsStore } from '@/stores/settings'
6
  import { PaletteIcon } from 'lucide-react'
7
  import { useTranslation } from 'react-i18next'
 
8
 
9
- export default function AppSettings() {
 
 
 
 
10
  const [opened, setOpened] = useState<boolean>(false)
11
  const { t } = useTranslation()
12
 
@@ -27,7 +32,7 @@ export default function AppSettings() {
27
  return (
28
  <Popover open={opened} onOpenChange={setOpened}>
29
  <PopoverTrigger asChild>
30
- <Button variant="outline" size="icon" className="h-9 w-9">
31
  <PaletteIcon className="h-5 w-5" />
32
  </Button>
33
  </PopoverTrigger>
 
5
  import { useSettingsStore } from '@/stores/settings'
6
  import { PaletteIcon } from 'lucide-react'
7
  import { useTranslation } from 'react-i18next'
8
+ import { cn } from '@/lib/utils'
9
 
10
+ interface AppSettingsProps {
11
+ className?: string
12
+ }
13
+
14
+ export default function AppSettings({ className }: AppSettingsProps) {
15
  const [opened, setOpened] = useState<boolean>(false)
16
  const { t } = useTranslation()
17
 
 
32
  return (
33
  <Popover open={opened} onOpenChange={setOpened}>
34
  <PopoverTrigger asChild>
35
+ <Button variant="ghost" size="icon" className={cn("h-9 w-9", className)}>
36
  <PaletteIcon className="h-5 w-5" />
37
  </Button>
38
  </PopoverTrigger>
lightrag_webui/src/features/LoginPage.tsx CHANGED
@@ -9,8 +9,7 @@ import { Card, CardContent, CardHeader } from '@/components/ui/Card'
9
  import Input from '@/components/ui/Input'
10
  import Button from '@/components/ui/Button'
11
  import { ZapIcon } from 'lucide-react'
12
- import ThemeToggle from '@/components/ThemeToggle'
13
- import LanguageToggle from '@/components/LanguageToggle'
14
 
15
  const LoginPage = () => {
16
  const navigate = useNavigate()
@@ -44,8 +43,7 @@ const LoginPage = () => {
44
  return (
45
  <div className="flex h-screen w-screen items-center justify-center bg-gradient-to-br from-emerald-50 to-teal-100 dark:from-gray-900 dark:to-gray-800">
46
  <div className="absolute top-4 right-4 flex items-center gap-2">
47
- <LanguageToggle />
48
- <ThemeToggle />
49
  </div>
50
  <Card className="w-full max-w-[480px] shadow-lg mx-4">
51
  <CardHeader className="flex items-center justify-center space-y-2 pb-8 pt-6">
 
9
  import Input from '@/components/ui/Input'
10
  import Button from '@/components/ui/Button'
11
  import { ZapIcon } from 'lucide-react'
12
+ import AppSettings from '@/components/AppSettings'
 
13
 
14
  const LoginPage = () => {
15
  const navigate = useNavigate()
 
43
  return (
44
  <div className="flex h-screen w-screen items-center justify-center bg-gradient-to-br from-emerald-50 to-teal-100 dark:from-gray-900 dark:to-gray-800">
45
  <div className="absolute top-4 right-4 flex items-center gap-2">
46
+ <AppSettings className="bg-white/30 dark:bg-gray-800/30 backdrop-blur-sm rounded-md" />
 
47
  </div>
48
  <Card className="w-full max-w-[480px] shadow-lg mx-4">
49
  <CardHeader className="flex items-center justify-center space-y-2 pb-8 pt-6">
lightrag_webui/src/features/SiteHeader.tsx CHANGED
@@ -1,7 +1,6 @@
1
  import Button from '@/components/ui/Button'
2
- import { SiteInfo } from '@/lib/constants'
3
  import AppSettings from '@/components/AppSettings'
4
- import LanguageToggle from '@/components/LanguageToggle'
5
  import { TabsList, TabsTrigger } from '@/components/ui/Tabs'
6
  import { useSettingsStore } from '@/stores/settings'
7
  import { useAuthStore } from '@/stores/state'
@@ -67,7 +66,7 @@ export default function SiteHeader() {
67
 
68
  return (
69
  <header className="border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur">
70
- <a href="/" className="mr-6 flex items-center gap-2">
71
  <ZapIcon className="size-4 text-emerald-400" aria-hidden="true" />
72
  {/* <img src='/logo.png' className="size-4" /> */}
73
  <span className="font-bold md:inline-block">{SiteInfo.name}</span>
@@ -85,6 +84,9 @@ export default function SiteHeader() {
85
  </a>
86
  </Button>
87
  <AppSettings />
 
 
 
88
  </div>
89
  </nav>
90
  </header>
 
1
  import Button from '@/components/ui/Button'
2
+ import { SiteInfo, webuiPrefix } from '@/lib/constants'
3
  import AppSettings from '@/components/AppSettings'
 
4
  import { TabsList, TabsTrigger } from '@/components/ui/Tabs'
5
  import { useSettingsStore } from '@/stores/settings'
6
  import { useAuthStore } from '@/stores/state'
 
66
 
67
  return (
68
  <header className="border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur">
69
+ <a href={webuiPrefix} className="mr-6 flex items-center gap-2">
70
  <ZapIcon className="size-4 text-emerald-400" aria-hidden="true" />
71
  {/* <img src='/logo.png' className="size-4" /> */}
72
  <span className="font-bold md:inline-block">{SiteInfo.name}</span>
 
84
  </a>
85
  </Button>
86
  <AppSettings />
87
+ <Button variant="ghost" size="icon" side="bottom" tooltip={t('header.logout')} onClick={handleLogout}>
88
+ <LogOutIcon className="size-4" aria-hidden="true" />
89
+ </Button>
90
  </div>
91
  </nav>
92
  </header>
lightrag_webui/src/lib/constants.ts CHANGED
@@ -1,6 +1,6 @@
1
  import { ButtonVariantType } from '@/components/ui/Button'
2
 
3
- export const backendBaseUrl = 'http://localhost:9621/'
4
  export const webuiPrefix = ''
5
 
6
  export const controlButtonVariant: ButtonVariantType = 'ghost'
 
1
  import { ButtonVariantType } from '@/components/ui/Button'
2
 
3
+ export const backendBaseUrl = ''
4
  export const webuiPrefix = ''
5
 
6
  export const controlButtonVariant: ButtonVariantType = 'ghost'
lightrag_webui/src/locales/en.json CHANGED
@@ -12,6 +12,7 @@
12
  "retrieval": "Retrieval",
13
  "api": "API",
14
  "projectRepository": "Project Repository",
 
15
  "themeToggle": {
16
  "switchToLight": "Switch to light theme",
17
  "switchToDark": "Switch to dark theme"
 
12
  "retrieval": "Retrieval",
13
  "api": "API",
14
  "projectRepository": "Project Repository",
15
+ "logout": "Logout",
16
  "themeToggle": {
17
  "switchToLight": "Switch to light theme",
18
  "switchToDark": "Switch to dark theme"
lightrag_webui/src/locales/zh.json CHANGED
@@ -12,6 +12,7 @@
12
  "retrieval": "检索",
13
  "api": "API",
14
  "projectRepository": "项目仓库",
 
15
  "themeToggle": {
16
  "switchToLight": "切换到浅色主题",
17
  "switchToDark": "切换到深色主题"
 
12
  "retrieval": "检索",
13
  "api": "API",
14
  "projectRepository": "项目仓库",
15
+ "logout": "退出登录",
16
  "themeToggle": {
17
  "switchToLight": "切换到浅色主题",
18
  "switchToDark": "切换到深色主题"