mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 11:58:38 +00:00
4.8.10 test (#2573)
* feat: more debug response * fix: debug edge status * perf: doc * fix: workflow edge check * perf: i18n * package.json * perf: markdown mask
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useLoading } from '@fastgpt/web/hooks/useLoading';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { throttle } from 'lodash';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { getUnreadCount } from '@/web/support/user/inform/api';
|
||||
|
@@ -3,7 +3,7 @@ import { Box, ImageProps, Skeleton } from '@chakra-ui/react';
|
||||
import MyPhotoView from '@fastgpt/web/components/common/Image/PhotoView';
|
||||
import { useBoolean } from 'ahooks';
|
||||
|
||||
const MdImage = ({ src, ...props }: { src?: string; forbidImgPreview?: boolean } & ImageProps) => {
|
||||
const MdImage = ({ src, ...props }: { src?: string } & ImageProps) => {
|
||||
const [isLoaded, { setTrue }] = useBoolean(false);
|
||||
|
||||
const [renderSrc, setRenderSrc] = useState(src);
|
||||
|
@@ -10,7 +10,7 @@ import RehypeExternalLinks from 'rehype-external-links';
|
||||
import styles from './index.module.scss';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
import { Link, Button } from '@chakra-ui/react';
|
||||
import { Link, Button, Box } from '@chakra-ui/react';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus';
|
||||
@@ -29,21 +29,21 @@ const QuestionGuide = dynamic(() => import('./chat/QuestionGuide'), { ssr: false
|
||||
const Markdown = ({
|
||||
source = '',
|
||||
showAnimation = false,
|
||||
forbidImgPreview = false
|
||||
isDisabled = false
|
||||
}: {
|
||||
source?: string;
|
||||
showAnimation?: boolean;
|
||||
forbidImgPreview?: boolean;
|
||||
isDisabled?: boolean;
|
||||
}) => {
|
||||
const components = useMemo<any>(
|
||||
() => ({
|
||||
img: (props: any) => <Image {...props} forbidImgPreview={forbidImgPreview} />,
|
||||
img: Image,
|
||||
pre: RewritePre,
|
||||
p: (pProps: any) => <p {...pProps} dir="auto" />,
|
||||
code: Code,
|
||||
a: A
|
||||
}),
|
||||
[forbidImgPreview]
|
||||
[]
|
||||
);
|
||||
|
||||
const formatSource = useMemo(() => {
|
||||
@@ -59,17 +59,20 @@ const Markdown = ({
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ReactMarkdown
|
||||
className={`markdown ${styles.markdown}
|
||||
<Box position={'relative'}>
|
||||
<ReactMarkdown
|
||||
className={`markdown ${styles.markdown}
|
||||
${showAnimation ? `${formatSource ? styles.waitingAnimation : styles.animation}` : ''}
|
||||
`}
|
||||
remarkPlugins={[RemarkMath, [RemarkGfm, { singleTilde: false }], RemarkBreaks]}
|
||||
rehypePlugins={[RehypeKatex, [RehypeExternalLinks, { target: '_blank' }]]}
|
||||
components={components}
|
||||
urlTransform={urlTransform}
|
||||
>
|
||||
{formatSource}
|
||||
</ReactMarkdown>
|
||||
remarkPlugins={[RemarkMath, [RemarkGfm, { singleTilde: false }], RemarkBreaks]}
|
||||
rehypePlugins={[RehypeKatex, [RehypeExternalLinks, { target: '_blank' }]]}
|
||||
components={components}
|
||||
urlTransform={urlTransform}
|
||||
>
|
||||
{formatSource}
|
||||
</ReactMarkdown>
|
||||
{isDisabled && <Box position={'absolute'} top={0} right={0} left={0} bottom={0} />}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -107,8 +110,8 @@ function Code(e: any) {
|
||||
return Component;
|
||||
}
|
||||
|
||||
function Image({ src, forbidImgPreview }: { forbidImgPreview: boolean; src?: string }) {
|
||||
return <MdImage forbidImgPreview={forbidImgPreview} src={src} />;
|
||||
function Image({ src }: { src?: string }) {
|
||||
return <MdImage src={src} />;
|
||||
}
|
||||
|
||||
function A({ children, ...props }: any) {
|
||||
|
@@ -326,7 +326,8 @@ export const WholeResponseContent = ({
|
||||
label={t('common:core.chat.response.context total length')}
|
||||
value={activeModule?.contextTotalLen}
|
||||
/>
|
||||
<Row label={workflowT('response.Error')} value={activeModule?.error} />
|
||||
<Row label={t('workflow:response.Error')} value={activeModule?.error} />
|
||||
<Row label={t('chat:response.node_inputs')} value={activeModule?.nodeInputs} />
|
||||
</>
|
||||
{/* ai chat */}
|
||||
<>
|
||||
|
@@ -75,7 +75,7 @@ const QRCodePayModal = ({
|
||||
<MyModal isOpen title={t('common:user.Pay')} iconSrc="/imgs/modal/pay.svg">
|
||||
<ModalBody textAlign={'center'} py={6} whiteSpace={'pre'}>
|
||||
{tip && (
|
||||
<Box fontSize={'sm'} whiteSpace={'normal'} mb={3}>
|
||||
<Box fontSize={'sm'} whiteSpace={'pre'} mb={3}>
|
||||
{tip}
|
||||
</Box>
|
||||
)}
|
||||
|
Reference in New Issue
Block a user