yangdx
commited on
Commit
·
60dd37e
1
Parent(s):
a7b9344
Optimize server setting dialogue
Browse files- lightrag_webui/src/components/status/StatusCard.tsx +6 -6
- lightrag_webui/src/components/status/StatusDialog.tsx +32 -0
- lightrag_webui/src/components/status/StatusIndicator.tsx +26 -24
- lightrag_webui/src/locales/ar.json +3 -0
- lightrag_webui/src/locales/en.json +3 -0
- lightrag_webui/src/locales/fr.json +3 -0
- lightrag_webui/src/locales/zh.json +3 -0
lightrag_webui/src/components/status/StatusCard.tsx
CHANGED
@@ -4,14 +4,14 @@ import { useTranslation } from 'react-i18next'
|
|
4 |
const StatusCard = ({ status }: { status: LightragStatus | null }) => {
|
5 |
const { t } = useTranslation()
|
6 |
if (!status) {
|
7 |
-
return <div className="text-
|
8 |
}
|
9 |
|
10 |
return (
|
11 |
-
<div className="min-w-[300px] space-y-
|
12 |
<div className="space-y-1">
|
13 |
<h4 className="font-medium">{t('graphPanel.statusCard.storageInfo')}</h4>
|
14 |
-
<div className="text-
|
15 |
<span>{t('graphPanel.statusCard.workingDirectory')}:</span>
|
16 |
<span className="truncate">{status.working_directory}</span>
|
17 |
<span>{t('graphPanel.statusCard.inputDirectory')}:</span>
|
@@ -21,7 +21,7 @@ const StatusCard = ({ status }: { status: LightragStatus | null }) => {
|
|
21 |
|
22 |
<div className="space-y-1">
|
23 |
<h4 className="font-medium">{t('graphPanel.statusCard.llmConfig')}</h4>
|
24 |
-
<div className="text-
|
25 |
<span>{t('graphPanel.statusCard.llmBinding')}:</span>
|
26 |
<span>{status.configuration.llm_binding}</span>
|
27 |
<span>{t('graphPanel.statusCard.llmBindingHost')}:</span>
|
@@ -35,7 +35,7 @@ const StatusCard = ({ status }: { status: LightragStatus | null }) => {
|
|
35 |
|
36 |
<div className="space-y-1">
|
37 |
<h4 className="font-medium">{t('graphPanel.statusCard.embeddingConfig')}</h4>
|
38 |
-
<div className="text-
|
39 |
<span>{t('graphPanel.statusCard.embeddingBinding')}:</span>
|
40 |
<span>{status.configuration.embedding_binding}</span>
|
41 |
<span>{t('graphPanel.statusCard.embeddingBindingHost')}:</span>
|
@@ -47,7 +47,7 @@ const StatusCard = ({ status }: { status: LightragStatus | null }) => {
|
|
47 |
|
48 |
<div className="space-y-1">
|
49 |
<h4 className="font-medium">{t('graphPanel.statusCard.storageConfig')}</h4>
|
50 |
-
<div className="text-
|
51 |
<span>{t('graphPanel.statusCard.kvStorage')}:</span>
|
52 |
<span>{status.configuration.kv_storage}</span>
|
53 |
<span>{t('graphPanel.statusCard.docStatusStorage')}:</span>
|
|
|
4 |
const StatusCard = ({ status }: { status: LightragStatus | null }) => {
|
5 |
const { t } = useTranslation()
|
6 |
if (!status) {
|
7 |
+
return <div className="text-foreground text-xs">{t('graphPanel.statusCard.unavailable')}</div>
|
8 |
}
|
9 |
|
10 |
return (
|
11 |
+
<div className="min-w-[300px] space-y-2 text-xs">
|
12 |
<div className="space-y-1">
|
13 |
<h4 className="font-medium">{t('graphPanel.statusCard.storageInfo')}</h4>
|
14 |
+
<div className="text-foreground grid grid-cols-[120px_1fr] gap-1">
|
15 |
<span>{t('graphPanel.statusCard.workingDirectory')}:</span>
|
16 |
<span className="truncate">{status.working_directory}</span>
|
17 |
<span>{t('graphPanel.statusCard.inputDirectory')}:</span>
|
|
|
21 |
|
22 |
<div className="space-y-1">
|
23 |
<h4 className="font-medium">{t('graphPanel.statusCard.llmConfig')}</h4>
|
24 |
+
<div className="text-foreground grid grid-cols-[120px_1fr] gap-1">
|
25 |
<span>{t('graphPanel.statusCard.llmBinding')}:</span>
|
26 |
<span>{status.configuration.llm_binding}</span>
|
27 |
<span>{t('graphPanel.statusCard.llmBindingHost')}:</span>
|
|
|
35 |
|
36 |
<div className="space-y-1">
|
37 |
<h4 className="font-medium">{t('graphPanel.statusCard.embeddingConfig')}</h4>
|
38 |
+
<div className="text-foreground grid grid-cols-[120px_1fr] gap-1">
|
39 |
<span>{t('graphPanel.statusCard.embeddingBinding')}:</span>
|
40 |
<span>{status.configuration.embedding_binding}</span>
|
41 |
<span>{t('graphPanel.statusCard.embeddingBindingHost')}:</span>
|
|
|
47 |
|
48 |
<div className="space-y-1">
|
49 |
<h4 className="font-medium">{t('graphPanel.statusCard.storageConfig')}</h4>
|
50 |
+
<div className="text-foreground grid grid-cols-[120px_1fr] gap-1">
|
51 |
<span>{t('graphPanel.statusCard.kvStorage')}:</span>
|
52 |
<span>{status.configuration.kv_storage}</span>
|
53 |
<span>{t('graphPanel.statusCard.docStatusStorage')}:</span>
|
lightrag_webui/src/components/status/StatusDialog.tsx
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { LightragStatus } from '@/api/lightrag'
|
2 |
+
import { useTranslation } from 'react-i18next'
|
3 |
+
import {
|
4 |
+
Dialog,
|
5 |
+
DialogContent,
|
6 |
+
DialogHeader,
|
7 |
+
DialogTitle,
|
8 |
+
} from '@/components/ui/Dialog'
|
9 |
+
import StatusCard from './StatusCard'
|
10 |
+
|
11 |
+
interface StatusDialogProps {
|
12 |
+
open: boolean
|
13 |
+
onOpenChange: (open: boolean) => void
|
14 |
+
status: LightragStatus | null
|
15 |
+
}
|
16 |
+
|
17 |
+
const StatusDialog = ({ open, onOpenChange, status }: StatusDialogProps) => {
|
18 |
+
const { t } = useTranslation()
|
19 |
+
|
20 |
+
return (
|
21 |
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
22 |
+
<DialogContent className="sm:max-w-[500px]">
|
23 |
+
<DialogHeader>
|
24 |
+
<DialogTitle>{t('graphPanel.statusDialog.title')}</DialogTitle>
|
25 |
+
</DialogHeader>
|
26 |
+
<StatusCard status={status} />
|
27 |
+
</DialogContent>
|
28 |
+
</Dialog>
|
29 |
+
)
|
30 |
+
}
|
31 |
+
|
32 |
+
export default StatusDialog
|
lightrag_webui/src/components/status/StatusIndicator.tsx
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
import { cn } from '@/lib/utils'
|
2 |
import { useBackendState } from '@/stores/state'
|
3 |
import { useEffect, useState } from 'react'
|
4 |
-
import
|
5 |
-
import StatusCard from '@/components/status/StatusCard'
|
6 |
import { useTranslation } from 'react-i18next'
|
7 |
|
8 |
const StatusIndicator = () => {
|
@@ -11,6 +10,7 @@ const StatusIndicator = () => {
|
|
11 |
const lastCheckTime = useBackendState.use.lastCheckTime()
|
12 |
const status = useBackendState.use.status()
|
13 |
const [animate, setAnimate] = useState(false)
|
|
|
14 |
|
15 |
// listen to health change
|
16 |
useEffect(() => {
|
@@ -21,28 +21,30 @@ const StatusIndicator = () => {
|
|
21 |
|
22 |
return (
|
23 |
<div className="fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none">
|
24 |
-
<
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
</div>
|
47 |
)
|
48 |
}
|
|
|
1 |
import { cn } from '@/lib/utils'
|
2 |
import { useBackendState } from '@/stores/state'
|
3 |
import { useEffect, useState } from 'react'
|
4 |
+
import StatusDialog from './StatusDialog'
|
|
|
5 |
import { useTranslation } from 'react-i18next'
|
6 |
|
7 |
const StatusIndicator = () => {
|
|
|
10 |
const lastCheckTime = useBackendState.use.lastCheckTime()
|
11 |
const status = useBackendState.use.status()
|
12 |
const [animate, setAnimate] = useState(false)
|
13 |
+
const [dialogOpen, setDialogOpen] = useState(false)
|
14 |
|
15 |
// listen to health change
|
16 |
useEffect(() => {
|
|
|
21 |
|
22 |
return (
|
23 |
<div className="fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none">
|
24 |
+
<div
|
25 |
+
className="flex cursor-pointer items-center gap-2"
|
26 |
+
onClick={() => setDialogOpen(true)}
|
27 |
+
>
|
28 |
+
<div
|
29 |
+
className={cn(
|
30 |
+
'h-3 w-3 rounded-full transition-all duration-300',
|
31 |
+
'shadow-[0_0_8px_rgba(0,0,0,0.2)]',
|
32 |
+
health ? 'bg-green-500' : 'bg-red-500',
|
33 |
+
animate && 'scale-125',
|
34 |
+
animate && health && 'shadow-[0_0_12px_rgba(34,197,94,0.4)]',
|
35 |
+
animate && !health && 'shadow-[0_0_12px_rgba(239,68,68,0.4)]'
|
36 |
+
)}
|
37 |
+
/>
|
38 |
+
<span className="text-muted-foreground text-xs">
|
39 |
+
{health ? t('graphPanel.statusIndicator.connected') : t('graphPanel.statusIndicator.disconnected')}
|
40 |
+
</span>
|
41 |
+
</div>
|
42 |
+
|
43 |
+
<StatusDialog
|
44 |
+
open={dialogOpen}
|
45 |
+
onOpenChange={setDialogOpen}
|
46 |
+
status={status}
|
47 |
+
/>
|
48 |
</div>
|
49 |
)
|
50 |
}
|
lightrag_webui/src/locales/ar.json
CHANGED
@@ -137,6 +137,9 @@
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "تم اقتصار بيانات الرسم البياني على الحد الأقصى للعقد",
|
|
|
|
|
|
|
140 |
"sideBar": {
|
141 |
"settings": {
|
142 |
"settings": "الإعدادات",
|
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "تم اقتصار بيانات الرسم البياني على الحد الأقصى للعقد",
|
140 |
+
"statusDialog": {
|
141 |
+
"title": "إعدادات خادم LightRAG"
|
142 |
+
},
|
143 |
"sideBar": {
|
144 |
"settings": {
|
145 |
"settings": "الإعدادات",
|
lightrag_webui/src/locales/en.json
CHANGED
@@ -137,6 +137,9 @@
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "Graph data is truncated to Max Nodes",
|
|
|
|
|
|
|
140 |
"sideBar": {
|
141 |
"settings": {
|
142 |
"settings": "Settings",
|
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "Graph data is truncated to Max Nodes",
|
140 |
+
"statusDialog": {
|
141 |
+
"title": "LightRAG Server Settings"
|
142 |
+
},
|
143 |
"sideBar": {
|
144 |
"settings": {
|
145 |
"settings": "Settings",
|
lightrag_webui/src/locales/fr.json
CHANGED
@@ -137,6 +137,9 @@
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "Les données du graphe sont tronquées au nombre maximum de nœuds",
|
|
|
|
|
|
|
140 |
"sideBar": {
|
141 |
"settings": {
|
142 |
"settings": "Paramètres",
|
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "Les données du graphe sont tronquées au nombre maximum de nœuds",
|
140 |
+
"statusDialog": {
|
141 |
+
"title": "Paramètres du Serveur LightRAG"
|
142 |
+
},
|
143 |
"sideBar": {
|
144 |
"settings": {
|
145 |
"settings": "Paramètres",
|
lightrag_webui/src/locales/zh.json
CHANGED
@@ -137,6 +137,9 @@
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "图数据已截断至最大返回节点数",
|
|
|
|
|
|
|
140 |
"sideBar": {
|
141 |
"settings": {
|
142 |
"settings": "设置",
|
|
|
137 |
},
|
138 |
"graphPanel": {
|
139 |
"dataIsTruncated": "图数据已截断至最大返回节点数",
|
140 |
+
"statusDialog": {
|
141 |
+
"title": "LightRAG 服务器设置"
|
142 |
+
},
|
143 |
"sideBar": {
|
144 |
"settings": {
|
145 |
"settings": "设置",
|