ArnoChen commited on
Commit
93cbd1b
·
1 Parent(s): 01c2d11

add API tab to display backend documentation

Browse files
lightrag_webui/src/App.tsx CHANGED
@@ -12,6 +12,7 @@ import SiteHeader from '@/features/SiteHeader'
12
  import GraphViewer from '@/features/GraphViewer'
13
  import DocumentManager from '@/features/DocumentManager'
14
  import RetrievalTesting from '@/features/RetrievalTesting'
 
15
 
16
  import { Tabs, TabsContent } from '@/components/ui/Tabs'
17
 
@@ -57,6 +58,9 @@ function App() {
57
  <TabsContent value="retrieval" className="absolute top-0 right-0 bottom-0 left-0">
58
  <RetrievalTesting />
59
  </TabsContent>
 
 
 
60
  </div>
61
  </Tabs>
62
  {enableHealthCheck && <StatusIndicator />}
 
12
  import GraphViewer from '@/features/GraphViewer'
13
  import DocumentManager from '@/features/DocumentManager'
14
  import RetrievalTesting from '@/features/RetrievalTesting'
15
+ import ApiSite from '@/features/ApiSite'
16
 
17
  import { Tabs, TabsContent } from '@/components/ui/Tabs'
18
 
 
58
  <TabsContent value="retrieval" className="absolute top-0 right-0 bottom-0 left-0">
59
  <RetrievalTesting />
60
  </TabsContent>
61
+ <TabsContent value="api" className="absolute top-0 right-0 bottom-0 left-0">
62
+ <ApiSite />
63
+ </TabsContent>
64
  </div>
65
  </Tabs>
66
  {enableHealthCheck && <StatusIndicator />}
lightrag_webui/src/features/ApiSite.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import { backendBaseUrl } from '@/lib/constants'
2
+
3
+ export default function ApiSite() {
4
+ return <iframe src={backendBaseUrl + '/docs'} className="size-full" />
5
+ }
lightrag_webui/src/features/SiteHeader.tsx CHANGED
@@ -7,9 +7,50 @@ import { cn } from '@/lib/utils'
7
 
8
  import { ZapIcon, GithubIcon } from 'lucide-react'
9
 
10
- export default function SiteHeader() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  const currentTab = useSettingsStore.use.currentTab()
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  return (
14
  <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">
15
  <a href="/" className="mr-6 flex items-center gap-2">
@@ -18,43 +59,7 @@ export default function SiteHeader() {
18
  </a>
19
 
20
  <div className="flex h-10 flex-1 justify-center">
21
- <div className="flex h-8 self-center">
22
- <TabsList className="h-full gap-2">
23
- <TabsTrigger
24
- value="documents"
25
- className={cn(
26
- 'cursor-pointer px-2 py-1 transition-all',
27
- currentTab === 'documents'
28
- ? '!bg-emerald-400 !text-zinc-50'
29
- : 'hover:bg-background/60'
30
- )}
31
- >
32
- Documents
33
- </TabsTrigger>
34
- <TabsTrigger
35
- value="knowledge-graph"
36
- className={cn(
37
- 'cursor-pointer px-2 py-1 transition-all',
38
- currentTab === 'knowledge-graph'
39
- ? '!bg-emerald-400 !text-zinc-50'
40
- : 'hover:bg-background/60'
41
- )}
42
- >
43
- Knowledge Graph
44
- </TabsTrigger>
45
- <TabsTrigger
46
- value="retrieval"
47
- className={cn(
48
- 'cursor-pointer px-2 py-1 transition-all',
49
- currentTab === 'retrieval'
50
- ? '!bg-emerald-400 !text-zinc-50'
51
- : 'hover:bg-background/60'
52
- )}
53
- >
54
- Retrieval
55
- </TabsTrigger>
56
- </TabsList>
57
- </div>
58
  </div>
59
 
60
  <nav className="flex items-center">
@@ -68,3 +73,4 @@ export default function SiteHeader() {
68
  </header>
69
  )
70
  }
 
 
7
 
8
  import { ZapIcon, GithubIcon } from 'lucide-react'
9
 
10
+ interface NavigationTabProps {
11
+ value: string
12
+ currentTab: string
13
+ children: React.ReactNode
14
+ }
15
+
16
+ function NavigationTab({ value, currentTab, children }: NavigationTabProps) {
17
+ return (
18
+ <TabsTrigger
19
+ value={value}
20
+ className={cn(
21
+ 'cursor-pointer px-2 py-1 transition-all',
22
+ currentTab === value ? '!bg-emerald-400 !text-zinc-50' : 'hover:bg-background/60'
23
+ )}
24
+ >
25
+ {children}
26
+ </TabsTrigger>
27
+ )
28
+ }
29
+
30
+ function TabsNavigation() {
31
  const currentTab = useSettingsStore.use.currentTab()
32
 
33
+ return (
34
+ <div className="flex h-8 self-center">
35
+ <TabsList className="h-full gap-2">
36
+ <NavigationTab value="documents" currentTab={currentTab}>
37
+ Documents
38
+ </NavigationTab>
39
+ <NavigationTab value="knowledge-graph" currentTab={currentTab}>
40
+ Knowledge Graph
41
+ </NavigationTab>
42
+ <NavigationTab value="retrieval" currentTab={currentTab}>
43
+ Retrieval
44
+ </NavigationTab>
45
+ <NavigationTab value="api" currentTab={currentTab}>
46
+ API
47
+ </NavigationTab>
48
+ </TabsList>
49
+ </div>
50
+ )
51
+ }
52
+
53
+ export default function SiteHeader() {
54
  return (
55
  <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">
56
  <a href="/" className="mr-6 flex items-center gap-2">
 
59
  </a>
60
 
61
  <div className="flex h-10 flex-1 justify-center">
62
+ <TabsNavigation />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  </div>
64
 
65
  <nav className="flex items-center">
 
73
  </header>
74
  )
75
  }
76
+