diff --git a/datacenter/app/datastores/documents/chunklist/page.tsx b/datacenter/app/datastores/documents/chunklist/page.tsx index 42c9da062..ca17030e9 100644 --- a/datacenter/app/datastores/documents/chunklist/page.tsx +++ b/datacenter/app/datastores/documents/chunklist/page.tsx @@ -32,7 +32,7 @@ const ChunkList = () => { }, []) return (
- +
diff --git a/datacenter/app/datastores/documents/page.tsx b/datacenter/app/datastores/documents/page.tsx index 23ee57bf3..7ce660f81 100644 --- a/datacenter/app/datastores/documents/page.tsx +++ b/datacenter/app/datastores/documents/page.tsx @@ -10,11 +10,26 @@ import { Box, Stack, Input, + Textarea, + Chip, styled } from '@/lib/mui' import moment from 'moment' -import { message } from 'antd' +import { InboxOutlined } from '@ant-design/icons' +import type { UploadProps } from 'antd' +import { Upload, message } from 'antd' +const { Dragger } = Upload +const Item = styled(Sheet)(({ theme }) => ({ + width: '50%', + backgroundColor: + theme.palette.mode === 'dark' ? theme.palette.background.level1 : '#fff', + ...theme.typography.body2, + padding: theme.spacing(1), + textAlign: 'center', + borderRadius: 4, + color: theme.vars.palette.text.secondary +})) const stepsOfAddingDocument = [ 'Choose a Datasource type', 'Setup the Datasource' @@ -36,16 +51,6 @@ const documentTypeList = [ subTitle: 'It can be: PDF, CSV, JSON, Text, PowerPoint, Word, Excel' } ] -const Item = styled(Sheet)(({ theme }) => ({ - width: '50%', - backgroundColor: - theme.palette.mode === 'dark' ? theme.palette.background.level1 : '#fff', - ...theme.typography.body2, - padding: theme.spacing(1), - textAlign: 'center', - borderRadius: 4, - color: theme.vars.palette.text.secondary -})) const Documents = () => { const router = useRouter() @@ -53,9 +58,27 @@ const Documents = () => { const [isAddDocumentModalShow, setIsAddDocumentModalShow] = useState(false) const [activeStep, setActiveStep] = useState(0) + const [documentType, setDocumentType] = useState('') const [documents, setDocuments] = useState([]) const [webPageUrl, setWebPageUrl] = useState('') - const [documentName, setDocumentName] = useState('') + const [documentName, setDocumentName] = useState('') + const [textSource, setTextSource] = useState(''); + const [text, setText] = useState(''); + const [originFileObj, setOriginFileObj] = useState(null) + const props: UploadProps = { + name: 'file', + multiple: false, + onChange(info) { + console.log(info) + if (info.fileList.length === 0) { + setOriginFileObj(null) + setDocumentName('') + return + } + setOriginFileObj(info.file.originFileObj) + setDocumentName(info.file.originFileObj?.name) + } + } useEffect(() => { async function fetchDocuments() { const res = await fetch( @@ -90,7 +113,7 @@ const Documents = () => { + Add Datasource -
Name
+
@@ -108,12 +131,30 @@ const Documents = () => { - +
Name{row.doc_type} {row.chunk_size} {moment(row.last_sync).format('YYYY-MM-DD HH:MM:SS')}{row.status} + + {row.status} + + { <>