mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-20 18:54:09 +00:00
style: 知识库二期 (#2554)
This commit is contained in:
@@ -32,7 +32,6 @@ const DefaultPermissionList = ({
|
|||||||
onChange,
|
onChange,
|
||||||
isInheritPermission = false,
|
isInheritPermission = false,
|
||||||
hasParent,
|
hasParent,
|
||||||
isDisabled = false,
|
|
||||||
...styles
|
...styles
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { ConfirmModal, openConfirm } = useConfirm({});
|
const { ConfirmModal, openConfirm } = useConfirm({});
|
||||||
@@ -65,7 +64,6 @@ const DefaultPermissionList = ({
|
|||||||
return onRequestChange(per);
|
return onRequestChange(per);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
isDisabled={isDisabled}
|
|
||||||
fontSize={styles?.fontSize}
|
fontSize={styles?.fontSize}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
@@ -31,7 +31,14 @@ const ImportDataset = () => {
|
|||||||
|
|
||||||
const Render = () => {
|
const Render = () => {
|
||||||
return (
|
return (
|
||||||
<Flex flexDirection={'column'} bg={'white'} h={'100%'} px={[2, 9]} py={[2, 5]}>
|
<Flex
|
||||||
|
flexDirection={'column'}
|
||||||
|
bg={'white'}
|
||||||
|
h={'100%'}
|
||||||
|
px={[2, 9]}
|
||||||
|
py={[2, 5]}
|
||||||
|
borderRadius={'md'}
|
||||||
|
>
|
||||||
<DatasetImportContextProvider>
|
<DatasetImportContextProvider>
|
||||||
<ImportDataset />
|
<ImportDataset />
|
||||||
</DatasetImportContextProvider>
|
</DatasetImportContextProvider>
|
||||||
|
@@ -12,7 +12,7 @@ import Avatar from '@fastgpt/web/components/common/Avatar';
|
|||||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
import { useRequest, useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||||
import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants';
|
import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants';
|
||||||
import AIModelSelector from '@/components/Select/AIModelSelector';
|
import AIModelSelector from '@/components/Select/AIModelSelector';
|
||||||
import { postRebuildEmbedding } from '@/web/core/dataset/api';
|
import { postRebuildEmbedding } from '@/web/core/dataset/api';
|
||||||
@@ -77,18 +77,6 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
multiple: false
|
multiple: false
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 点击删除 */
|
|
||||||
const { mutate: onclickDelete, isLoading: isDeleting } = useRequest({
|
|
||||||
mutationFn: () => {
|
|
||||||
return delDatasetById(datasetId);
|
|
||||||
},
|
|
||||||
onSuccess() {
|
|
||||||
router.replace(`/dataset/list`);
|
|
||||||
},
|
|
||||||
successToast: t('common:common.Delete Success'),
|
|
||||||
errorToast: t('common:common.Delete Failed')
|
|
||||||
});
|
|
||||||
|
|
||||||
const { mutate: onSave, isLoading: isSaving } = useRequest({
|
const { mutate: onSave, isLoading: isSaving } = useRequest({
|
||||||
mutationFn: (data: DatasetItemType) => {
|
mutationFn: (data: DatasetItemType) => {
|
||||||
return updateDataset({
|
return updateDataset({
|
||||||
@@ -136,7 +124,13 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
errorToast: t('common:common.Update Failed')
|
errorToast: t('common:common.Update Failed')
|
||||||
});
|
});
|
||||||
|
|
||||||
const totalLoading = isSelecting || isDeleting || isSaving || isRebuilding;
|
const { runAsync: onEditBaseInfo } = useRequest2((data) => updateDataset(data), {
|
||||||
|
manual: true,
|
||||||
|
successToast: t('common:common.Update Success'),
|
||||||
|
errorToast: t('common:common.Update Failed')
|
||||||
|
});
|
||||||
|
|
||||||
|
const totalLoading = isSelecting || isSaving || isRebuilding;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box w={'100%'} h={'100%'} p={6}>
|
<Box w={'100%'} h={'100%'} p={6}>
|
||||||
@@ -185,7 +179,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
|
|
||||||
<Box overflow={'hidden'} h={openBaseConfig ? 'auto' : '24px'}>
|
<Box overflow={'hidden'} h={openBaseConfig ? 'auto' : '24px'}>
|
||||||
<Flex justify={'space-between'} alignItems={'center'} fontSize={'mini'} h={'24px'}>
|
<Flex justify={'space-between'} alignItems={'center'} fontSize={'mini'} h={'24px'}>
|
||||||
<Box fontWeight={'500'} color={'myGray.900'}>
|
<Box fontWeight={'500'} color={'myGray.900'} userSelect={'none'}>
|
||||||
{t('common:common.base_config')}
|
{t('common:common.base_config')}
|
||||||
</Box>
|
</Box>
|
||||||
<MyIcon
|
<MyIcon
|
||||||
@@ -193,16 +187,23 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
_hover={{ color: 'primary.500', cursor: 'pointer' }}
|
_hover={{ color: 'primary.500', cursor: 'pointer' }}
|
||||||
color={'myGray.500'}
|
color={'myGray.500'}
|
||||||
name={openBaseConfig ? 'core/chat/chevronUp' : 'core/chat/chevronDown'}
|
name={openBaseConfig ? 'core/chat/chevronUp' : 'core/chat/chevronDown'}
|
||||||
onClick={() => setOpenBaseConfig(!openBaseConfig)}
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setOpenBaseConfig(!openBaseConfig);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex mt={3} w={'100%'} flexDir={'column'}>
|
<Flex mt={3} w={'100%'} flexDir={'column'} userSelect={'none'}>
|
||||||
<FormLabel fontSize={'mini'}>{t('common:core.dataset.Dataset ID')}</FormLabel>
|
<FormLabel fontSize={'mini'} fontWeight={'500'}>
|
||||||
|
{t('common:core.dataset.Dataset ID')}
|
||||||
|
</FormLabel>
|
||||||
<Box fontSize={'mini'}>{datasetDetail._id}</Box>
|
<Box fontSize={'mini'}>{datasetDetail._id}</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Box mt={5} w={'100%'}>
|
<Box mt={5} w={'100%'}>
|
||||||
<FormLabel fontSize={'mini'}>{t('common:core.ai.model.Vector Model')}</FormLabel>
|
<FormLabel fontSize={'mini'} fontWeight={'500'}>
|
||||||
|
{t('common:core.ai.model.Vector Model')}
|
||||||
|
</FormLabel>
|
||||||
<Box pt={2} flex={[1, '0 0 320px']}>
|
<Box pt={2} flex={[1, '0 0 320px']}>
|
||||||
<AIModelSelector
|
<AIModelSelector
|
||||||
w={'100%'}
|
w={'100%'}
|
||||||
@@ -222,7 +223,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
onchange={(e) => {
|
onchange={(e) => {
|
||||||
const vectorModel = vectorModelList.find((item) => item.model === e);
|
const vectorModel = vectorModelList.find((item) => item.model === e);
|
||||||
if (!vectorModel) return;
|
if (!vectorModel) return;
|
||||||
onOpenConfirmRebuild(() => {
|
return onOpenConfirmRebuild(() => {
|
||||||
setValue('vectorModel', vectorModel);
|
setValue('vectorModel', vectorModel);
|
||||||
onRebuilding(vectorModel);
|
onRebuilding(vectorModel);
|
||||||
})();
|
})();
|
||||||
@@ -232,7 +233,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Flex mt={2} w={'100%'} alignItems={'center'}>
|
<Flex mt={2} w={'100%'} alignItems={'center'}>
|
||||||
<FormLabel flex={['0 0 90px', '0 0 160px']} fontSize={'mini'} w={0}>
|
<FormLabel flex={['0 0 90px', '0 0 160px']} fontSize={'mini'} w={0} fontWeight={'500'}>
|
||||||
{t('common:core.Max Token')}
|
{t('common:core.Max Token')}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<Box flex={[1, '0 0 320px']} fontSize={'mini'}>
|
<Box flex={[1, '0 0 320px']} fontSize={'mini'}>
|
||||||
@@ -241,7 +242,9 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Box pt={5}>
|
<Box pt={5}>
|
||||||
<FormLabel fontSize={'mini'}>{t('common:core.ai.model.Dataset Agent Model')}</FormLabel>
|
<FormLabel fontSize={'mini'} fontWeight={'500'}>
|
||||||
|
{t('common:core.ai.model.Dataset Agent Model')}
|
||||||
|
</FormLabel>
|
||||||
<Box pt={2}>
|
<Box pt={2}>
|
||||||
<AIModelSelector
|
<AIModelSelector
|
||||||
w={'100%'}
|
w={'100%'}
|
||||||
@@ -255,7 +258,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
const agentModel = datasetModelList.find((item) => item.model === e);
|
const agentModel = datasetModelList.find((item) => item.model === e);
|
||||||
if (!agentModel) return;
|
if (!agentModel) return;
|
||||||
setValue('agentModel', agentModel);
|
setValue('agentModel', agentModel);
|
||||||
handleSubmit((data) => onSave({ ...data, agentModel: agentModel }))();
|
return handleSubmit((data) => onSave({ ...data, agentModel: agentModel }))();
|
||||||
}}
|
}}
|
||||||
isDisabled={totalLoading}
|
isDisabled={totalLoading}
|
||||||
/>
|
/>
|
||||||
@@ -267,7 +270,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
{datasetDetail.type === DatasetTypeEnum.externalFile && (
|
{datasetDetail.type === DatasetTypeEnum.externalFile && (
|
||||||
<>
|
<>
|
||||||
<Box w={'100%'} alignItems={'center'} pt={4}>
|
<Box w={'100%'} alignItems={'center'} pt={4}>
|
||||||
<FormLabel display={'flex'} pb={2} fontSize={'mini'}>
|
<FormLabel display={'flex'} pb={2} fontSize={'mini'} fontWeight={'500'}>
|
||||||
<Box>{t('dataset:external_read_url')}</Box>
|
<Box>{t('dataset:external_read_url')}</Box>
|
||||||
<QuestionTip label={t('dataset:external_read_url_tip')} />
|
<QuestionTip label={t('dataset:external_read_url_tip')} />
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
@@ -288,7 +291,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
<MyDivider my={4} h={'2px'} maxW={'500px'} />
|
<MyDivider my={4} h={'2px'} maxW={'500px'} />
|
||||||
<Box overflow={'hidden'} h={openPermissionConfig ? 'auto' : '24px'}>
|
<Box overflow={'hidden'} h={openPermissionConfig ? 'auto' : '24px'}>
|
||||||
<Flex justify={'space-between'} alignItems={'center'} fontSize={'mini'} h={'24px'}>
|
<Flex justify={'space-between'} alignItems={'center'} fontSize={'mini'} h={'24px'}>
|
||||||
<Box fontWeight={'500'} color={'myGray.900'}>
|
<Box fontWeight={'500'} color={'myGray.900'} userSelect={'none'}>
|
||||||
{t('common:permission.Permission config')}
|
{t('common:permission.Permission config')}
|
||||||
</Box>
|
</Box>
|
||||||
<MyIcon
|
<MyIcon
|
||||||
@@ -301,7 +304,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Box mt={3}>
|
<Box mt={3}>
|
||||||
<FormLabel fontSize={'mini'} pb={3}>
|
<FormLabel fontWeight={'500'} fontSize={'mini'} pb={3} userSelect={'none'}>
|
||||||
{t('common:permission.Default permission')}
|
{t('common:permission.Default permission')}
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<DefaultPermissionList
|
<DefaultPermissionList
|
||||||
@@ -311,12 +314,12 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
isDisabled={totalLoading}
|
isDisabled={totalLoading}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setValue('defaultPermission', v);
|
setValue('defaultPermission', v);
|
||||||
handleSubmit((data) => onSave({ ...data, defaultPermission: v }))();
|
return handleSubmit((data) => onSave({ ...data, defaultPermission: v }))();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box mt={4}>
|
<Box py={4}>
|
||||||
<MemberManager
|
<MemberManager
|
||||||
managePer={{
|
managePer={{
|
||||||
permission: datasetDetail.permission,
|
permission: datasetDetail.permission,
|
||||||
@@ -350,7 +353,7 @@ const Info = ({ datasetId }: { datasetId: string }) => {
|
|||||||
setEditedDataset(undefined);
|
setEditedDataset(undefined);
|
||||||
}}
|
}}
|
||||||
onEdit={async (data) => {
|
onEdit={async (data) => {
|
||||||
await updateDataset({
|
await onEditBaseInfo({
|
||||||
id: editedDataset.id,
|
id: editedDataset.id,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
intro: data.intro,
|
intro: data.intro,
|
||||||
|
@@ -105,7 +105,7 @@ const MetaDataCard = ({ datasetId }: { datasetId: string }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
{metadataList.map((item, i) => (
|
{metadataList.map((item, i) => (
|
||||||
<Flex key={i} alignItems={'center'} mb={5} wordBreak={'break-all'} fontSize={'sm'}>
|
<Flex key={i} alignItems={'center'} mb={5} wordBreak={'break-all'} fontSize={'sm'}>
|
||||||
<Box color={'myGray.500'} flex={'0 0 100px'}>
|
<Box color={'myGray.500'} flex={'0 0 70px'}>
|
||||||
{item.label}
|
{item.label}
|
||||||
</Box>
|
</Box>
|
||||||
<Box>{item.value}</Box>
|
<Box>{item.value}</Box>
|
||||||
|
@@ -123,8 +123,7 @@ const NavBar = ({ currentTab }: { currentTab: TabEnum }) => {
|
|||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
border: 'none',
|
border: 'none',
|
||||||
_hover: {
|
_hover: {
|
||||||
bg: 'myGray.05',
|
bg: 'myGray.05'
|
||||||
color: 'blue.700'
|
|
||||||
},
|
},
|
||||||
borderRadius: '6px'
|
borderRadius: '6px'
|
||||||
}}
|
}}
|
||||||
@@ -148,7 +147,7 @@ const NavBar = ({ currentTab }: { currentTab: TabEnum }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MyIcon name={'common/monitor'} w={'18px'} h={'18px'} color={'myGray.500'} />
|
<MyIcon name={'common/monitor'} w={'18px'} h={'18px'} color={'myGray.500'} />
|
||||||
<Box color={'myGray.600'} ml={1.5} fontWeight={500}>
|
<Box color={'myGray.600'} ml={1.5} fontWeight={500} userSelect={'none'}>
|
||||||
{t('common:core.dataset.training.tag')}
|
{t('common:core.dataset.training.tag')}
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
Reference in New Issue
Block a user