chore: parse ansi

main
jialin 1 year ago
parent b9c9fe7a97
commit 2fea3a4b40

@ -3,7 +3,8 @@
padding: 5px 0 5px 10px;
background-color: var(--color-logs-bg);
border-radius: var(--border-radius-mini);
overflow: hidden;
overflow: auto;
font-family: "monospace,Menlo,Courier,'Courier New',Consolas,Monaco, 'Liberation Mono'";
.content {
word-wrap: break-word;
@ -14,7 +15,7 @@
}
.text {
height: 100%;
min-height: 22px;
}
color: var(--color-logs-text);
@ -26,8 +27,6 @@
}
.xterm {
// height: 100% !important;
.xterm-viewport {
overflow-y: auto !important;

@ -1,19 +1,13 @@
import useSetChunkRequest from '@/hooks/use-chunk-request';
import useSetChunkFetch from '@/hooks/use-chunk-fetch';
import useOverlayScroller from '@/hooks/use-overlay-scroller';
import { FitAddon } from '@xterm/addon-fit';
import { Terminal } from '@xterm/xterm';
import '@xterm/xterm/css/xterm.css';
import classNames from 'classnames';
import _ from 'lodash';
import {
memo,
useCallback,
useEffect,
useLayoutEffect,
useRef,
useState
} from 'react';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import './index.less';
import useSize from './use-size';
import parseAnsi from './parse-ansi';
interface LogsViewerProps {
height: number;
@ -22,39 +16,41 @@ interface LogsViewerProps {
params?: object;
}
const LogsViewer: React.FC<LogsViewerProps> = (props) => {
const { height, content, url } = props;
const { setChunkRequest } = useSetChunkRequest();
const { height, url } = props;
const { initialize, updateScrollerPosition } = useOverlayScroller({
theme: 'os-theme-light'
});
const { setChunkFetch } = useSetChunkFetch();
const chunkRequedtRef = useRef<any>(null);
const scroller = useRef<any>({});
const termRef = useRef<any>({});
const termwrapRef = useRef<any>({});
const fitAddonRef = useRef<any>({});
const cacheDataRef = useRef<any>('');
const [logs, setLogs] = useState('');
const size = useSize(scroller);
const uidRef = useRef<any>(0);
const [logs, setLogs] = useState<any[]>([]);
const throttleScroll = _.throttle(() => {
termRef.current?.scrollToBottom?.();
}, 100);
const setId = () => {
uidRef.current += 1;
return uidRef.current;
};
const clearScreen = () => {
cacheDataRef.current = '';
};
const updateContent = useCallback(
_.throttle((data: string) => {
cacheDataRef.current = '';
termRef.current?.clear?.();
cacheDataRef.current = data;
termRef.current?.write?.(data);
setLogs(data);
}, 100),
[]
(data: string) => {
cacheDataRef.current += data;
const res = parseAnsi(cacheDataRef.current, setId, clearScreen);
setLogs(res);
},
[setLogs, setId]
);
const fitTerm = () => {
fitAddonRef.current?.fit?.();
};
const createChunkConnection = async () => {
chunkRequedtRef.current?.current?.cancel?.();
chunkRequedtRef.current = setChunkRequest({
chunkRequedtRef.current?.current?.abort?.();
chunkRequedtRef.current = setChunkFetch({
url,
params: {
...props.params,
@ -65,7 +61,8 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
});
};
const initTerm = () => {
const initTerm = useCallback(() => {
termRef.current?.clear?.();
termRef.current?.dispose?.();
termRef.current = new Terminal({
lineHeight: 1.2,
@ -84,43 +81,38 @@ const LogsViewer: React.FC<LogsViewerProps> = (props) => {
fitAddonRef.current = new FitAddon();
termRef.current.loadAddon(fitAddonRef.current);
termRef.current.open(termwrapRef.current);
};
const handleResize = _.throttle(() => {
fitTerm();
}, 100);
}, [termwrapRef.current]);
useEffect(() => {
createChunkConnection();
return () => {
chunkRequedtRef.current?.current?.cancel?.();
chunkRequedtRef.current?.current?.abort?.();
};
}, [url, props.params]);
useEffect(() => {
if (termwrapRef.current) {
initTerm();
if (scroller.current) {
initialize(scroller.current);
}
return () => {
termRef.current?.dispose?.();
};
}, [termwrapRef.current]);
useLayoutEffect(() => {
if (size) {
handleResize();
}
}, [size]);
}, [scroller.current, initialize]);
useEffect(() => {
throttleScroll();
if (logs) {
updateScrollerPosition();
}
}, [logs]);
return (
<div className="logs-viewer-wrap-w2">
<div className="wrap" style={{ height: height }} ref={scroller}>
<div className={classNames('content')}>
<div className="text" ref={termwrapRef}></div>
{_.map(logs, (item: any, index: number) => {
return (
<div key={item.uid} className="text">
{item.content}
</div>
);
})}
</div>
</div>
</div>

@ -1,22 +0,0 @@
.logs-viewer-wrap-w2 {
.wrap {
padding: 5px 0 5px 10px;
overflow: auto;
background-color: var(--color-logs-bg);
border-radius: var(--border-radius-mini);
.content {
word-wrap: break-word;
&.line-break {
word-wrap: break-word;
}
color: var(--color-logs-text);
font-size: var(--font-size-small);
line-height: 22px;
white-space: pre-wrap;
background-color: var(--color-logs-bg);
}
}
}

@ -1,159 +0,0 @@
import useSetChunkFetch from '@/hooks/use-chunk-fetch';
import useSetChunkRequest from '@/hooks/use-chunk-request';
import useContainerScroll from '@/hooks/use-container-scorll';
import Convert from 'ansi-to-html';
import classNames from 'classnames';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import './old.less';
interface LogsViewerProps {
height: number;
content?: string;
url: string;
params?: object;
}
const LogsViewer: React.FC<LogsViewerProps> = (props) => {
const { height, content, url } = props;
const [nowrap, setNowrap] = useState(false);
const [logsContent, setLogsContent] = useState<string[]>([]);
const { setChunkRequest } = useSetChunkRequest();
const { setChunkFetch } = useSetChunkFetch();
const chunkRequedtRef = useRef<any>(null);
const scroller = useRef<any>(null);
const cacheDataRef = useRef<any>('');
const { updateScrollerPosition, handleContentWheel } = useContainerScroll(
scroller,
{ toBottom: true }
);
const convert = new Convert({
newline: true,
escapeXML: true,
stream: false
});
useEffect(() => {
updateScrollerPosition();
}, [logsContent]);
const ansiEscapeRegex = /(\x1B\[A)+$/;
const endsWithAnsiEscapeSequence = useCallback((str: string) => {
return ansiEscapeRegex.test(str);
}, []);
const getCursorUpLines = useCallback((str: string) => {
const matches = str.match(/(?:\x1B\[A)+$/);
return matches ? matches[0].length / 3 : 0;
}, []);
const removeDot = useCallback((str: string) => {
return str.replace(/^\(.*?\)/, '');
}, []);
const replaceAnsiEscapeSequence = useCallback((str: string) => {
const res = str.replace(ansiEscapeRegex, '');
return removeDot(res);
}, []);
const handleRControl = useCallback((str: string) => {
if (str.includes('\r')) {
const parts = str.split('\r');
const lastLine = parts[parts.length - 1];
return lastLine;
}
return str;
}, []);
const parseHtmlStr = useCallback((logStr: string) => {
cacheDataRef.current += logStr.replace('\r\n', '\n');
console.log('data>>>>>>>>>>>', {
data: logStr,
cacheDataRef: cacheDataRef.current
});
const result: string[] = [];
const lines = cacheDataRef.current
.split('\n')
.filter((line: string) => line.trim() !== '');
// const lines = text;
lines.forEach((line: string, index: number) => {
const upCount = getCursorUpLines(line);
console.log('line=========1', {
line,
upCount,
result
});
if (endsWithAnsiEscapeSequence(line)) {
const newLine = handleRControl(line);
const val = removeDot(newLine);
if (result.length < upCount) {
result.push('');
}
if (upCount) {
console.log('line=========0', {
line,
upCount,
result
});
const placeIndex = result.length - upCount;
result[placeIndex] = replaceAnsiEscapeSequence(val);
} else {
result.push(val);
}
} else {
const val = handleRControl(line);
result.push(val);
}
});
return result.map((item) => {
return convert.toHtml(item);
});
}, []);
const updateContent = (newVal: string) => {
const list = parseHtmlStr(newVal);
setLogsContent(list);
};
const createChunkConnection = async () => {
chunkRequedtRef.current?.current?.abort?.();
chunkRequedtRef.current = setChunkFetch({
url,
params: {
...props.params,
watch: true
},
contentType: 'text',
handler: updateContent
});
};
useEffect(() => {
createChunkConnection();
return () => {
chunkRequedtRef.current?.current?.abort?.();
};
}, [url, props.params]);
return (
<div className="logs-viewer-wrap-w2">
<div
className="wrap"
style={{ height: height }}
ref={scroller}
onWheel={handleContentWheel}
>
<div className={classNames('content', { 'line-break': nowrap })}>
<div className="text">
{logsContent.map((item, index) => {
return (
<div key={index} dangerouslySetInnerHTML={{ __html: item }} />
);
})}
</div>
</div>
</div>
</div>
);
};
export default memo(LogsViewer);

@ -0,0 +1,130 @@
const removeBrackets = (str: string) => {
return str?.replace?.(/^\(.*?\)/, '');
};
const parseAnsi = (
inputStr: string,
setId: () => number,
clearScreen: () => void
) => {
let cursorRow = 0; // current row
let cursorCol = 0; // current column
// screen content array
let screen = [['']];
// replace carriage return and newline characters in the text
let input = inputStr.replace(/\r\n/g, '\n');
// handle the \r and \n characters in the text
const handleText = (text: string) => {
let processed = '';
for (let char of text) {
if (char === '\r') {
cursorCol = 0; // move to the beginning of the line
} else if (char === '\n') {
cursorRow++; // move to the next line
cursorCol = 0; // move to the beginning of the line
screen[cursorRow] = screen[cursorRow] || ['']; // create a new line if it does not exist
} else {
// add the character to the screen content array
screen[cursorRow][cursorCol] = char;
cursorCol++;
}
}
return processed;
};
// ANSI
const controlSeqRegex = /\x1b\[(\d*);?(\d*)?([A-DJKHfm])/g;
let output = ''; // output text
let match;
let lastIndex = 0;
// ANSI color map
const colorMap: Record<string, string> = {
'30': 'black',
'31': 'red',
'32': 'green',
'33': 'yellow',
'34': 'blue',
'35': 'magenta',
'36': 'cyan',
'37': 'white'
};
let currentStyle = ''; // current text style
// match ANSI control characters
while ((match = controlSeqRegex.exec(input)) !== null) {
// handle text before the control character
let textBeforeControl = input.slice(lastIndex, match.index);
output += handleText(textBeforeControl); // add the processed text to the output
lastIndex = controlSeqRegex.lastIndex; // update the last index
const n = parseInt(match[1], 10) || 1;
const m = parseInt(match[2], 10) || 1;
const command = match[3];
// handle ANSI control characters
switch (command) {
case 'A': // move the cursor up
cursorRow = Math.max(0, cursorRow - n);
break;
case 'B': // move the cursor down
cursorRow += n;
break;
case 'C': // move the cursor right
cursorCol += n;
break;
case 'D': // move the cursor left
cursorCol = Math.max(0, cursorCol - n);
break;
case 'H': // move the cursor to the specified position (n, m)
cursorRow = Math.max(0, n - 1);
cursorCol = Math.max(0, m - 1);
break;
case 'J': // clear the screen
if (n === 2) {
screen = [['']];
cursorRow = 0;
cursorCol = 0;
clearScreen?.();
}
break;
case 'm': // color
if (match[1] === '0') {
currentStyle = '';
} else if (colorMap[match[1]]) {
currentStyle = `color: ${colorMap[match[1]]};`;
}
break;
}
// check if the row and column are within the screen content array
while (screen.length <= cursorRow) {
screen.push(['']);
}
while (screen[cursorRow].length <= cursorCol) {
screen[cursorRow].push('');
}
}
// handle the remaining text
output += handleText(input.slice(lastIndex));
let result = [];
for (let row = 0; row < screen.length; row++) {
let rowContent = screen[row].join('');
result.push({
content: removeBrackets(rowContent),
uid: setId()
});
}
result.push({
content: output,
uid: setId()
});
return result;
};
export default parseAnsi;

@ -1,186 +0,0 @@
export default [
'2024-09-11T20:09:42+08:00 - gpustack.worker.downloaders - INFO - Downloading model leafspark/Reflection-Llama-3.1-70B-GGUF/Reflection-Llama-3.1-70B.fp16*.gguf',
'\rFetching 4 files: 0%| | 0/4 [00:00<?, ?it/s]',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 0.00/21.7G [00:00<?, ?B/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 0.00/39.8G [00:00<?, ?B/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 0.00/39.8G [00:00<?, ?B/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 0.00/39.8G [00:00<?, ?B/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 10.5M/21.7G [00:00<33:18, 10.9MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 10.5M/39.8G [00:00<57:50, 11.5MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 10.5M/39.8G [00:01<1:10:14, 9.43MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 10.5M/39.8G [00:01<1:49:48, 6.04MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 21.0M/21.7G [00:01<32:32, 11.1MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 21.0M/39.8G [00:01<1:01:12, 10.8MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 21.0M/39.8G [00:02<1:13:42, 8.99MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 21.0M/39.8G [00:02<1:15:27, 8.79MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 31.5M/21.7G [00:02<31:03, 11.6MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 31.5M/39.8G [00:02<1:01:49, 10.7MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 31.5M/39.8G [00:03<1:11:03, 9.32MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 31.5M/39.8G [00:03<1:14:10, 8.94MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 41.9M/21.7G [00:03<33:05, 10.9MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 41.9M/39.8G [00:04<1:05:32, 10.1MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 41.9M/39.8G [00:04<1:08:05, 9.72MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 41.9M/39.8G [00:04<1:16:35, 8.66MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 52.4M/21.7G [00:05<38:18, 9.42MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 52.4M/39.8G [00:05<1:15:47, 8.75MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 52.4M/39.8G [00:05<1:10:49, 9.34MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 52.4M/39.8G [00:05<1:09:52, 9.49MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 62.9M/21.7G [00:06<38:36, 9.34MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 62.9M/39.8G [00:06<1:08:09, 9.72MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 62.9M/39.8G [00:06<1:12:01, 9.18MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 62.9M/39.8G [00:06<1:08:42, 9.65MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 73.4M/21.7G [00:07<35:51, 10.1MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 73.4M/39.8G [00:07<1:10:30, 9.40MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 73.4M/39.8G [00:07<1:07:33, 9.79MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 73.4M/39.8G [00:08<1:08:59, 9.60MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 83.9M/21.7G [00:08<35:46, 10.1MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 83.9M/39.8G [00:08<1:09:18, 9.56MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 83.9M/39.8G [00:08<1:06:26, 9.95MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 83.9M/39.8G [00:09<1:09:44, 9.50MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 94.4M/21.7G [00:09<37:16, 9.66MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 94.4M/39.8G [00:09<1:08:35, 9.66MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 94.4M/39.8G [00:10<1:15:34, 8.75MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 0%| | 105M/21.7G [00:10<38:00, 9.47MB/s] \x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 94.4M/39.8G [00:10<1:15:42, 8.75MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 105M/39.8G [00:10<1:09:51, 9.48MB/s] \x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 105M/39.8G [00:11<1:08:19, 9.67MB/s] \x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 105M/39.8G [00:11<1:08:56, 9.60MB/s] \x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 115M/21.7G [00:11<39:31, 9.10MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 115M/39.8G [00:11<1:09:17, 9.55MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 115M/39.8G [00:11<1:05:22, 10.1MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 115M/39.8G [00:12<1:07:16, 9.84MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 126M/21.7G [00:12<39:05, 9.20MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 126M/39.8G [00:13<1:10:29, 9.39MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 126M/39.8G [00:13<1:10:04, 9.43MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 126M/39.8G [00:13<1:10:03, 9.45MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 136M/39.8G [00:14<1:08:49, 9.61MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 136M/21.7G [00:14<41:08, 8.74MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 136M/39.8G [00:14<1:09:47, 9.46MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 136M/39.8G [00:14<1:11:33, 9.25MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 147M/21.7G [00:15<37:06, 9.68MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 147M/39.8G [00:15<1:08:57, 9.59MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 147M/39.8G [00:15<1:09:54, 9.44MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 147M/39.8G [00:15<1:09:24, 9.53MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 157M/21.7G [00:16<38:27, 9.34MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 157M/39.8G [00:16<1:10:05, 9.43MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 157M/39.8G [00:16<1:07:01, 9.85MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 157M/39.8G [00:16<1:07:50, 9.75MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 168M/21.7G [00:17<38:21, 9.36MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 168M/39.8G [00:17<1:09:56, 9.45MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 168M/39.8G [00:17<1:08:31, 9.63MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 168M/39.8G [00:17<1:07:58, 9.73MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 178M/21.7G [00:18<36:28, 9.84MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 178M/39.8G [00:18<1:08:43, 9.62MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 178M/39.8G [00:18<1:06:23, 9.93MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 178M/39.8G [00:18<1:07:04, 9.85MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 189M/21.7G [00:19<36:05, 9.93MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 0%| | 189M/39.8G [00:19<1:09:17, 9.53MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 0%| | 189M/39.8G [00:19<1:09:44, 9.46MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 0%| | 189M/39.8G [00:20<1:08:53, 9.59MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 199M/21.7G [00:20<37:40, 9.51MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 199M/39.8G [00:20<1:10:46, 9.33MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 199M/39.8G [00:20<1:09:30, 9.49MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 199M/39.8G [00:22<1:24:55, 7.78MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 210M/21.7G [00:23<57:14, 6.26MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 210M/39.8G [00:27<2:43:58, 4.02MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 210M/39.8G [00:27<2:51:41, 3.85MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 210M/39.8G [00:30<3:47:09, 2.91MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 220M/21.7G [00:34<2:34:24, 2.32MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 220M/39.8G [00:37<5:20:53, 2.06MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 220M/39.8G [00:38<5:29:14, 2.00MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 220M/39.8G [00:41<6:03:25, 1.82MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 231M/21.7G [00:45<3:38:08, 1.64MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 231M/39.8G [00:48<7:09:37, 1.54MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 220M/39.8G [00:49<5:29:14, 2.00MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 231M/39.8G [00:49<7:23:13, 1.49MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 231M/39.8G [00:53<7:47:12, 1.41MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 241M/21.7G [00:56<4:26:13, 1.34MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 231M/39.8G [00:59<7:09:37, 1.54MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 241M/39.8G [00:59<8:28:36, 1.30MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 241M/39.8G [01:00<8:38:48, 1.27MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 241M/39.8G [01:04<8:55:29, 1.23MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 252M/21.7G [01:07<4:59:02, 1.20MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 252M/39.8G [01:10<9:24:07, 1.17MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 252M/39.8G [01:11<9:31:14, 1.15MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 252M/39.8G [01:15<9:43:07, 1.13MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%| | 262M/21.7G [01:18<5:22:04, 1.11MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 262M/39.8G [01:21<10:02:41, 1.09MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 262M/39.8G [01:22<10:07:38, 1.08MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 262M/39.8G [01:26<10:16:38, 1.07MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 273M/21.7G [01:29<5:37:49, 1.06MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 273M/39.8G [01:32<10:30:00, 1.05MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 273M/39.8G [01:33<10:33:40, 1.04MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 273M/39.8G [01:37<10:38:34, 1.03MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 273M/21.7G [01:40<5:37:49, 1.06MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 283M/21.7G [01:40<5:49:35, 1.02MB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 283M/39.8G [01:43<10:49:55, 1.01MB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 283M/39.8G [01:44<10:50:42, 1.01MB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 283M/39.8G [01:48<10:54:20, 1.01MB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 294M/21.7G [01:51<5:57:39, 997kB/s] \x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 294M/39.8G [01:54<11:03:10, 994kB/s] \x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 294M/39.8G [01:55<11:03:01, 992kB/s] \x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 294M/39.8G [01:59<11:06:45, 988kB/s] \x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 304M/21.7G [02:02<6:02:42, 983kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 304M/39.8G [02:06<11:11:58, 980kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 304M/39.8G [02:07<11:13:31, 976kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 304M/39.8G [02:10<11:13:59, 977kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 315M/21.7G [02:13<6:06:19, 973kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 315M/39.8G [02:17<11:18:04, 971kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 315M/39.8G [02:18<11:19:02, 968kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 304M/39.8G [02:20<11:13:59, 977kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 315M/39.8G [02:21<11:19:35, 969kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 1%|▏ | 325M/21.7G [02:25<6:09:00, 965kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 325M/39.8G [02:28<11:23:11, 964kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 325M/39.8G [02:29<11:24:16, 960kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 325M/39.8G [02:32<11:23:06, 964kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 336M/21.7G [02:36<6:10:37, 961kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 336M/39.8G [02:39<11:30:56, 953kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 336M/39.8G [02:40<11:27:52, 955kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 336M/39.8G [02:43<11:26:57, 958kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 346M/21.7G [02:47<6:12:02, 957kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 346M/39.8G [02:50<11:27:09, 958kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 336M/39.8G [02:50<11:27:52, 955kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 346M/39.8G [02:51<11:29:24, 953kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 346M/39.8G [02:54<11:28:21, 956kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 357M/21.7G [02:58<6:12:46, 954kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 346M/39.8G [03:00<11:27:09, 958kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 357M/39.8G [03:01<11:28:44, 955kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 357M/39.8G [03:02<11:30:19, 951kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 357M/39.8G [03:05<11:29:12, 955kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 367M/21.7G [03:09<6:13:01, 953kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 367M/39.8G [03:12<11:29:49, 953kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 367M/39.8G [03:13<11:30:10, 951kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 367M/39.8G [03:16<11:30:21, 953kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 377M/21.7G [03:20<6:13:22, 952kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 377M/39.8G [03:23<11:30:39, 952kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 377M/39.8G [03:24<11:30:37, 950kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 377M/39.8G [03:27<11:31:13, 951kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 388M/21.7G [03:31<6:13:41, 950kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 388M/39.8G [03:34<11:31:12, 951kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 388M/39.8G [03:35<11:30:13, 951kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 388M/39.8G [03:38<11:31:04, 951kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 388M/21.7G [03:41<6:13:41, 950kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 398M/21.7G [03:42<6:14:00, 949kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 398M/39.8G [03:45<11:31:46, 950kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 398M/39.8G [03:46<11:30:55, 949kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 398M/39.8G [03:49<11:31:42, 950kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 409M/21.7G [03:53<6:14:52, 947kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 409M/39.8G [03:56<11:32:14, 949kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 409M/39.8G [03:57<11:31:30, 948kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 409M/39.8G [04:00<11:31:46, 950kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 419M/21.7G [04:04<6:14:17, 948kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 419M/39.8G [04:07<11:32:00, 949kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 419M/39.8G [04:08<11:30:58, 949kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 409M/39.8G [04:11<11:31:46, 950kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 419M/39.8G [04:11<11:32:14, 949kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 430M/21.7G [04:15<6:14:11, 947kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 430M/39.8G [04:18<11:33:24, 947kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 430M/39.8G [04:19<11:30:43, 949kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 430M/39.8G [04:22<11:31:17, 950kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 440M/21.7G [04:26<6:13:49, 948kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 440M/39.8G [04:29<11:32:42, 948kB/s]\x1B[A\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00001-of-00004.gguf: 1%| | 440M/39.8G [04:30<11:30:07, 950kB/s]\x1B[A\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00003-of-00004.gguf: 1%| | 440M/39.8G [04:33<11:30:57, 950kB/s]\x1B[A\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00004-of-00004.gguf: 2%|▏ | 451M/21.7G [04:37<6:13:16, 949kB/s]\x1B[A',
'\r(…)n-Llama-3.1-70B.fp16-00002-of-00004.gguf: 1%| | 451M/39.8G [04:40<11:32:03, 948kB/s]\x1B[A\x1B[A\x1B[A\x1B[A'
];

@ -12,6 +12,10 @@ interface RequestConfig {
const useSetChunkFetch = () => {
const axiosToken = useRef<any>(null);
const requestConfig = useRef<any>({});
const completeData = useRef<any>([]);
const chunkDataRef = useRef<any>([]);
const conentLengthRef = useRef<any>(0);
const receivedLengthRef = useRef<any>(0);
const readTextEventStreamData = async (
reader: any,
@ -19,16 +23,60 @@ const useSetChunkFetch = () => {
callback: (data: any) => void
) => {
const { done, value } = await reader.read();
console.log('chunkDataRef.current===1', {
data: chunkDataRef.current,
done
});
if (done) {
return;
}
let chunk = decoder.decode(value, { stream: true });
const chunk = decoder.decode(value, { stream: true });
callback(chunk);
// console.log('chunkDataRef.current===2', chunkDataRef.current);
await readTextEventStreamData(reader, decoder, callback);
};
const combineUint8Arrays = (arrays: Uint8Array[]) => {
// Calculate total length
const totalLength = arrays.reduce((acc, arr) => acc + arr.length, 0);
// Create a new Uint8Array to hold the combined data
const combined = new Uint8Array(totalLength);
// Copy each array into the combined array
let offset = 0;
for (const arr of arrays) {
combined.set(arr, offset);
offset += arr.length;
}
return combined;
};
const readUint8ArrayStreamData = async (
reader: ReadableStreamDefaultReader<Uint8Array>,
callback: (data: Uint8Array) => void
) => {
const { done, value } = await reader.read();
while (true) {
if (done) {
callback(completeData.current);
break;
}
const tempData = new Uint8Array(
completeData.current.length + value.length
);
tempData.set(completeData.current);
tempData.set(value, completeData.current.length);
completeData.current = tempData;
}
// await readUint8ArrayStreamData(reader, callback);
};
const fetchChunkRequest = async ({
url,
handler,
@ -51,15 +99,21 @@ const useSetChunkFetch = () => {
signal: axiosToken.current.signal
}
);
console.log('response============', response);
if (!response.ok) {
return;
}
chunkDataRef.current = '';
conentLengthRef.current = response.headers.get('Content-Length');
receivedLengthRef.current = 0;
console.log('conentLengthRef.current', conentLengthRef.current, response);
const reader = response?.body?.getReader();
const decoder = new TextDecoder('utf-8');
await readTextEventStreamData(reader, decoder, handler);
} catch (error) {
// handle error
console.log('error============', error);
}
return axiosToken.current;

@ -14,6 +14,7 @@ export const overlaySollerOptions: UseOverlayScrollbarsParams = {
x: 'hidden'
},
scrollbars: {
theme: 'os-theme-light',
autoHide: 'scroll',
autoHideDelay: 600,
clickScroll: 'instant'
@ -22,11 +23,25 @@ export const overlaySollerOptions: UseOverlayScrollbarsParams = {
defer: true
};
export default function useOverlayScroller() {
export default function useOverlayScroller(options?: any) {
const scrollEventElement = React.useRef<any>(null);
const instanceRef = React.useRef<any>(null);
const [initialize, instance] = useOverlayScrollbars({
...overlaySollerOptions
options: {
update: {
debounce: 0
},
overflow: {
x: 'hidden'
},
scrollbars: {
theme: options?.theme || 'os-theme-dark',
autoHide: 'scroll',
autoHideDelay: 600,
clickScroll: 'instant'
}
},
defer: true
});
instanceRef.current = instance?.();
scrollEventElement.current =

Loading…
Cancel
Save