mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 01:54:04 +00:00
perf: modal
This commit is contained in:
@@ -13,7 +13,14 @@ const ContextModal = ({
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyModal isOpen={true} onClose={onClose} title={`完整对话记录(${context.length}条)`} h={'80vh'}>
|
<MyModal
|
||||||
|
isOpen={true}
|
||||||
|
onClose={onClose}
|
||||||
|
title={`完整对话记录(${context.length}条)`}
|
||||||
|
minW={['90vw', '600px']}
|
||||||
|
h={['90vh', '80vh']}
|
||||||
|
isCentered
|
||||||
|
>
|
||||||
<ModalBody pt={0} whiteSpace={'pre-wrap'} textAlign={'justify'} fontSize={'sm'}>
|
<ModalBody pt={0} whiteSpace={'pre-wrap'} textAlign={'justify'} fontSize={'sm'}>
|
||||||
{context.map((item, i) => (
|
{context.map((item, i) => (
|
||||||
<Box
|
<Box
|
||||||
|
@@ -61,13 +61,21 @@ const QuoteModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<MyModal isOpen={true} onClose={onClose} h={'80vh'}>
|
<MyModal
|
||||||
<ModalHeader>
|
isOpen={true}
|
||||||
|
onClose={onClose}
|
||||||
|
h={['90vh', '80vh']}
|
||||||
|
isCentered
|
||||||
|
minW={['90vw', '600px']}
|
||||||
|
title={
|
||||||
|
<>
|
||||||
知识库引用({rawSearch.length}条)
|
知识库引用({rawSearch.length}条)
|
||||||
<Box fontSize={'sm'} fontWeight={'normal'}>
|
<Box fontSize={['xs', 'sm']} fontWeight={'normal'}>
|
||||||
注意: 修改知识库内容成功后,此处不会显示变更情况。点击编辑后,会显示知识库最新的内容。
|
注意: 修改知识库内容成功后,此处不会显示变更情况。点击编辑后,会显示知识库最新的内容。
|
||||||
</Box>
|
</Box>
|
||||||
</ModalHeader>
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
<ModalBody pt={0} whiteSpace={'pre-wrap'} textAlign={'justify'} fontSize={'sm'}>
|
<ModalBody pt={0} whiteSpace={'pre-wrap'} textAlign={'justify'} fontSize={'sm'}>
|
||||||
{rawSearch.map((item) => (
|
{rawSearch.map((item) => (
|
||||||
|
@@ -5,9 +5,9 @@ import {
|
|||||||
ModalContent,
|
ModalContent,
|
||||||
ModalHeader,
|
ModalHeader,
|
||||||
ModalCloseButton,
|
ModalCloseButton,
|
||||||
ModalContentProps
|
ModalContentProps,
|
||||||
|
Box
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { DefaultTFuncReturn } from 'i18next';
|
|
||||||
|
|
||||||
interface Props extends ModalContentProps {
|
interface Props extends ModalContentProps {
|
||||||
showCloseBtn?: boolean;
|
showCloseBtn?: boolean;
|
||||||
@@ -32,16 +32,20 @@ const MyModal = ({
|
|||||||
<Modal isOpen={isOpen} onClose={onClose} autoFocus={false} isCentered={isCentered}>
|
<Modal isOpen={isOpen} onClose={onClose} autoFocus={false} isCentered={isCentered}>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
display={'flex'}
|
||||||
|
flexDirection={'column'}
|
||||||
w={w}
|
w={w}
|
||||||
minW={['300px', '400px']}
|
minW={['90vw', '400px']}
|
||||||
maxW={maxW}
|
maxW={maxW}
|
||||||
position={'relative'}
|
position={'relative'}
|
||||||
overflow={'overlay'}
|
maxH={'90vh'}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{!!title && <ModalHeader>{title}</ModalHeader>}
|
{!!title && <ModalHeader>{title}</ModalHeader>}
|
||||||
|
<Box overflow={'overlay'}>
|
||||||
{showCloseBtn && <ModalCloseButton />}
|
{showCloseBtn && <ModalCloseButton />}
|
||||||
{children}
|
{children}
|
||||||
|
</Box>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@@ -132,10 +132,10 @@ export const KbParamsModal = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyModal isOpen={true} onClose={onClose} title={'搜索参数调整'}>
|
<MyModal isOpen={true} onClose={onClose} title={'搜索参数调整'} minW={['90vw', '600px']}>
|
||||||
<Flex flexDirection={'column'}>
|
<Flex flexDirection={'column'}>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Box display={['block', 'flex']} pt={3} pb={5}>
|
<Box display={['block', 'flex']} py={5} pt={[0, 5]}>
|
||||||
<Box flex={'0 0 100px'} mb={[8, 0]}>
|
<Box flex={'0 0 100px'} mb={[8, 0]}>
|
||||||
相似度
|
相似度
|
||||||
<MyTooltip label={'高相似度推荐0.8及以上。'} forceShow>
|
<MyTooltip label={'高相似度推荐0.8及以上。'} forceShow>
|
||||||
|
@@ -130,8 +130,9 @@ const InputDataModal = ({
|
|||||||
title={defaultValues.dataId ? '变更数据' : '手动导入数据'}
|
title={defaultValues.dataId ? '变更数据' : '手动导入数据'}
|
||||||
w={'90vw'}
|
w={'90vw'}
|
||||||
maxW={'90vw'}
|
maxW={'90vw'}
|
||||||
|
h={'90vh'}
|
||||||
>
|
>
|
||||||
<Flex display={'flex'} flexDirection={'column'} h={'90vh'}>
|
<Flex flexDirection={'column'} h={'100%'}>
|
||||||
<Box
|
<Box
|
||||||
display={'flex'}
|
display={'flex'}
|
||||||
flexDirection={['column', 'row']}
|
flexDirection={['column', 'row']}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { Configuration, OpenAIApi } from 'openai';
|
import { Configuration, OpenAIApi } from 'openai';
|
||||||
|
|
||||||
const baseUrl = process.env.ONEAPI_URL || process.env.OPENAI_BASE_URL || 'api.openai.com';
|
const baseUrl =
|
||||||
|
process.env.ONEAPI_URL || process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1';
|
||||||
|
|
||||||
export const getSystemOpenAiKey = () => {
|
export const getSystemOpenAiKey = () => {
|
||||||
return process.env.ONEAPI_KEY || process.env.OPENAIKEY || '';
|
return process.env.ONEAPI_KEY || process.env.OPENAIKEY || '';
|
||||||
|
@@ -50,7 +50,7 @@ export async function connectToDatabase(): Promise<void> {
|
|||||||
minPoolSize: 2
|
minPoolSize: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
initRootUser();
|
await initRootUser();
|
||||||
initPg();
|
initPg();
|
||||||
console.log('mongo connected');
|
console.log('mongo connected');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -84,7 +84,6 @@ async function initRootUser() {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('init root user error', error);
|
console.log('init root user error', error);
|
||||||
initRootUser();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function initPg() {
|
async function initPg() {
|
||||||
@@ -108,7 +107,6 @@ async function initPg() {
|
|||||||
console.log('init pg successful');
|
console.log('init pg successful');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('init pg error', error);
|
console.log('init pg error', error);
|
||||||
initPg();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user