mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 01:40:51 +00:00
4.8.10 test (#2470)
* i18n * perf: invoice type * fix: helper line change error * perf: base64 image * perf: app list ui * perf: upload max size check * perf: init system plugin * perf: dataset list ui * perf: http node ui * perf: ui * perf: invoice tip * fix: ts * perf: invoice table * perf: null check
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { Box, Flex, Button, ModalFooter, ModalBody, Input } from '@chakra-ui/react';
|
||||
import { Box, Flex, Button, ModalFooter, ModalBody, Input, HStack } from '@chakra-ui/react';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { compressImgFileAndUpload } from '@/web/common/file/controller';
|
||||
@@ -19,6 +19,7 @@ import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants'
|
||||
import AIModelSelector from '@/components/Select/AIModelSelector';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||
|
||||
export type CreateDatasetType =
|
||||
| DatasetTypeEnum.dataset
|
||||
@@ -163,19 +164,18 @@ const CreateModal = ({
|
||||
justify={'space-between'}
|
||||
flexDir={['column', 'row']}
|
||||
>
|
||||
<Flex
|
||||
<HStack
|
||||
spacing={1}
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 100px']}
|
||||
flex={['', '0 0 110px']}
|
||||
fontSize={'sm'}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
pb={['12px', '0']}
|
||||
>
|
||||
{t('common:core.ai.model.Vector Model')}
|
||||
<MyTooltip label={t('common:core.dataset.embedding model tip')}>
|
||||
<MyIcon w={'16px'} h={'16px'} color={'myGray.500'} ml={'4px'} name="common/help" />
|
||||
</MyTooltip>
|
||||
</Flex>
|
||||
<Box>{t('common:core.ai.model.Vector Model')}</Box>
|
||||
<QuestionTip label={t('common:core.dataset.embedding model tip')} />
|
||||
</HStack>
|
||||
<Box w={['100%', '300px']}>
|
||||
<AIModelSelector
|
||||
w={['100%', '300px']}
|
||||
@@ -198,15 +198,17 @@ const CreateModal = ({
|
||||
justify={'space-between'}
|
||||
flexDir={['column', 'row']}
|
||||
>
|
||||
<Box
|
||||
flex={['', '0 0 100px']}
|
||||
<HStack
|
||||
spacing={1}
|
||||
flex={['', '0 0 110px']}
|
||||
fontSize={'sm'}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
pb={['12px', '0']}
|
||||
>
|
||||
{t('common:core.ai.model.Dataset Agent Model')}
|
||||
</Box>
|
||||
<Box>{t('common:core.ai.model.Dataset Agent Model')}</Box>
|
||||
<QuestionTip label={t('dataset:file_model_function_tip')} />
|
||||
</HStack>
|
||||
<Box w={['100%', '300px']}>
|
||||
<AIModelSelector
|
||||
w={['100%', '300px']}
|
||||
@@ -224,7 +226,7 @@ const CreateModal = ({
|
||||
)}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter pt={'0px'} pb={'24px'}>
|
||||
<ModalFooter px={'36px'}>
|
||||
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
|
||||
{t('common:common.Close')}
|
||||
</Button>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import React, { useMemo, useRef, useState } from 'react';
|
||||
import { resumeInheritPer } from '@/web/core/dataset/api';
|
||||
import { useDatasetStore } from '@/web/core/dataset/store/dataset';
|
||||
import { Box, Flex, Grid, HStack } from '@chakra-ui/react';
|
||||
import { DatasetTypeEnum, DatasetTypeMap } from '@fastgpt/global/core/dataset/constants';
|
||||
import MyMenu from '@fastgpt/web/components/common/MyMenu';
|
||||
@@ -39,6 +38,8 @@ import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import SideTag from './SideTag';
|
||||
|
||||
const EditResourceModal = dynamic(() => import('@/components/common/Modal/EditResourceModal'));
|
||||
|
||||
function List() {
|
||||
const { setLoading } = useSystemStore();
|
||||
const { toast } = useToast();
|
||||
@@ -76,7 +77,7 @@ function List() {
|
||||
}
|
||||
});
|
||||
|
||||
const { data: members = [], loading: isLoadMembers } = useRequest2(loadAndGetTeamMembers, {
|
||||
const { data: members = [] } = useRequest2(loadAndGetTeamMembers, {
|
||||
manual: false
|
||||
});
|
||||
|
||||
@@ -111,8 +112,6 @@ function List() {
|
||||
errorToast: t('common:dataset.Export Dataset Limit Error')
|
||||
});
|
||||
|
||||
const EditResourceModal = dynamic(() => import('@/components/common/Modal/EditResourceModal'));
|
||||
|
||||
const DeleteTipsMap = useRef({
|
||||
[DatasetTypeEnum.folder]: t('common:dataset.deleteFolderTips'),
|
||||
[DatasetTypeEnum.dataset]: t('common:core.dataset.Delete Confirm'),
|
||||
@@ -161,238 +160,235 @@ function List() {
|
||||
gridGap={5}
|
||||
alignItems={'stretch'}
|
||||
>
|
||||
{!isLoadMembers &&
|
||||
formatDatasets.map((dataset, index) => {
|
||||
const owner = members.find((v) => v.tmbId === dataset.tmbId);
|
||||
return (
|
||||
<MyTooltip
|
||||
key={dataset._id}
|
||||
label={
|
||||
<Flex flexDirection={'column'} alignItems={'center'}>
|
||||
<Box fontSize={'xs'} color={'myGray.500'}>
|
||||
{dataset.type === DatasetTypeEnum.folder
|
||||
? t('common.folder.Open folder')
|
||||
: t('common.folder.open_dataset')}
|
||||
</Box>
|
||||
</Flex>
|
||||
}
|
||||
{formatDatasets.map((dataset, index) => {
|
||||
const owner = members.find((v) => v.tmbId === dataset.tmbId);
|
||||
return (
|
||||
<MyTooltip
|
||||
key={dataset._id}
|
||||
label={
|
||||
<Flex flexDirection={'column'} alignItems={'center'}>
|
||||
<Box fontSize={'xs'} color={'myGray.500'}>
|
||||
{dataset.type === DatasetTypeEnum.folder
|
||||
? t('common:common.folder.Open folder')
|
||||
: t('common:common.folder.open_dataset')}
|
||||
</Box>
|
||||
</Flex>
|
||||
}
|
||||
>
|
||||
<MyBox
|
||||
isLoading={loadingDatasetId === dataset._id}
|
||||
display={'flex'}
|
||||
flexDirection={'column'}
|
||||
lineHeight={1.5}
|
||||
h="100%"
|
||||
pt={5}
|
||||
pb={3}
|
||||
px={5}
|
||||
cursor={'pointer'}
|
||||
borderWidth={1.5}
|
||||
border={'base'}
|
||||
boxShadow={'2'}
|
||||
bg={'white'}
|
||||
borderRadius={'lg'}
|
||||
position={'relative'}
|
||||
minH={'150px'}
|
||||
{...getBoxProps({
|
||||
dataId: dataset._id,
|
||||
isFolder: dataset.type === DatasetTypeEnum.folder
|
||||
})}
|
||||
_hover={{
|
||||
borderColor: 'primary.300',
|
||||
boxShadow: '1.5',
|
||||
'& .delete': {
|
||||
display: 'block'
|
||||
},
|
||||
'& .more': {
|
||||
display: 'flex'
|
||||
},
|
||||
'& .time': {
|
||||
display: ['flex', 'none']
|
||||
}
|
||||
}}
|
||||
onClick={() => {
|
||||
if (dataset.type === DatasetTypeEnum.folder) {
|
||||
router.push({
|
||||
pathname: '/dataset/list',
|
||||
query: {
|
||||
parentId: dataset._id
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
pathname: '/dataset/detail',
|
||||
query: {
|
||||
datasetId: dataset._id
|
||||
}
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<MyBox
|
||||
isLoading={loadingDatasetId === dataset._id}
|
||||
display={'flex'}
|
||||
flexDirection={'column'}
|
||||
lineHeight={1.5}
|
||||
h="100%"
|
||||
pt={5}
|
||||
pb={3}
|
||||
px={5}
|
||||
cursor={'pointer'}
|
||||
borderWidth={1.5}
|
||||
border={'base'}
|
||||
boxShadow={'2'}
|
||||
bg={'white'}
|
||||
borderRadius={'lg'}
|
||||
position={'relative'}
|
||||
minH={'150px'}
|
||||
{...getBoxProps({
|
||||
dataId: dataset._id,
|
||||
isFolder: dataset.type === DatasetTypeEnum.folder
|
||||
})}
|
||||
_hover={{
|
||||
borderColor: 'primary.300',
|
||||
boxShadow: '1.5',
|
||||
'& .delete': {
|
||||
display: 'block'
|
||||
},
|
||||
'& .more': {
|
||||
display: 'flex'
|
||||
},
|
||||
'& .time': {
|
||||
display: ['flex', 'none']
|
||||
}
|
||||
}}
|
||||
onClick={() => {
|
||||
if (dataset.type === DatasetTypeEnum.folder) {
|
||||
router.push({
|
||||
pathname: '/dataset/list',
|
||||
query: {
|
||||
parentId: dataset._id
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
pathname: '/dataset/detail',
|
||||
query: {
|
||||
datasetId: dataset._id
|
||||
}
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<HStack>
|
||||
<Avatar src={dataset.avatar} borderRadius={6} w={'28px'} />
|
||||
<Box flex={'1 0 0'} className="textEllipsis3">
|
||||
{dataset.name}
|
||||
</Box>
|
||||
|
||||
<Box mr={'-1.25rem'}>
|
||||
{dataset.type !== DatasetTypeEnum.folder && (
|
||||
<SideTag
|
||||
type={dataset.type}
|
||||
py={0.5}
|
||||
px={2}
|
||||
borderLeftRadius={'sm'}
|
||||
borderRightRadius={0}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
</HStack>
|
||||
|
||||
<Box
|
||||
flex={1}
|
||||
className={'textEllipsis3'}
|
||||
py={3}
|
||||
wordBreak={'break-all'}
|
||||
fontSize={'xs'}
|
||||
color={'myGray.500'}
|
||||
>
|
||||
{dataset.intro ||
|
||||
(dataset.type === DatasetTypeEnum.folder
|
||||
? t('common:core.dataset.Folder placeholder')
|
||||
: t('common:core.dataset.Intro Placeholder'))}
|
||||
<HStack>
|
||||
<Avatar src={dataset.avatar} borderRadius={6} w={'28px'} />
|
||||
<Box flex={'1 0 0'} className="textEllipsis3">
|
||||
{dataset.name}
|
||||
</Box>
|
||||
|
||||
<Flex
|
||||
h={'24px'}
|
||||
alignItems={'center'}
|
||||
justifyContent={'space-between'}
|
||||
fontSize={'12px'}
|
||||
fontWeight={500}
|
||||
color={'myGray.500'}
|
||||
>
|
||||
<HStack spacing={3.5}>
|
||||
{owner && (
|
||||
<HStack spacing={1}>
|
||||
<Avatar src={owner.avatar} w={'0.875rem'} borderRadius={'50%'} />
|
||||
<Box maxW={'150px'} className="textEllipsis">
|
||||
{owner.memberName}
|
||||
</Box>
|
||||
</HStack>
|
||||
)}
|
||||
<PermissionIconText
|
||||
iconColor="myGray.400"
|
||||
defaultPermission={dataset.defaultPermission}
|
||||
color={'myGray.500'}
|
||||
<Box mr={'-1.25rem'}>
|
||||
{dataset.type !== DatasetTypeEnum.folder && (
|
||||
<SideTag
|
||||
type={dataset.type}
|
||||
py={0.5}
|
||||
px={2}
|
||||
borderLeftRadius={'sm'}
|
||||
borderRightRadius={0}
|
||||
/>
|
||||
</HStack>
|
||||
)}
|
||||
</Box>
|
||||
</HStack>
|
||||
|
||||
<HStack>
|
||||
{isPc && (
|
||||
<HStack spacing={1} className="time">
|
||||
<MyIcon name={'history'} w={'0.85rem'} color={'myGray.400'} />
|
||||
<Box color={'myGray.500'}>
|
||||
{formatTimeToChatTime(dataset.updateTime)}
|
||||
</Box>
|
||||
</HStack>
|
||||
)}
|
||||
{dataset.permission.hasWritePer && (
|
||||
<Box
|
||||
className="more"
|
||||
display={['', 'none']}
|
||||
borderRadius={'md'}
|
||||
_hover={{
|
||||
'& .icon': {
|
||||
bg: 'myGray.100'
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<MyMenu
|
||||
Button={
|
||||
<Box w={'22px'} h={'22px'}>
|
||||
<MyIcon
|
||||
className="icon"
|
||||
name={'more'}
|
||||
h={'16px'}
|
||||
w={'16px'}
|
||||
px={1}
|
||||
py={1}
|
||||
borderRadius={'md'}
|
||||
cursor={'pointer'}
|
||||
/>
|
||||
</Box>
|
||||
}
|
||||
menuList={[
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'edit',
|
||||
label: commonT('dataset.Edit Info'),
|
||||
onClick: () =>
|
||||
setEditedDataset({
|
||||
id: dataset._id,
|
||||
name: dataset.name,
|
||||
intro: dataset.intro,
|
||||
avatar: dataset.avatar
|
||||
})
|
||||
},
|
||||
{
|
||||
icon: 'common/file/move',
|
||||
label: t('common:Move'),
|
||||
onClick: () => setMoveDatasetId(dataset._id)
|
||||
},
|
||||
...(dataset.permission.hasManagePer
|
||||
? [
|
||||
{
|
||||
icon: 'support/team/key',
|
||||
label: t('common:permission.Permission'),
|
||||
onClick: () => setEditPerDatasetIndex(index)
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]
|
||||
},
|
||||
...(dataset.type != DatasetTypeEnum.folder
|
||||
? [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'export',
|
||||
label: t('common:Export'),
|
||||
onClick: () => {
|
||||
exportDataset(dataset);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(dataset.permission.hasManagePer
|
||||
? [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'delete',
|
||||
label: t('common:common.Delete'),
|
||||
type: 'danger' as 'danger',
|
||||
onClick: () => onClickDeleteDataset(dataset._id)
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]}
|
||||
/>
|
||||
<Box
|
||||
flex={1}
|
||||
className={'textEllipsis3'}
|
||||
py={3}
|
||||
wordBreak={'break-all'}
|
||||
fontSize={'xs'}
|
||||
color={'myGray.500'}
|
||||
>
|
||||
{dataset.intro ||
|
||||
(dataset.type === DatasetTypeEnum.folder
|
||||
? t('common:core.dataset.Folder placeholder')
|
||||
: t('common:core.dataset.Intro Placeholder'))}
|
||||
</Box>
|
||||
|
||||
<Flex
|
||||
h={'24px'}
|
||||
alignItems={'center'}
|
||||
justifyContent={'space-between'}
|
||||
fontSize={'12px'}
|
||||
fontWeight={500}
|
||||
color={'myGray.500'}
|
||||
>
|
||||
<HStack spacing={3.5}>
|
||||
{owner && (
|
||||
<HStack spacing={1}>
|
||||
<Avatar src={owner.avatar} w={'0.875rem'} borderRadius={'50%'} />
|
||||
<Box maxW={'150px'} className="textEllipsis">
|
||||
{owner.memberName}
|
||||
</Box>
|
||||
)}
|
||||
</HStack>
|
||||
</Flex>
|
||||
</MyBox>
|
||||
</MyTooltip>
|
||||
);
|
||||
})}
|
||||
</HStack>
|
||||
)}
|
||||
<PermissionIconText
|
||||
iconColor="myGray.400"
|
||||
defaultPermission={dataset.defaultPermission}
|
||||
color={'myGray.500'}
|
||||
/>
|
||||
</HStack>
|
||||
|
||||
<HStack>
|
||||
{isPc && (
|
||||
<HStack spacing={1} className="time">
|
||||
<MyIcon name={'history'} w={'0.85rem'} color={'myGray.400'} />
|
||||
<Box color={'myGray.500'}>{formatTimeToChatTime(dataset.updateTime)}</Box>
|
||||
</HStack>
|
||||
)}
|
||||
{dataset.permission.hasWritePer && (
|
||||
<Box
|
||||
className="more"
|
||||
display={['', 'none']}
|
||||
borderRadius={'md'}
|
||||
_hover={{
|
||||
'& .icon': {
|
||||
bg: 'myGray.100'
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<MyMenu
|
||||
Button={
|
||||
<Box w={'22px'} h={'22px'}>
|
||||
<MyIcon
|
||||
className="icon"
|
||||
name={'more'}
|
||||
h={'16px'}
|
||||
w={'16px'}
|
||||
px={1}
|
||||
py={1}
|
||||
borderRadius={'md'}
|
||||
cursor={'pointer'}
|
||||
/>
|
||||
</Box>
|
||||
}
|
||||
menuList={[
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'edit',
|
||||
label: commonT('dataset.Edit Info'),
|
||||
onClick: () =>
|
||||
setEditedDataset({
|
||||
id: dataset._id,
|
||||
name: dataset.name,
|
||||
intro: dataset.intro,
|
||||
avatar: dataset.avatar
|
||||
})
|
||||
},
|
||||
{
|
||||
icon: 'common/file/move',
|
||||
label: t('common:Move'),
|
||||
onClick: () => setMoveDatasetId(dataset._id)
|
||||
},
|
||||
...(dataset.permission.hasManagePer
|
||||
? [
|
||||
{
|
||||
icon: 'support/team/key',
|
||||
label: t('common:permission.Permission'),
|
||||
onClick: () => setEditPerDatasetIndex(index)
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]
|
||||
},
|
||||
...(dataset.type != DatasetTypeEnum.folder
|
||||
? [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'export',
|
||||
label: t('common:Export'),
|
||||
onClick: () => {
|
||||
exportDataset(dataset);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(dataset.permission.hasManagePer
|
||||
? [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
icon: 'delete',
|
||||
label: t('common:common.Delete'),
|
||||
type: 'danger' as 'danger',
|
||||
onClick: () => onClickDeleteDataset(dataset._id)
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
</HStack>
|
||||
</Flex>
|
||||
</MyBox>
|
||||
</MyTooltip>
|
||||
);
|
||||
})}
|
||||
</Grid>
|
||||
)}
|
||||
{myDatasets.length === 0 && (
|
||||
@@ -415,7 +411,6 @@ function List() {
|
||||
intro: data.intro,
|
||||
avatar: data.avatar
|
||||
});
|
||||
setEditedDataset(undefined);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
@@ -11,18 +11,15 @@ const SideTag = ({ type, ...props }: { type: `${DatasetTypeEnum}` } & FlexProps)
|
||||
return {
|
||||
[DatasetTypeEnum.dataset]: {
|
||||
icon: 'core/dataset/commonDatasetOutline',
|
||||
label: t('dataset:common_dataset'),
|
||||
collectionLabel: 'common.File'
|
||||
label: t('dataset:common_dataset')
|
||||
},
|
||||
[DatasetTypeEnum.websiteDataset]: {
|
||||
icon: 'core/dataset/websiteDatasetOutline',
|
||||
label: t('dataset:website_dataset'),
|
||||
collectionLabel: 'common.Website'
|
||||
label: t('dataset:website_dataset')
|
||||
},
|
||||
[DatasetTypeEnum.externalFile]: {
|
||||
icon: 'core/dataset/externalDatasetOutline',
|
||||
label: t('dataset:external_file'),
|
||||
collectionLabel: 'common.File'
|
||||
label: t('dataset:external_file')
|
||||
}
|
||||
};
|
||||
}, [t]);
|
||||
@@ -31,8 +28,6 @@ const SideTag = ({ type, ...props }: { type: `${DatasetTypeEnum}` } & FlexProps)
|
||||
return (
|
||||
<Flex
|
||||
bg={'myGray.100'}
|
||||
borderWidth={'1px'}
|
||||
borderColor={'myGray.200'}
|
||||
py={'3px'}
|
||||
pl={'8px'}
|
||||
pr={'12px'}
|
||||
@@ -43,7 +38,6 @@ const SideTag = ({ type, ...props }: { type: `${DatasetTypeEnum}` } & FlexProps)
|
||||
>
|
||||
<MyIcon name={item.icon as any} w={'0.8rem'} color={'myGray.400'} />
|
||||
<Box fontSize={'mini'} ml={1}>
|
||||
{/* @ts-ignore */}
|
||||
{item.label}
|
||||
</Box>
|
||||
</Flex>
|
||||
|
Reference in New Issue
Block a user