This commit is contained in:
Archer
2023-11-20 19:20:55 +08:00
committed by GitHub
parent 9c4eabfc9e
commit 0558379ddb
26 changed files with 571 additions and 497 deletions

View File

@@ -185,6 +185,7 @@ ${images.map((img) => JSON.stringify({ src: img.src })).join('\n')}
boxShadow={isSpeaking ? `0 0 10px rgba(54,111,255,0.4)` : `0 0 10px rgba(0,0,0,0.2)`}
borderRadius={['none', 'md']}
bg={'white'}
overflow={'hidden'}
{...(isPc
? {
border: '1px solid',
@@ -289,8 +290,8 @@ ${images.map((img) => JSON.stringify({ src: img.src })).join('\n')}
onOpenSelectFile();
}}
>
<MyTooltip label={t('core.chat.Select File')}>
<MyIcon name={'core/chat/fileSelect'} />
<MyTooltip label={t('core.chat.Select Image')}>
<MyIcon name={'core/chat/fileSelect'} w={'18px'} color={'myGray.600'} />
</MyTooltip>
<File onSelect={onSelectFile} />
</Flex>

View File

@@ -69,12 +69,12 @@ const QuoteModal = ({
isCentered
minW={['90vw', '600px']}
title={
<>
<Box>
({rawSearch.length})
<Box fontSize={'10px'} color={'myGray.500'} fontWeight={'normal'}>
注意: 修改知识库内容成功后
</Box>
</>
</Box>
}
>
<ModalBody pt={0} whiteSpace={'pre-wrap'} textAlign={'justify'} wordBreak={'break-all'}>

View File

@@ -45,7 +45,6 @@ const SelectMarkCollection = ({
isOpen
paths={paths}
onClose={onClose}
parentId={parentId}
setParentId={setParentId}
tips={t('chat.Select Mark Kb Desc')}
>

View File

@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1696179048209" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4182" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M373.333333 85.333333H266.666667a53.393333 53.393333 0 0 0-53.333334 53.333334v746.666666a53.393333 53.393333 0 0 0 53.333334 53.333334h106.666666a53.393333 53.393333 0 0 0 53.333334-53.333334V138.666667a53.393333 53.393333 0 0 0-53.333334-53.333334z m10.666667 800a10.666667 10.666667 0 0 1-10.666667 10.666667H266.666667a10.666667 10.666667 0 0 1-10.666667-10.666667V138.666667a10.666667 10.666667 0 0 1 10.666667-10.666667h106.666666a10.666667 10.666667 0 0 1 10.666667 10.666667z m373.333333-800H650.666667a53.393333 53.393333 0 0 0-53.333334 53.333334v746.666666a53.393333 53.393333 0 0 0 53.333334 53.333334h106.666666a53.393333 53.393333 0 0 0 53.333334-53.333334V138.666667a53.393333 53.393333 0 0 0-53.333334-53.333334z m10.666667 800a10.666667 10.666667 0 0 1-10.666667 10.666667H650.666667a10.666667 10.666667 0 0 1-10.666667-10.666667V138.666667a10.666667 10.666667 0 0 1 10.666667-10.666667h106.666666a10.666667 10.666667 0 0 1 10.666667 10.666667z" p-id="4183"></path></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1683450443331" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1727" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M58.15222827 227.09272427L492.1075808-23.4520384a39.00952427 39.00952427 0 0 1 39.00952427 0l433.95657066 250.54476267a39.00952427 39.00952427 0 0 1 19.50476267 33.78346666v501.0895232a39.00952427 39.00952427 0 0 1-19.50476267 33.78224747l-433.95657066 250.54476267a39.00952427 39.00952427 0 0 1-39.00952427 0L58.15100907 795.7479616a39.00952427 39.00952427 0 0 1-19.5047616-33.78224747V260.87619093a39.00952427 39.00952427 0 0 1 19.5047616-33.78346666z m63.494096 53.5503232a9.7523808 9.7523808 0 0 0-4.87619094 8.4467808v444.66224746a9.7523808 9.7523808 0 0 0 4.87619094 8.44556267l385.08982826 222.3311232a9.7523808 9.7523808 0 0 0 9.7523808 0l385.08860907-222.329904a9.7523808 9.7523808 0 0 0 4.87619093-8.44678187V289.08982827a9.7523808 9.7523808 0 0 0-4.87619093-8.4467808L516.48853333 58.3131424a9.7523808 9.7523808 0 0 0-9.7523808 0l-385.08982826 222.32990507z m389.56129493 190.72l300.3611424-173.4131808c18.65752427-10.77150507 42.51550507-4.3788192 53.28822933 14.27870506 10.77150507 18.65752427 4.3788192 42.51550507-14.27870506 53.28822827L551.00952427 538.4728384V881.37142827c0 21.54422827-17.46529493 39.00952427-39.00952427 39.00952426-21.54422827 0-39.00952427-17.46529493-39.00952427-39.00952426V539.38712427L172.89386667 366.12632427c-18.65752427-10.77272427-25.05142827-34.63070507-14.27870507-53.28822934 10.77272427-18.65752427 34.63070507-25.05142827 53.28822933-14.278704L511.2076192 471.36304747z" p-id="1728"></path></svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -3,10 +3,7 @@ import type { IconProps } from '@chakra-ui/react';
import { Icon } from '@chakra-ui/react';
const iconPaths = {
appFill: () => import('./icons/fill/app.svg'),
appLight: () => import('./icons/light/app.svg'),
copy: () => import('./icons/copy.svg'),
chatSend: () => import('./icons/chatSend.svg'),
delete: () => import('./icons/delete.svg'),
stop: () => import('./icons/stop.svg'),
collectionLight: () => import('./icons/collectionLight.svg'),
@@ -89,7 +86,6 @@ const iconPaths = {
moveLight: () => import('./icons/light/move.svg'),
questionGuide: () => import('./icons/app/questionGuide.svg'),
loading: () => import('./icons/light/loading.svg'),
pause: () => import('./icons/common/pause.svg'),
'core/app/aiLight': () => import('./icons/core/app/aiLight.svg'),
'core/app/aiFill': () => import('./icons/core/app/aiFill.svg'),
'common/text/t': () => import('./icons/common/text/t.svg'),

View File

@@ -39,7 +39,7 @@ const MyModal = ({
minW={['90vw', '400px']}
maxW={maxW}
position={'relative'}
maxH={'90vh'}
maxH={['80vh', '85vh']}
{...props}
>
{!title && onClose && <ModalCloseButton zIndex={1} />}

View File

@@ -26,9 +26,9 @@ const ParentPaths = (props: {
return paths.length === 0 && !!FirstPathDom ? (
<>{FirstPathDom}</>
) : (
<Flex flex={1}>
<Flex flex={1} ml={-2}>
{concatPaths.map((item, i) => (
<Flex key={item.parentId} alignItems={'center'}>
<Flex key={item.parentId || i} alignItems={'center'}>
<Box
fontSize={['sm', 'lg']}
py={1}
@@ -51,7 +51,7 @@ const ParentPaths = (props: {
{item.parentName}
</Box>
{i !== concatPaths.length - 1 && (
<MyIcon name={'rightArrowLight'} color={'myGray.500'} w={['14px', '24px']} />
<MyIcon name={'rightArrowLight'} color={'myGray.500'} w={'14px'} />
)}
</Flex>
))}

View File

@@ -6,6 +6,7 @@ import { useTranslation } from 'next-i18next';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import { Box, Flex, ModalHeader } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
import ParentPaths from '@/components/common/ParentPaths';
type PathItemType = {
parentId: string;
@@ -14,7 +15,6 @@ type PathItemType = {
const DatasetSelectContainer = ({
isOpen,
parentId,
setParentId,
paths,
onClose,
@@ -22,7 +22,6 @@ const DatasetSelectContainer = ({
children
}: {
isOpen: boolean;
parentId?: string;
setParentId: Dispatch<string>;
paths: PathItemType[];
onClose: () => void;
@@ -35,45 +34,17 @@ const DatasetSelectContainer = ({
return (
<MyModal isOpen={isOpen} onClose={onClose} w={'100%'} maxW={['90vw', '900px']} isCentered>
<Flex flexDirection={'column'} h={'90vh'}>
<ModalHeader>
{!!parentId ? (
<Flex
flex={1}
userSelect={'none'}
fontSize={['sm', 'lg']}
fontWeight={'normal'}
color={'myGray.900'}
>
{paths.map((item, i) => (
<Flex key={item.parentId} mr={2} alignItems={'center'}>
<Box
fontSize={'lg'}
borderRadius={'md'}
{...(i === paths.length - 1
? {
cursor: 'default'
}
: {
cursor: 'pointer',
_hover: {
color: 'myBlue.600'
},
onClick: () => {
setParentId(item.parentId);
}
})}
>
{item.parentName}
</Box>
{i !== paths.length - 1 && (
<MyIcon name={'rightArrowLight'} color={'myGray.500'} w={['18px', '24px']} />
)}
</Flex>
))}
</Flex>
) : (
<Box>{t('chat.Select Mark Kb')}</Box>
)}
<ModalHeader fontWeight={'normal'}>
<ParentPaths
paths={paths.map((path, i) => ({
parentId: path.parentId,
parentName: path.parentName
}))}
FirstPathDom={t('chat.Select Mark Kb')}
onClick={(e) => {
setParentId(e);
}}
/>
{!!tips && (
<Box fontSize={'sm'} color={'myGray.500'} fontWeight={'normal'}>
{tips}
@@ -94,16 +65,7 @@ export function useDatasetSelect() {
Promise.all([getDatasets({ parentId }), getDatasetPaths(parentId)])
);
const paths = useMemo(
() => [
{
parentId: '',
parentName: t('dataset.My Dataset')
},
...(data?.[1] || [])
],
[data, t]
);
const paths = useMemo(() => [...(data?.[1] || [])], [data]);
return {
parentId,

View File

@@ -26,6 +26,8 @@ import { useTranslation } from 'next-i18next';
import { useDatasetStore } from '@/web/core/dataset/store/dataset';
import { feConfigs } from '@/web/common/system/staticData';
import DatasetSelectContainer, { useDatasetSelect } from '@/components/core/dataset/SelectModal';
import { useLoading } from '@/web/common/hooks/useLoading';
import EmptyTip from '@/components/EmptyTip';
export type KbParamsType = {
searchSimilarity: number;
@@ -54,7 +56,8 @@ export const DatasetSelectModal = ({
})
);
const { toast } = useToast();
const { paths, parentId, setParentId, datasets } = useDatasetSelect();
const { paths, setParentId, datasets, isLoading } = useDatasetSelect();
const { Loading } = useLoading();
const filterKbList = useMemo(() => {
return {
@@ -71,9 +74,8 @@ export const DatasetSelectModal = ({
<DatasetSelectContainer
isOpen={isOpen}
paths={paths}
parentId={parentId}
setParentId={setParentId}
tips={'仅能选择同一个索引模型的知识库'}
tips={t('dataset.Select Dataset Tips')}
onClose={onClose}
>
<Flex h={'100%'} flexDirection={'column'} flex={'1 0 0'}>
@@ -158,7 +160,7 @@ export const DatasetSelectModal = ({
if (vectorModel && vectorModel !== item.vectorModel.model) {
return toast({
status: 'warning',
title: '仅能选择同一个索引模型的知识库'
title: t('dataset.Select Dataset Tips')
});
}
setSelectedKbList((state) => [
@@ -197,14 +199,7 @@ export const DatasetSelectModal = ({
})()
)}
</Grid>
{filterKbList.unSelected.length === 0 && (
<Flex mt={5} flexDirection={'column'} alignItems={'center'}>
<MyIcon name="empty" w={'48px'} h={'48px'} mt={'20vh'} color={'transparent'} />
<Box mt={2} color={'myGray.500'}>
西~
</Box>
</Flex>
)}
{filterKbList.unSelected.length === 0 && <EmptyTip text={t('common.folder.empty')} />}
</ModalBody>
<ModalFooter>
@@ -219,9 +214,11 @@ export const DatasetSelectModal = ({
onChange(filterKbList);
}}
>
{t('common.Done')}
</Button>
</ModalFooter>
<Loading fixed={false} loading={isLoading} />
</Flex>
</DatasetSelectContainer>
);