chore: display downloading progress in model instance log

This commit is contained in:
jialin
2025-08-08 15:51:09 +08:00
parent c8a7ac7dc6
commit bb67a8cbbb
3 changed files with 49 additions and 15 deletions
@@ -4,7 +4,6 @@ import classNames from 'classnames';
import _ from 'lodash';
import React, {
forwardRef,
memo,
useCallback,
useEffect,
useImperativeHandle,
@@ -25,10 +24,17 @@ interface LogsViewerProps {
tail?: number;
enableScorllLoad?: boolean;
diffHeight?: number;
isDownloading?: boolean;
}
const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
const { diffHeight, url, tail: defaultTail, enableScorllLoad = true } = props;
const {
diffHeight,
url,
tail: defaultTail,
enableScorllLoad = true,
isDownloading
} = props;
const { pageSize, page, setPage, setTotalPage, totalPage } =
useLogsPagination();
const { setChunkFetch } = useSetChunkFetch();
@@ -64,9 +70,10 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
};
const setCurrentData = (lines: string[]) => {
console.log('setCurrentData', lines);
const dataList = lines.map((line, index) => {
return {
content: removeBracketsFromLine(line),
content: line,
uid: `${pageRef.current}-${index}`
};
});
@@ -150,7 +157,8 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
logParseWorker.current.postMessage({
inputStr: data,
page: pageRef.current,
reset: clearScreen.current
reset: clearScreen.current,
isDownloading: isDownloading
});
clearScreen.current = false;
};
@@ -349,4 +357,4 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
);
});
export default memo(LogsViewer);
export default React.memo(LogsViewer);