add API tab to display backend documentation
This commit is contained in:
@@ -12,6 +12,7 @@ import SiteHeader from '@/features/SiteHeader'
|
|||||||
import GraphViewer from '@/features/GraphViewer'
|
import GraphViewer from '@/features/GraphViewer'
|
||||||
import DocumentManager from '@/features/DocumentManager'
|
import DocumentManager from '@/features/DocumentManager'
|
||||||
import RetrievalTesting from '@/features/RetrievalTesting'
|
import RetrievalTesting from '@/features/RetrievalTesting'
|
||||||
|
import ApiSite from '@/features/ApiSite'
|
||||||
|
|
||||||
import { Tabs, TabsContent } from '@/components/ui/Tabs'
|
import { Tabs, TabsContent } from '@/components/ui/Tabs'
|
||||||
|
|
||||||
@@ -57,6 +58,9 @@ function App() {
|
|||||||
<TabsContent value="retrieval" className="absolute top-0 right-0 bottom-0 left-0">
|
<TabsContent value="retrieval" className="absolute top-0 right-0 bottom-0 left-0">
|
||||||
<RetrievalTesting />
|
<RetrievalTesting />
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
<TabsContent value="api" className="absolute top-0 right-0 bottom-0 left-0">
|
||||||
|
<ApiSite />
|
||||||
|
</TabsContent>
|
||||||
</div>
|
</div>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
{enableHealthCheck && <StatusIndicator />}
|
{enableHealthCheck && <StatusIndicator />}
|
||||||
|
5
lightrag_webui/src/features/ApiSite.tsx
Normal file
5
lightrag_webui/src/features/ApiSite.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { backendBaseUrl } from '@/lib/constants'
|
||||||
|
|
||||||
|
export default function ApiSite() {
|
||||||
|
return <iframe src={backendBaseUrl + '/docs'} className="size-full" />
|
||||||
|
}
|
@@ -7,9 +7,50 @@ import { cn } from '@/lib/utils'
|
|||||||
|
|
||||||
import { ZapIcon, GithubIcon } from 'lucide-react'
|
import { ZapIcon, GithubIcon } from 'lucide-react'
|
||||||
|
|
||||||
export default function SiteHeader() {
|
interface NavigationTabProps {
|
||||||
|
value: string
|
||||||
|
currentTab: string
|
||||||
|
children: React.ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
function NavigationTab({ value, currentTab, children }: NavigationTabProps) {
|
||||||
|
return (
|
||||||
|
<TabsTrigger
|
||||||
|
value={value}
|
||||||
|
className={cn(
|
||||||
|
'cursor-pointer px-2 py-1 transition-all',
|
||||||
|
currentTab === value ? '!bg-emerald-400 !text-zinc-50' : 'hover:bg-background/60'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</TabsTrigger>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function TabsNavigation() {
|
||||||
const currentTab = useSettingsStore.use.currentTab()
|
const currentTab = useSettingsStore.use.currentTab()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-8 self-center">
|
||||||
|
<TabsList className="h-full gap-2">
|
||||||
|
<NavigationTab value="documents" currentTab={currentTab}>
|
||||||
|
Documents
|
||||||
|
</NavigationTab>
|
||||||
|
<NavigationTab value="knowledge-graph" currentTab={currentTab}>
|
||||||
|
Knowledge Graph
|
||||||
|
</NavigationTab>
|
||||||
|
<NavigationTab value="retrieval" currentTab={currentTab}>
|
||||||
|
Retrieval
|
||||||
|
</NavigationTab>
|
||||||
|
<NavigationTab value="api" currentTab={currentTab}>
|
||||||
|
API
|
||||||
|
</NavigationTab>
|
||||||
|
</TabsList>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SiteHeader() {
|
||||||
return (
|
return (
|
||||||
<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">
|
<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">
|
||||||
<a href="/" className="mr-6 flex items-center gap-2">
|
<a href="/" className="mr-6 flex items-center gap-2">
|
||||||
@@ -18,43 +59,7 @@ export default function SiteHeader() {
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div className="flex h-10 flex-1 justify-center">
|
<div className="flex h-10 flex-1 justify-center">
|
||||||
<div className="flex h-8 self-center">
|
<TabsNavigation />
|
||||||
<TabsList className="h-full gap-2">
|
|
||||||
<TabsTrigger
|
|
||||||
value="documents"
|
|
||||||
className={cn(
|
|
||||||
'cursor-pointer px-2 py-1 transition-all',
|
|
||||||
currentTab === 'documents'
|
|
||||||
? '!bg-emerald-400 !text-zinc-50'
|
|
||||||
: 'hover:bg-background/60'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
Documents
|
|
||||||
</TabsTrigger>
|
|
||||||
<TabsTrigger
|
|
||||||
value="knowledge-graph"
|
|
||||||
className={cn(
|
|
||||||
'cursor-pointer px-2 py-1 transition-all',
|
|
||||||
currentTab === 'knowledge-graph'
|
|
||||||
? '!bg-emerald-400 !text-zinc-50'
|
|
||||||
: 'hover:bg-background/60'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
Knowledge Graph
|
|
||||||
</TabsTrigger>
|
|
||||||
<TabsTrigger
|
|
||||||
value="retrieval"
|
|
||||||
className={cn(
|
|
||||||
'cursor-pointer px-2 py-1 transition-all',
|
|
||||||
currentTab === 'retrieval'
|
|
||||||
? '!bg-emerald-400 !text-zinc-50'
|
|
||||||
: 'hover:bg-background/60'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
Retrieval
|
|
||||||
</TabsTrigger>
|
|
||||||
</TabsList>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav className="flex items-center">
|
<nav className="flex items-center">
|
||||||
@@ -68,3 +73,4 @@ export default function SiteHeader() {
|
|||||||
</header>
|
</header>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user