chore: update backend parameters and logs reading frequency

This commit is contained in:
jialin
2025-06-30 18:57:13 +08:00
parent 143f6df2c1
commit b2e9cbb44a
4 changed files with 43 additions and 2 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ const LogsList: React.FC<LogsListProps> = forwardRef((props, ref) => {
const isBottom = scrollTop + clientHeight + 150 >= scrollHeight;
// is scroll to top
if (scrollTop === 0) {
if (scrollTop <= 10) {
onScroll?.({
isTop: true,
isBottom: false
+30 -1
View File
@@ -1,3 +1,4 @@
import { convertFileSize } from '@/utils';
import { throttle } from 'lodash';
import qs from 'query-string';
import { useEffect, useRef } from 'react';
@@ -42,13 +43,19 @@ const useSetChunkFetch = () => {
const readTextEventStreamData = async (
response: Response,
callback: HandlerFunction,
delay = 200
delay = 100
) => {
class BufferManager {
private buffer: any[] = [];
private contentLength: number | null = null;
private progress: number = 0;
private percent: number = 0;
private speedHistory: number[] = [];
private maxHistory = 5;
private lastTime: number = performance.now();
private lastBytes: number = 0;
private totalBytes: number = 0;
private avgSpeed: number = 0;
constructor(private options: { contentLength?: string | null }) {
this.contentLength = options.contentLength
@@ -63,6 +70,28 @@ const useSetChunkFetch = () => {
}
}
private logSpeed(speedBps: number) {
this.speedHistory.push(speedBps);
if (this.speedHistory.length > this.maxHistory) {
this.speedHistory.shift();
}
this.avgSpeed =
this.speedHistory.reduce((a, b) => a + b, 0) /
this.speedHistory.length;
console.log(`瞬时均值: ${convertFileSize(this.avgSpeed)}/s`);
}
public updateSpeed(bytes: number) {
const now = performance.now();
const elapsed = (now - this.lastTime) / 1000;
if (elapsed > 0.3) {
const speed = (this.totalBytes + bytes - this.lastBytes) / elapsed;
this.logSpeed(speed);
this.lastTime = now;
this.lastBytes = this.totalBytes + bytes;
}
}
public add(data: any) {
this.buffer.push(data);
this.updateProgress(data);
@@ -604,6 +604,10 @@ const options = [
{
label: '--no-enable-reasoning',
value: '--no-enable-reasoning'
},
{
label: '--override-tensor',
value: '--override-tensor'
}
];
@@ -183,6 +183,14 @@ const options = [
{
label: '--moe-tensor-parallel-size',
value: '--moe-tensor-parallel-size'
},
{
label: '--enable-multi-token-prediction',
value: '--enable-multi-token-prediction'
},
{
label: '--multi-token-prediction-tokens',
value: '--multi-token-prediction-tokens'
}
];