Feat: If the interval between two outputs exceeds 600ms, a loading state is displayed at the end. (#16861)

### Summary

Feat: If the interval between two outputs exceeds 600ms, a loading state
is displayed at the end.
This commit is contained in:
balibabu
2026-07-13 18:02:29 +08:00
committed by GitHub
parent 8bc18154d2
commit 45862bf95d
7 changed files with 99 additions and 11 deletions

View File

@@ -18,6 +18,7 @@ import { useTranslation } from 'react-i18next';
import 'katex/dist/katex.min.css'; // `rehype-katex` does not import the CSS for you
import { useFetchDocumentThumbnailsByIds } from '@/hooks/use-document-request';
import { useLoadingPause } from '@/hooks/use-loading-pause';
import {
currentReg,
parseCitationIndex,
@@ -30,6 +31,7 @@ import classNames from 'classnames';
import { omit } from 'lodash';
import { pipe } from 'lodash/fp';
import reactStringReplace from 'react-string-replace';
import { LoadingDots } from '../loading-dots';
import { Button } from '../ui/button';
import {
HoverCard,
@@ -52,6 +54,7 @@ const MarkdownContent = ({
reference,
clickDocumentButton,
content,
loading,
}: {
content: string;
loading: boolean;
@@ -260,6 +263,7 @@ const MarkdownContent = ({
);
const dir = getDirAttribute(content.replace(citationMarkerReg, ''));
const showLoadingDots = useLoadingPause(loading, content);
return (
<div dir={dir} className={styles.markdownContentWrapper}>
@@ -298,6 +302,9 @@ const MarkdownContent = ({
>
{contentWithCursor}
</Markdown>
{showLoadingDots && (
<LoadingDots className="ml-1 inline-block text-text-secondary" />
)}
</div>
);
};