-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): knowledge base datasource management pages (#408)
- Loading branch information
Showing
66 changed files
with
893 additions
and
909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
frontend/app/src/app/(main)/(admin)/datasources/[id]/documents/page.tsx
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
frontend/app/src/app/(main)/(admin)/datasources/[id]/page.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(special)/data-sources/new/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use client'; | ||
|
||
import { AdminPageHeading } from '@/components/admin-page-heading'; | ||
import { CreateDatasourceForm } from '@/components/datasource/create-datasource-form'; | ||
import { mutateKnowledgeBases, useKnowledgeBase } from '@/components/knowledge-base/hooks'; | ||
import { Loader2Icon } from 'lucide-react'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
export default function NewKnowledgeBaseDataSourcePage ({ params }: { params: { id: string } }) { | ||
const id = parseInt(decodeURIComponent(params.id)); | ||
const { knowledgeBase } = useKnowledgeBase(id); | ||
const router = useRouter(); | ||
|
||
return ( | ||
<> | ||
<AdminPageHeading | ||
breadcrumbs={[ | ||
{ title: 'Knowledge Bases', url: '/knowledge-bases' }, | ||
{ title: knowledgeBase?.name ?? <Loader2Icon className="size-4 animate-spin repeat-infinite" />, url: `/knowledge-bases/${id}` }, | ||
{ title: 'DataSources', url: `/knowledge-bases/${id}/data-sources` }, | ||
{ title: 'New' }, | ||
]} | ||
/> | ||
<CreateDatasourceForm | ||
knowledgeBaseId={id} | ||
onCreated={() => { | ||
router.back(); | ||
mutateKnowledgeBases(); | ||
}} | ||
/> | ||
</> | ||
); | ||
} |
57 changes: 57 additions & 0 deletions
57
frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/data-sources/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use client'; | ||
|
||
import { DatasourceCard } from '@/components/datasource/datasource-card'; | ||
import { DatasourceCreateOption } from '@/components/datasource/datasource-create-option'; | ||
import { NoDatasourcePlaceholder } from '@/components/datasource/no-datasource-placeholder'; | ||
import { useAllKnowledgeBaseDataSources } from '@/components/knowledge-base/hooks'; | ||
import { Skeleton } from '@/components/ui/skeleton'; | ||
import { FileDownIcon, GlobeIcon, PaperclipIcon } from 'lucide-react'; | ||
|
||
export default function KnowledgeBaseDataSourcesPage ({ params }: { params: { id: string } }) { | ||
const id = parseInt(decodeURIComponent(params.id)); | ||
const { data: dataSources, isLoading } = useAllKnowledgeBaseDataSources(id); | ||
|
||
return ( | ||
<div className="space-y-8 max-w-screen-sm"> | ||
<section className="space-y-4"> | ||
<h3>Create Data Source</h3> | ||
<div className="grid md:grid-cols-3 gap-4"> | ||
<DatasourceCreateOption | ||
knowledgeBaseId={id} | ||
type="file" | ||
icon={<PaperclipIcon className="size-4 flex-shrink-0" />} | ||
title="Files" | ||
> | ||
Upload files | ||
</DatasourceCreateOption> | ||
<DatasourceCreateOption | ||
knowledgeBaseId={id} | ||
type="web_single_page" | ||
icon={<FileDownIcon className="size-4 flex-shrink-0" />} | ||
title="Web Pages" | ||
> | ||
Select pages. | ||
</DatasourceCreateOption> | ||
<DatasourceCreateOption | ||
knowledgeBaseId={id} | ||
type="web_sitemap" | ||
icon={<GlobeIcon className="size-4 flex-shrink-0" />} | ||
title="Website by sitemap" | ||
> | ||
Select web sitemap. | ||
</DatasourceCreateOption> | ||
</div> | ||
</section> | ||
<section className="space-y-4"> | ||
<h3>Browse existing Data Sources</h3> | ||
{isLoading && <Skeleton className="h-20 rounded-lg" />} | ||
{dataSources?.map(datasource => ( | ||
<DatasourceCard key={datasource.id} knowledgeBaseId={id} datasource={datasource} /> | ||
))} | ||
{dataSources?.length === 0 && ( | ||
<NoDatasourcePlaceholder /> | ||
)} | ||
</section> | ||
</div> | ||
); | ||
} |
12 changes: 12 additions & 0 deletions
12
frontend/app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/index-progress/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { KnowledgeBaseIndexProgress } from '@/components/knowledge-base/knowledge-base-index'; | ||
|
||
export default function KnowledgeBaseIndexProgressPage ({ params }: { params: { id: string } }) { | ||
const id = parseInt(decodeURIComponent(params.id)); | ||
|
||
return ( | ||
<section className="space-y-2"> | ||
<h3 className="text-lg font-medium">Index Progress</h3> | ||
<KnowledgeBaseIndexProgress id={id} /> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../app/src/app/(main)/(admin)/knowledge-bases/[id]/(tabs)/knowledge-graph-explorer/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { GraphEditor } from '@/components/graph/GraphEditor'; | ||
|
||
export default function KnowledgeGraphExplorerPage ({ params }: { params: { id: string } }) { | ||
const id = parseInt(decodeURIComponent(params.id)); | ||
|
||
return ( | ||
<section className="space-y-2"> | ||
<GraphEditor knowledgeBaseId={id} /> | ||
</section> | ||
); | ||
} |
Oops, something went wrong.