diff --git a/datacenter/app/datastores/page.tsx b/datacenter/app/datastores/page.tsx index 61ef89b9c..fec9eae40 100644 --- a/datacenter/app/datastores/page.tsx +++ b/datacenter/app/datastores/page.tsx @@ -1,8 +1,7 @@ 'use client' import { useRouter } from 'next/navigation' -import type { ProFormInstance } from '@ant-design/pro-components' -import React, { useState, useRef, useEffect } from 'react' +import React, { useState, useEffect } from 'react' import { message } from 'antd' import { Modal, @@ -31,16 +30,33 @@ const stepsOfAddingSpace = [ 'Choose a Datasource type', 'Setup the Datasource' ] +const documentTypeList = [ + { + type: 'text', + title: 'Text', + subTitle: 'Paste some text' + }, + { + type: 'webPage', + title: 'Web Page', + subTitle: 'Crawl text from a web page' + }, + { + type: 'file', + title: 'File', + subTitle: 'It can be: PDF, CSV, JSON, Text, PowerPoint, Word, Excel' + } +] const Index = () => { const router = useRouter() - const formRef = useRef() const [activeStep, setActiveStep] = useState(0) const [knowledgeSpaceList, setKnowledgeSpaceList] = useState([]) const [isAddKnowledgeSpaceModalShow, setIsAddKnowledgeSpaceModalShow] = useState(false) const [knowledgeSpaceName, setKnowledgeSpaceName] = useState('') const [webPageUrl, setWebPageUrl] = useState('') + const [documentName, setDocumentName] = useState('') useEffect(() => { async function fetchData() { const res = await fetch('http://localhost:8000/knowledge/space/list', { @@ -191,14 +207,42 @@ const Index = () => { ) : activeStep === 1 ? ( <> - + {documentTypeList.map((item: any) => ( + { + if (item.type === 'webPage') { + setActiveStep(2); + } + }} + > + {item.title} + {item.subTitle} + + ))} ) : ( <> + Name: + setDocumentName(e.target.value)} + sx={{ marginBottom: '20px'}} + /> Web Page URL: {