mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 01:40:51 +00:00
优化代码
This commit is contained in:
@@ -34,7 +34,7 @@ export type FastGPTFeConfigsType = {
|
|||||||
show_openai_account?: boolean;
|
show_openai_account?: boolean;
|
||||||
show_promotion?: boolean;
|
show_promotion?: boolean;
|
||||||
show_team_chat?: boolean;
|
show_team_chat?: boolean;
|
||||||
show_compliance_documentation?: boolean;
|
show_compliance_copywriting?: boolean;
|
||||||
concatMd?: string;
|
concatMd?: string;
|
||||||
|
|
||||||
docUrl?: string;
|
docUrl?: string;
|
||||||
|
@@ -38,7 +38,7 @@ import { clone } from 'lodash';
|
|||||||
import { formatFileSize } from '@fastgpt/global/common/file/tools';
|
import { formatFileSize } from '@fastgpt/global/common/file/tools';
|
||||||
import MyBox from '@fastgpt/web/components/common/MyBox';
|
import MyBox from '@fastgpt/web/components/common/MyBox';
|
||||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||||
import ComplianceTip, { TipTypeEnum } from '@/components/support/compliance/ComplianceTip';
|
import ComplianceTip from '@/components/support/compliance/ComplianceTip';
|
||||||
|
|
||||||
const InputGuideBox = dynamic(() => import('./InputGuideBox'));
|
const InputGuideBox = dynamic(() => import('./InputGuideBox'));
|
||||||
|
|
||||||
@@ -710,7 +710,7 @@ const ChatInput = ({
|
|||||||
|
|
||||||
{RenderTextarea}
|
{RenderTextarea}
|
||||||
</Box>
|
</Box>
|
||||||
<ComplianceTip type={TipTypeEnum.chat} />
|
<ComplianceTip type={'chat'} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -6,7 +6,7 @@ import Markdown from '@/components/Markdown';
|
|||||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||||
import AIResponseBox from '../../../components/AIResponseBox';
|
import AIResponseBox from '../../../components/AIResponseBox';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import ComplianceTip, { TipTypeEnum } from '@/components/support/compliance/ComplianceTip';
|
import ComplianceTip from '@/components/support/compliance/ComplianceTip';
|
||||||
const RenderOutput = () => {
|
const RenderOutput = () => {
|
||||||
const { histories, isChatting } = useContextSelector(PluginRunContext, (v) => v);
|
const { histories, isChatting } = useContextSelector(PluginRunContext, (v) => v);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -50,7 +50,7 @@ const RenderOutput = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<ComplianceTip type={TipTypeEnum.chat} />
|
<ComplianceTip type={'chat'} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -2,35 +2,32 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
|
|||||||
import { Box, BoxProps } from '@chakra-ui/react';
|
import { Box, BoxProps } from '@chakra-ui/react';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
export enum TipTypeEnum {
|
|
||||||
chat = 'chat',
|
const ChatTip = ({ type, ...props }: { type: 'chat' | 'dataset' } & BoxProps) => {
|
||||||
dataset = 'dataset'
|
|
||||||
}
|
|
||||||
const ChatTip = ({ type, ...props }: { type: `${TipTypeEnum}` } & BoxProps) => {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { feConfigs } = useSystemStore();
|
const { feConfigs } = useSystemStore();
|
||||||
|
|
||||||
const textMap = useMemo(() => {
|
const textMap = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
[TipTypeEnum.chat]: t('common:compliance.chat'),
|
chat: t('common:compliance.chat'),
|
||||||
[TipTypeEnum.dataset]: t('common:compliance.dataset')
|
dataset: t('common:compliance.dataset')
|
||||||
};
|
};
|
||||||
}, [t]);
|
}, [t]);
|
||||||
return (
|
|
||||||
feConfigs.show_compliance_documentation && (
|
return feConfigs.show_compliance_copywriting ? (
|
||||||
<Box
|
<Box
|
||||||
w={'100%'}
|
w={'100%'}
|
||||||
textAlign={'center'}
|
textAlign={'center'}
|
||||||
fontSize={'0.6875rem'}
|
fontSize={'0.6875rem'}
|
||||||
fontWeight={'400'}
|
fontWeight={'400'}
|
||||||
pt={3}
|
pt={3}
|
||||||
pb={[3, 0]}
|
pb={[3, 0]}
|
||||||
color={'myGray.400'}
|
color={'myGray.400'}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{textMap[type]}
|
{textMap[type]}
|
||||||
</Box>
|
</Box>
|
||||||
)
|
) : null;
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ChatTip;
|
export default ChatTip;
|
||||||
|
@@ -20,7 +20,7 @@ import AIModelSelector from '@/components/Select/AIModelSelector';
|
|||||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||||
import ComplianceTip, { TipTypeEnum } from '@/components/support/compliance/ComplianceTip';
|
import ComplianceTip from '@/components/support/compliance/ComplianceTip';
|
||||||
|
|
||||||
export type CreateDatasetType =
|
export type CreateDatasetType =
|
||||||
| DatasetTypeEnum.dataset
|
| DatasetTypeEnum.dataset
|
||||||
@@ -225,20 +225,19 @@ const CreateModal = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
<Flex w={'100%'} pt={6} justifyContent={'flex-end'}>
|
|
||||||
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
|
|
||||||
{t('common:common.Close')}
|
|
||||||
</Button>
|
|
||||||
<Button isLoading={creating} onClick={handleSubmit((data) => onclickCreate(data))}>
|
|
||||||
{t('common:common.Confirm Create')}
|
|
||||||
</Button>
|
|
||||||
</Flex>
|
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter px={9} pt={0}>
|
<ModalFooter px={9}>
|
||||||
<ComplianceTip pt={0} type={TipTypeEnum.dataset} />
|
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
|
||||||
|
{t('common:common.Close')}
|
||||||
|
</Button>
|
||||||
|
<Button isLoading={creating} onClick={handleSubmit((data) => onclickCreate(data))}>
|
||||||
|
{t('common:common.Confirm Create')}
|
||||||
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
|
|
||||||
|
<ComplianceTip pb={6} pt={0} px={9} type={'dataset'} />
|
||||||
|
|
||||||
<File onSelect={onSelectFile} />
|
<File onSelect={onSelectFile} />
|
||||||
</MyModal>
|
</MyModal>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user