mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
v4.6.5 (#620)
This commit is contained in:
@@ -2,4 +2,6 @@ import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
|
||||
import { UrlFetchParams, UrlFetchResponse } from '@fastgpt/global/common/file/api.d';
|
||||
|
||||
export const postFetchUrls = (data: UrlFetchParams) =>
|
||||
POST<UrlFetchResponse>(`/common/tools/urlFetch`, data);
|
||||
POST<UrlFetchResponse>(`/common/tools/urlFetch`, data, {
|
||||
timeout: 300000
|
||||
});
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { GET, POST, DELETE, PUT } from '@/web/common/api/request';
|
||||
import type { ChatHistoryItemType } from '@fastgpt/global/core/chat/type.d';
|
||||
import type {
|
||||
CloseCustomFeedbackParams,
|
||||
InitChatProps,
|
||||
InitChatResponse,
|
||||
InitOutLinkChatProps,
|
||||
@@ -50,8 +51,12 @@ export const delChatRecordById = (data: DeleteChatItemProps) =>
|
||||
*/
|
||||
export const putChatHistory = (data: UpdateHistoryProps) => PUT('/core/chat/updateHistory', data);
|
||||
|
||||
/* -------------- feedback ------------ */
|
||||
export const updateChatUserFeedback = (data: UpdateChatFeedbackProps) =>
|
||||
POST('/core/chat/feedback/updateUserFeedback', data);
|
||||
|
||||
export const updateChatAdminFeedback = (data: AdminUpdateFeedbackParams) =>
|
||||
POST('/core/chat/feedback/adminUpdate', data);
|
||||
|
||||
export const closeCustomFeedback = (data: CloseCustomFeedbackParams) =>
|
||||
POST('/core/chat/feedback/closeCustom', data).catch();
|
||||
|
@@ -5,7 +5,17 @@ import { useLoading } from '@/web/common/hooks/useLoading';
|
||||
import { useRequest } from '@/web/common/hooks/useRequest';
|
||||
import { getDatasetCollectionPathById, getDatasetCollections } from '@/web/core/dataset/api';
|
||||
import { useDatasetStore } from '@/web/core/dataset/store/dataset';
|
||||
import { Box, Flex, ModalFooter, Button, useTheme, Grid, Card, Image } from '@chakra-ui/react';
|
||||
import {
|
||||
Box,
|
||||
Flex,
|
||||
ModalFooter,
|
||||
Button,
|
||||
useTheme,
|
||||
Grid,
|
||||
Card,
|
||||
Image,
|
||||
ModalBody
|
||||
} from '@chakra-ui/react';
|
||||
import { DatasetCollectionTypeEnum } from '@fastgpt/global/core/dataset/constant';
|
||||
import { getCollectionIcon } from '@fastgpt/global/core/dataset/utils';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
@@ -115,7 +125,9 @@ const SelectCollections = ({
|
||||
FirstPathDom={
|
||||
<>
|
||||
<Box fontWeight={'bold'} fontSize={['sm', 'lg']}>
|
||||
{title || type === 'folder'
|
||||
{title
|
||||
? title
|
||||
: type === 'folder'
|
||||
? t('common.Select One Folder')
|
||||
: t('dataset.collections.Select Collection')}
|
||||
</Box>
|
||||
@@ -133,85 +145,83 @@ const SelectCollections = ({
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
<Flex flexDirection={'column'} flex={'1 0 0'}>
|
||||
<Box flex={'1 0 0'} px={4} py={2} position={'relative'}>
|
||||
<Grid
|
||||
gridTemplateColumns={['repeat(1,1fr)', 'repeat(2,1fr)', 'repeat(3,1fr)']}
|
||||
gridGap={3}
|
||||
userSelect={'none'}
|
||||
overflowY={'auto'}
|
||||
mt={2}
|
||||
>
|
||||
{collections.map((item) =>
|
||||
(() => {
|
||||
const selected = selectedDatasetCollectionIds.includes(item._id);
|
||||
return (
|
||||
<Card
|
||||
key={item._id}
|
||||
p={3}
|
||||
border={theme.borders.base}
|
||||
boxShadow={'sm'}
|
||||
cursor={'pointer'}
|
||||
_hover={{
|
||||
boxShadow: 'md'
|
||||
}}
|
||||
{...(selected
|
||||
? {
|
||||
bg: 'myBlue.300'
|
||||
}
|
||||
: {})}
|
||||
onClick={() => {
|
||||
if (item.type === DatasetCollectionTypeEnum.folder) {
|
||||
setParentId(item._id);
|
||||
} else {
|
||||
let result: string[] = [];
|
||||
if (max === 1) {
|
||||
result = [item._id];
|
||||
} else if (selected) {
|
||||
result = selectedDatasetCollectionIds.filter((id) => id !== item._id);
|
||||
} else if (selectedDatasetCollectionIds.length < max) {
|
||||
result = [...selectedDatasetCollectionIds, item._id];
|
||||
}
|
||||
setSelectedDatasetCollectionIds(result);
|
||||
onChange && onChange({ parentId, collectionIds: result });
|
||||
<ModalBody flex={'1 0 0'} overflow={'auto'}>
|
||||
<Grid
|
||||
gridTemplateColumns={['repeat(1,1fr)', 'repeat(2,1fr)']}
|
||||
gridGap={3}
|
||||
userSelect={'none'}
|
||||
overflowY={'auto'}
|
||||
mt={2}
|
||||
>
|
||||
{collections.map((item) =>
|
||||
(() => {
|
||||
const selected = selectedDatasetCollectionIds.includes(item._id);
|
||||
return (
|
||||
<Card
|
||||
key={item._id}
|
||||
p={3}
|
||||
border={theme.borders.base}
|
||||
boxShadow={'sm'}
|
||||
cursor={'pointer'}
|
||||
_hover={{
|
||||
boxShadow: 'md'
|
||||
}}
|
||||
{...(selected
|
||||
? {
|
||||
bg: 'blue.200'
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Flex alignItems={'center'} h={'38px'}>
|
||||
<Image src={item.icon} w={'18px'} alt={''} />
|
||||
<Box ml={3} fontSize={'sm'}>
|
||||
{item.name}
|
||||
</Box>
|
||||
</Flex>
|
||||
</Card>
|
||||
);
|
||||
})()
|
||||
)}
|
||||
</Grid>
|
||||
{collections.length === 0 && (
|
||||
<Flex mt={'20vh'} flexDirection={'column'} alignItems={'center'}>
|
||||
<MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} />
|
||||
<Box mt={2} color={'myGray.500'}>
|
||||
{t('common.folder.No Folder')}
|
||||
</Box>
|
||||
</Flex>
|
||||
: {})}
|
||||
onClick={() => {
|
||||
if (item.type === DatasetCollectionTypeEnum.folder) {
|
||||
setParentId(item._id);
|
||||
} else {
|
||||
let result: string[] = [];
|
||||
if (max === 1) {
|
||||
result = [item._id];
|
||||
} else if (selected) {
|
||||
result = selectedDatasetCollectionIds.filter((id) => id !== item._id);
|
||||
} else if (selectedDatasetCollectionIds.length < max) {
|
||||
result = [...selectedDatasetCollectionIds, item._id];
|
||||
}
|
||||
setSelectedDatasetCollectionIds(result);
|
||||
onChange && onChange({ parentId, collectionIds: result });
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Flex alignItems={'center'} h={'38px'}>
|
||||
<Image src={item.icon} w={'18px'} alt={''} />
|
||||
<Box ml={3} fontSize={'sm'} className="textEllipsis">
|
||||
{item.name}
|
||||
</Box>
|
||||
</Flex>
|
||||
</Card>
|
||||
);
|
||||
})()
|
||||
)}
|
||||
<Loading loading={isLoading} fixed={false} />
|
||||
</Box>
|
||||
{CustomFooter ? (
|
||||
<>{CustomFooter}</>
|
||||
) : (
|
||||
<ModalFooter>
|
||||
<Button
|
||||
isLoading={isResponding}
|
||||
isDisabled={type === 'collection' && selectedDatasetCollectionIds.length === 0}
|
||||
onClick={mutate}
|
||||
>
|
||||
{type === 'folder' ? t('common.Confirm Move') : t('Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</Grid>
|
||||
{collections.length === 0 && (
|
||||
<Flex mt={'20vh'} flexDirection={'column'} alignItems={'center'}>
|
||||
<MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} />
|
||||
<Box mt={2} color={'myGray.500'}>
|
||||
{t('common.folder.No Folder')}
|
||||
</Box>
|
||||
</Flex>
|
||||
)}
|
||||
</Flex>
|
||||
<Loading loading={isLoading} fixed={false} />
|
||||
</ModalBody>
|
||||
{CustomFooter ? (
|
||||
<>{CustomFooter}</>
|
||||
) : (
|
||||
<ModalFooter>
|
||||
<Button
|
||||
isLoading={isResponding}
|
||||
isDisabled={type === 'collection' && selectedDatasetCollectionIds.length === 0}
|
||||
onClick={mutate}
|
||||
>
|
||||
{type === 'folder' ? t('common.Confirm Move') : t('Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
)}
|
||||
</MyModal>
|
||||
);
|
||||
};
|
||||
|
@@ -1,5 +1,11 @@
|
||||
import { extendTheme, defineStyleConfig, ComponentStyleConfig } from '@chakra-ui/react';
|
||||
import { modalAnatomy, switchAnatomy, selectAnatomy, numberInputAnatomy } from '@chakra-ui/anatomy';
|
||||
import {
|
||||
modalAnatomy,
|
||||
switchAnatomy,
|
||||
selectAnatomy,
|
||||
numberInputAnatomy,
|
||||
checkboxAnatomy
|
||||
} from '@chakra-ui/anatomy';
|
||||
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
||||
|
||||
const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers(
|
||||
@@ -11,6 +17,8 @@ const { definePartsStyle: selectPart, defineMultiStyleConfig: selectMultiStyle }
|
||||
createMultiStyleConfigHelpers(selectAnatomy.keys);
|
||||
const { definePartsStyle: numInputPart, defineMultiStyleConfig: numInputMultiStyle } =
|
||||
createMultiStyleConfigHelpers(numberInputAnatomy.keys);
|
||||
const { definePartsStyle: checkBoxPart, defineMultiStyleConfig: checkBoxMultiStyle } =
|
||||
createMultiStyleConfigHelpers(checkboxAnatomy.keys);
|
||||
|
||||
// 按键
|
||||
const Button = defineStyleConfig({
|
||||
@@ -68,7 +76,7 @@ const Button = defineStyleConfig({
|
||||
},
|
||||
gray: {
|
||||
bg: '#F5F5F8',
|
||||
color: 'myBlue.700',
|
||||
color: 'blue.600',
|
||||
border: '1px solid #EFF0F1',
|
||||
_hover: {
|
||||
background: '#3370FF1A'
|
||||
@@ -81,12 +89,12 @@ const Button = defineStyleConfig({
|
||||
bg: 'transparent',
|
||||
transition: 'background 0.3s',
|
||||
_hover: {
|
||||
color: 'myBlue.600',
|
||||
color: 'blue.500',
|
||||
background: 'myWhite.400',
|
||||
boxShadow: '0 0 5px rgba(0,0,0,0.1)'
|
||||
},
|
||||
_active: {
|
||||
color: 'myBlue.700'
|
||||
color: 'blue.600'
|
||||
},
|
||||
_disabled: {
|
||||
bg: 'myGray.100 !important',
|
||||
@@ -127,7 +135,7 @@ const Input: ComponentStyleConfig = {
|
||||
borderRadius: 'base',
|
||||
borderColor: 'myGray.200',
|
||||
_focus: {
|
||||
borderColor: 'myBlue.600',
|
||||
borderColor: 'blue.500',
|
||||
boxShadow: '0px 0px 4px #A8DBFF',
|
||||
bg: 'white'
|
||||
},
|
||||
@@ -153,7 +161,7 @@ const NumberInput = numInputMultiStyle({
|
||||
borderRadius: 'base',
|
||||
borderColor: 'myGray.200',
|
||||
_focus: {
|
||||
borderColor: 'myBlue.600 !important',
|
||||
borderColor: 'blue.500 !important',
|
||||
boxShadow: '0px 0px 4px #A8DBFF !important',
|
||||
bg: 'transparent'
|
||||
},
|
||||
@@ -167,7 +175,7 @@ const NumberInput = numInputMultiStyle({
|
||||
border: 'none',
|
||||
color: 'myGray.600',
|
||||
_active: {
|
||||
color: 'myBlue.600'
|
||||
color: 'blue.500'
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -187,7 +195,7 @@ const Textarea: ComponentStyleConfig = {
|
||||
borderColor: ''
|
||||
},
|
||||
_focus: {
|
||||
borderColor: 'myBlue.600',
|
||||
borderColor: 'blue.500',
|
||||
boxShadow: '0px 0px 4px #A8DBFF',
|
||||
bg: 'white'
|
||||
}
|
||||
@@ -205,7 +213,7 @@ const Switch = switchMultiStyle({
|
||||
track: {
|
||||
bg: 'myGray.100',
|
||||
_checked: {
|
||||
bg: 'myBlue.700'
|
||||
bg: 'blue.600'
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -218,13 +226,21 @@ const Select = selectMultiStyle({
|
||||
borderColor: 'myGray.200',
|
||||
_focusWithin: {
|
||||
boxShadow: '0px 0px 4px #A8DBFF',
|
||||
borderColor: 'myBlue.600'
|
||||
borderColor: 'blue.500'
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
const Checkbox = checkBoxMultiStyle({
|
||||
baseStyle: checkBoxPart({
|
||||
label: {
|
||||
fontFamily: 'mono' // change the font family of the label
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// 全局主题
|
||||
export const theme = extendTheme({
|
||||
styles: {
|
||||
@@ -238,7 +254,7 @@ export const theme = extendTheme({
|
||||
// lineHeight: 'unset'
|
||||
},
|
||||
a: {
|
||||
color: 'myBlue.700'
|
||||
color: 'blue.600'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -267,17 +283,17 @@ export const theme = extendTheme({
|
||||
900: '#24282C',
|
||||
1000: '#121416'
|
||||
},
|
||||
myBlue: {
|
||||
100: '#f0f7ff',
|
||||
200: '#EBF7FD',
|
||||
300: '#d6e8ff',
|
||||
400: '#adceff',
|
||||
500: '#85b1ff',
|
||||
600: '#4e83fd',
|
||||
700: '#3370ff',
|
||||
800: '#2152d9',
|
||||
900: '#1237b3',
|
||||
1000: '#07228c'
|
||||
blue: {
|
||||
50: '#f0f7ff',
|
||||
100: '#EBF7FD',
|
||||
200: '#d6e8ff',
|
||||
300: '#adceff',
|
||||
400: '#85b1ff',
|
||||
500: '#4e83fd',
|
||||
600: '#3370ff',
|
||||
700: '#2152d9',
|
||||
800: '#1237b3',
|
||||
900: '#07228c'
|
||||
},
|
||||
myRead: {
|
||||
600: '#ff4d4f'
|
||||
@@ -326,6 +342,7 @@ export const theme = extendTheme({
|
||||
Textarea,
|
||||
Switch,
|
||||
Select,
|
||||
NumberInput
|
||||
NumberInput,
|
||||
Checkbox
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user