diff --git a/datacenter/app/datastores/documents/chunklist/page.tsx b/datacenter/app/datastores/documents/chunklist/page.tsx index c0a0b3538..804ef0cfe 100644 --- a/datacenter/app/datastores/documents/chunklist/page.tsx +++ b/datacenter/app/datastores/documents/chunklist/page.tsx @@ -1,13 +1,21 @@ 'use client' -import { useSearchParams } from 'next/navigation' +import { useSearchParams, useRouter } from 'next/navigation' import React, { useState, useEffect } from 'react' -import { useColorScheme, Table, Stack } from '@/lib/mui' +import { + useColorScheme, + Table, + Stack, + Typography, + Breadcrumbs, + Link +} from '@/lib/mui' import { Popover, Pagination } from 'antd' import { fetchBaseURL } from '@/app/datastores/constants' const page_size = 20 const ChunkList = () => { + const router = useRouter() const { mode } = useColorScheme() const spaceName = useSearchParams().get('spacename') const documentId = useSearchParams().get('documentid') @@ -41,99 +49,137 @@ const ChunkList = () => { }, []) return (
- {chunkList.length ? ( - <> - + + { + router.push('/datastores') }} + key="Knowledge Space" + underline="hover" + color="neutral" + fontSize="inherit" > - - - - - - - - - {chunkList.map((row: any) => ( - - - - - - ))} - -
NameContentMeta Data
{row.doc_name} - { - - {row.content.length > 10 - ? `${row.content.slice(0, 10)}...` - : row.content} - - } - - { - - {row.meta_info.length > 10 - ? `${row.meta_info.slice(0, 10)}...` - : row.meta_info} - - } -
- + { + router.push(`/datastores/documents?name=${spaceName}`) }} + key="Knowledge Space" + underline="hover" + color="neutral" + fontSize="inherit" > - { - const res = await fetch( - `${fetchBaseURL}/knowledge/${spaceName}/chunk/list`, - { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - document_id: documentId, - page, - page_size - }) - } - ) - const data = await res.json() - if (data.success) { - setChunkList(data.data.data) - setTotal(data.data.total) - setCurrent(data.data.page) + Documents + + Chunks + + +
+ {chunkList.length ? ( + <> + - - - ) : ( - <> - )} + > + + + + + + + + + {chunkList.map((row: any) => ( + + + + + + ))} + +
NameContentMeta Data
{row.doc_name} + { + + {row.content.length > 10 + ? `${row.content.slice(0, 10)}...` + : row.content} + + } + + { + + {row.meta_info.length > 10 + ? `${row.meta_info.slice(0, 10)}...` + : row.meta_info} + + } +
+ + { + const res = await fetch( + `${fetchBaseURL}/knowledge/${spaceName}/chunk/list`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + document_id: documentId, + page, + page_size + }) + } + ) + const data = await res.json() + if (data.success) { + setChunkList(data.data.data) + setTotal(data.data.total) + setCurrent(data.data.page) + } + }} + hideOnSinglePage + /> + + + ) : ( + <> + )} +
) } diff --git a/datacenter/app/datastores/documents/page.tsx b/datacenter/app/datastores/documents/page.tsx index 02f2126d6..1c1bcf0cc 100644 --- a/datacenter/app/datastores/documents/page.tsx +++ b/datacenter/app/datastores/documents/page.tsx @@ -13,10 +13,15 @@ import { Input, Textarea, Chip, + Switch, + Typography, + Breadcrumbs, + Link, styled } from '@/lib/mui' import moment from 'moment' import { InboxOutlined } from '@ant-design/icons' +import CheckCircleOutlinedIcon from '@mui/icons-material/CheckCircleOutlined'; import type { UploadProps } from 'antd' import { Upload, Pagination, Popover, message } from 'antd' import { fetchBaseURL } from '@/app/datastores/constants' @@ -33,8 +38,8 @@ const Item = styled(Sheet)(({ theme }) => ({ color: theme.vars.palette.text.secondary })) const stepsOfAddingDocument = [ - '1.Choose a Datasource type', - '2.Setup the Datasource' + 'Choose a Datasource type', + 'Setup the Datasource' ] const documentTypeList = [ { @@ -72,6 +77,7 @@ const Documents = () => { const [originFileObj, setOriginFileObj] = useState(null) const [total, setTotal] = useState(0) const [current, setCurrent] = useState(0) + const [synchChecked, setSynchChecked] = useState(true) const props: UploadProps = { name: 'file', multiple: false, @@ -112,20 +118,33 @@ const Documents = () => { }, []) return (
- + + { + router.push('/datastores') + }} + key="Knowledge Space" + underline="hover" + color="neutral" + fontSize="inherit" + > + Knowledge Space + + Documents + - + {documents.length ? ( <> { color: activeStep === index ? '#814DDE' : '' }} > - {item} + {index < activeStep ? : `${index + 1}.`} + {`${item}`} ))} @@ -422,152 +442,224 @@ const Documents = () => { /> )} + + setSynchChecked(event.target.checked) + } + /> + } + > + Synch: + - + + + )} diff --git a/datacenter/app/datastores/page.tsx b/datacenter/app/datastores/page.tsx index bdefb3af1..0bd657e21 100644 --- a/datacenter/app/datastores/page.tsx +++ b/datacenter/app/datastores/page.tsx @@ -3,6 +3,7 @@ import { useRouter } from 'next/navigation' import React, { useState, useEffect } from 'react' import { InboxOutlined } from '@ant-design/icons' +import CheckCircleOutlinedIcon from '@mui/icons-material/CheckCircleOutlined'; import type { UploadProps } from 'antd' import { message, Upload, Popover } from 'antd' import { @@ -16,6 +17,8 @@ import { Input, Textarea, Chip, + Switch, + Typography, styled } from '@/lib/mui' import { fetchBaseURL } from '@/app/datastores/constants' @@ -34,9 +37,9 @@ const Item = styled(Sheet)(({ theme }) => ({ })) const stepsOfAddingSpace = [ - '1.Knowledge Space Config', - '2.Choose a Datasource type', - '3.Setup the Datasource' + 'Knowledge Space Config', + 'Choose a Datasource type', + 'Setup the Datasource' ] const documentTypeList = [ { @@ -71,6 +74,7 @@ const Index = () => { const [textSource, setTextSource] = useState('') const [text, setText] = useState('') const [originFileObj, setOriginFileObj] = useState(null) + const [synchChecked, setSynchChecked] = useState(true) const props: UploadProps = { name: 'file', multiple: false, @@ -138,6 +142,9 @@ const Index = () => { }, '& tbody tr: hover a': { textDecoration: 'underline' + }, + '& tbody tr a': { + color: 'rgb(13, 96, 217)' } }} > @@ -214,9 +221,13 @@ const Index = () => { {stepsOfAddingSpace.map((item: any, index: number) => ( - {item} + {index < activeStep ? : `${index + 1}.`} + {`${item}`} ))} @@ -361,95 +372,164 @@ const Index = () => { /> )} + + setSynchChecked(event.target.checked) + } + /> + } + > + Synch: + - + + + )}