feat: set owner and desc

This commit is contained in:
shiweisong.ssw 2023-07-05 14:14:58 +08:00
parent e136e88383
commit 07e6fbe677
2 changed files with 30 additions and 6 deletions

View File

@ -321,7 +321,7 @@ const Documents = () => {
key={item} key={item}
sx={{ sx={{
fontWeight: activeStep === index ? 'bold' : '', fontWeight: activeStep === index ? 'bold' : '',
color: activeStep === index ? '#814DDE' : '' color: activeStep === index ? '#2AA3FF' : ''
}} }}
> >
{index < activeStep ? <CheckCircleOutlinedIcon /> : `${index + 1}.`} {index < activeStep ? <CheckCircleOutlinedIcon /> : `${index + 1}.`}

View File

@ -70,6 +70,8 @@ const Index = () => {
const [isAddKnowledgeSpaceModalShow, setIsAddKnowledgeSpaceModalShow] = const [isAddKnowledgeSpaceModalShow, setIsAddKnowledgeSpaceModalShow] =
useState<boolean>(false) useState<boolean>(false)
const [knowledgeSpaceName, setKnowledgeSpaceName] = useState<string>('') const [knowledgeSpaceName, setKnowledgeSpaceName] = useState<string>('')
const [owner, setOwner] = useState<string>('')
const [description, setDescription] = useState<string>('')
const [webPageUrl, setWebPageUrl] = useState<string>('') const [webPageUrl, setWebPageUrl] = useState<string>('')
const [documentName, setDocumentName] = useState<any>('') const [documentName, setDocumentName] = useState<any>('')
const [textSource, setTextSource] = useState<string>('') const [textSource, setTextSource] = useState<string>('')
@ -157,11 +159,12 @@ const Index = () => {
width: '32px', width: '32px',
height: '32px', height: '32px',
lineHeight: '28px', lineHeight: '28px',
border: '1px solid gray', border: '1px solid #2AA3FF',
textAlign: 'center', textAlign: 'center',
borderRadius: '5px', borderRadius: '5px',
marginRight: '5px', marginRight: '5px',
fontWeight: '300' fontWeight: '300',
color: '#2AA3FF'
}} }}
>+</Box> >+</Box>
<Box <Box
@ -277,7 +280,7 @@ const Index = () => {
key={item} key={item}
sx={{ sx={{
fontWeight: activeStep === index ? 'bold' : '', fontWeight: activeStep === index ? 'bold' : '',
color: activeStep === index ? '#814DDE' : '' color: activeStep === index ? '#2AA3FF' : ''
}} }}
> >
{index < activeStep ? ( {index < activeStep ? (
@ -297,6 +300,19 @@ const Index = () => {
<Input <Input
placeholder="Please input the name" placeholder="Please input the name"
onChange={(e: any) => setKnowledgeSpaceName(e.target.value)} onChange={(e: any) => setKnowledgeSpaceName(e.target.value)}
sx={{ marginBottom: '20px' }}
/>
Owner:
<Input
placeholder="Please input the owner"
onChange={(e: any) => setOwner(e.target.value)}
sx={{ marginBottom: '20px' }}
/>
Description:
<Input
placeholder="Please input the description"
onChange={(e: any) => setDescription(e.target.value)}
sx={{ marginBottom: '20px' }}
/> />
</Box> </Box>
<Button <Button
@ -306,13 +322,21 @@ const Index = () => {
message.error('please input the name') message.error('please input the name')
return return
} }
if (owner === '') {
message.error('please input the owner')
return
}
if (description === '') {
message.error('please input the description')
return
}
const data = await sendSpacePostRequest( const data = await sendSpacePostRequest(
`/knowledge/space/add`, `/knowledge/space/add`,
{ {
name: knowledgeSpaceName, name: knowledgeSpaceName,
vector_type: 'Chroma', vector_type: 'Chroma',
owner: 'keting', owner,
desc: 'test1' desc: description
} }
) )
if (data.success) { if (data.success) {