Feat: pptx and xlsx loader (#1118)

* perf: plan tip

* perf: upload size controller

* feat: add image ttl index

* feat: new upload file ux

* remove file

* feat: support read pptx

* feat: support xlsx

* fix: rerank docker flie
This commit is contained in:
Archer
2024-04-01 19:01:26 +08:00
committed by GitHub
parent f9d266a6af
commit 21288d1736
90 changed files with 2707 additions and 1678 deletions

View File

@@ -101,6 +101,7 @@ export const iconPaths = {
'core/dataset/mixedRecall': () => import('./icons/core/dataset/mixedRecall.svg'),
'core/dataset/modeEmbedding': () => import('./icons/core/dataset/modeEmbedding.svg'),
'core/dataset/rerank': () => import('./icons/core/dataset/rerank.svg'),
'core/dataset/splitLight': () => import('./icons/core/dataset/splitLight.svg'),
'core/dataset/tableCollection': () => import('./icons/core/dataset/tableCollection.svg'),
'core/dataset/websiteDataset': () => import('./icons/core/dataset/websiteDataset.svg'),
'core/modules/basicNode': () => import('./icons/core/modules/basicNode.svg'),

View File

@@ -0,0 +1,6 @@
<svg t="1711938287623" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="5143">
<path
d="M153.6 153.6h716.8a51.2 51.2 0 0 1 0 102.4H153.6a51.2 51.2 0 1 1 0-102.4z m0 614.4h716.8a51.2 51.2 0 0 1 0 102.4H153.6a51.2 51.2 0 0 1 0-102.4z m0-307.2h131.6352a51.2 51.2 0 1 1 0 102.4H153.6a51.2 51.2 0 0 1 0-102.4z m292.5568 0h131.6864a51.2 51.2 0 0 1 0 102.4H446.1568a51.2 51.2 0 0 1 0-102.4z m292.608 0H870.4a51.2 51.2 0 0 1 0 102.4h-131.6352a51.2 51.2 0 0 1 0-102.4z"
p-id="5144"></path>
</svg>

After

Width:  |  Height:  |  Size: 554 B

View File

@@ -0,0 +1,70 @@
import React from 'react';
import MyIcon from '../Icon';
import {
Drawer,
DrawerBody,
DrawerHeader,
DrawerOverlay,
DrawerContent,
DrawerCloseButton,
DrawerContentProps,
Flex,
Image
} from '@chakra-ui/react';
import { useLoading } from '../../../hooks/useLoading';
type Props = DrawerContentProps & {
onClose: () => void;
iconSrc?: string;
title?: any;
isLoading?: boolean;
};
const MyRightDrawer = ({
onClose,
iconSrc,
title,
maxW = ['90vw', '30vw'],
children,
isLoading,
...props
}: Props) => {
const { Loading } = useLoading();
return (
<Drawer isOpen placement="right" onClose={onClose}>
<DrawerOverlay />
<DrawerContent
maxW={maxW}
{...props}
h={'94%'}
mt={'2%'}
borderLeftRadius={'lg'}
overflow={'hidden'}
>
<DrawerCloseButton />
<DrawerHeader>
<Flex alignItems={'center'} pr={2}>
{iconSrc && (
<>
{iconSrc.startsWith('/') ? (
<Image mr={3} objectFit={'contain'} alt="" src={iconSrc} w={'20px'} />
) : (
<MyIcon mr={3} name={iconSrc as any} w={'20px'} />
)}
</>
)}
{title}
</Flex>
<DrawerCloseButton zIndex={1} />
</DrawerHeader>
<DrawerBody>
{children}
<Loading loading={isLoading} fixed={false} />
</DrawerBody>
</DrawerContent>
</Drawer>
);
};
export default MyRightDrawer;

View File

@@ -2,6 +2,8 @@ import React from 'react';
import { Box, Flex, useTheme, Grid, type GridProps } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
import MyTooltip from '../MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import QuestionTip from '../MyTooltip/QuestionTip';
// @ts-ignore
interface Props extends GridProps {
@@ -36,58 +38,59 @@ const LeftRadio = ({
return (
<Grid gridGap={[3, 5]} fontSize={['sm', 'md']} {...props}>
{list.map((item) => (
<MyTooltip key={item.value} label={item.tooltip}>
<Flex
alignItems={item.desc ? align : 'center'}
cursor={'pointer'}
userSelect={'none'}
px={px}
py={py}
border={theme.borders.sm}
borderWidth={'1px'}
borderRadius={'md'}
position={'relative'}
{...(value === item.value
? {
borderColor: 'primary.400',
bg: activeBg,
boxShadow: 'focus'
<Flex
alignItems={item.desc ? align : 'center'}
key={item.value}
cursor={'pointer'}
userSelect={'none'}
px={px}
py={py}
border={theme.borders.sm}
borderWidth={'1px'}
borderRadius={'md'}
position={'relative'}
{...(value === item.value
? {
borderColor: 'primary.400',
bg: activeBg,
boxShadow: 'focus'
}
: {
bg: defaultBg,
_hover: {
borderColor: 'primary.300'
}
: {
bg: defaultBg,
_hover: {
borderColor: 'primary.300'
}
})}
onClick={() => onChange(item.value)}
})}
onClick={() => onChange(item.value)}
>
<Box
w={'18px'}
h={'18px'}
borderWidth={'2.4px'}
borderColor={value === item.value ? 'primary.015' : 'transparent'}
borderRadius={'50%'}
mr={3}
>
<Box
w={'18px'}
h={'18px'}
borderWidth={'2.4px'}
borderColor={value === item.value ? 'primary.015' : 'transparent'}
<Flex
w={'100%'}
h={'100%'}
borderWidth={'1px'}
borderColor={value === item.value ? 'primary.600' : 'borderColor.high'}
bg={value === item.value ? 'primary.1' : 'transparent'}
borderRadius={'50%'}
mr={3}
alignItems={'center'}
justifyContent={'center'}
>
<Flex
w={'100%'}
h={'100%'}
borderWidth={'1px'}
borderColor={value === item.value ? 'primary.600' : 'borderColor.high'}
bg={value === item.value ? 'primary.1' : 'transparent'}
<Box
w={'5px'}
h={'5px'}
borderRadius={'50%'}
alignItems={'center'}
justifyContent={'center'}
>
<Box
w={'5px'}
h={'5px'}
borderRadius={'50%'}
bg={value === item.value ? 'primary.600' : 'transparent'}
></Box>
</Flex>
</Box>
<Box flex={'1 0 0'}>
bg={value === item.value ? 'primary.600' : 'transparent'}
></Box>
</Flex>
</Box>
<Box flex={'1 0 0'}>
<Flex alignItems={'center'}>
<Box
color={'myGray.900'}
fontWeight={item.desc ? '500' : 'normal'}
@@ -95,15 +98,16 @@ const LeftRadio = ({
>
{typeof item.title === 'string' ? t(item.title) : item.title}
</Box>
{!!item.desc && (
<Box fontSize={'xs'} color={'myGray.500'} lineHeight={1.2}>
{t(item.desc)}
</Box>
)}
{item?.children}
</Box>
</Flex>
</MyTooltip>
{!!item.tooltip && <QuestionTip label={item.tooltip} ml={1} color={'myGray.600'} />}
</Flex>
{!!item.desc && (
<Box fontSize={'xs'} color={'myGray.500'} lineHeight={1.2}>
{t(item.desc)}
</Box>
)}
{item?.children}
</Box>
</Flex>
))}
</Grid>
);