fix: update the instance servers field
This commit is contained in:
@@ -196,7 +196,10 @@ class AnsiParser {
|
|||||||
|
|
||||||
// const data = lines.join('\n');
|
// const data = lines.join('\n');
|
||||||
this.rawDataRows += lines.length;
|
this.rawDataRows += lines.length;
|
||||||
this.lines.push(...lines);
|
lines.forEach((line) => {
|
||||||
|
this.lines.push(line);
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: this.lines,
|
data: this.lines,
|
||||||
lines: this.rawDataRows,
|
lines: this.rawDataRows,
|
||||||
|
|||||||
@@ -99,17 +99,16 @@ const useSetChunkFetch = () => {
|
|||||||
|
|
||||||
public flush(done?: boolean) {
|
public flush(done?: boolean) {
|
||||||
if (this.buffer.length > 0) {
|
if (this.buffer.length > 0) {
|
||||||
const currentBuffer = [...this.buffer];
|
while (this.buffer.length > 0) {
|
||||||
this.buffer = [];
|
const item = this.buffer.shift()!;
|
||||||
currentBuffer.forEach((item, i) => {
|
const isComplete = this.buffer.length === 0 && done;
|
||||||
const isComplete = i === currentBuffer.length - 1 && done;
|
|
||||||
callback(item, {
|
callback(item, {
|
||||||
isComplete: isComplete || this.percent === 100,
|
isComplete: isComplete || this.percent === 100,
|
||||||
percent: this.percent,
|
percent: this.percent,
|
||||||
progress: this.progress,
|
progress: this.progress,
|
||||||
contentLength: this.contentLength
|
contentLength: this.contentLength
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +144,7 @@ const useSetChunkFetch = () => {
|
|||||||
try {
|
try {
|
||||||
const chunk = decoder.decode(value, { stream: true });
|
const chunk = decoder.decode(value, { stream: true });
|
||||||
bufferManager.add(chunk);
|
bufferManager.add(chunk);
|
||||||
bufferManager.updateSpeed(chunk.length);
|
// bufferManager.updateSpeed(chunk.length);
|
||||||
throttledCallback();
|
throttledCallback();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// handle error
|
// handle error
|
||||||
|
|||||||
@@ -25,7 +25,12 @@ import _ from 'lodash';
|
|||||||
import React, { useCallback, useEffect, useMemo } from 'react';
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { MODEL_INSTANCE_API } from '../apis';
|
import { MODEL_INSTANCE_API } from '../apis';
|
||||||
import { InstanceStatusMap, InstanceStatusMapValue, status } from '../config';
|
import {
|
||||||
|
InstanceStatusMap,
|
||||||
|
InstanceStatusMapValue,
|
||||||
|
backendOptionsMap,
|
||||||
|
status
|
||||||
|
} from '../config';
|
||||||
import {
|
import {
|
||||||
DistributedServerItem,
|
DistributedServerItem,
|
||||||
DistributedServers,
|
DistributedServers,
|
||||||
@@ -153,21 +158,17 @@ const RenderWorkerDownloading = (props: {
|
|||||||
distributed_servers?: DistributedServers;
|
distributed_servers?: DistributedServers;
|
||||||
workerList: WorkerListItem[];
|
workerList: WorkerListItem[];
|
||||||
instanceData: ModelInstanceListItem;
|
instanceData: ModelInstanceListItem;
|
||||||
|
backend?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const { distributed_servers, workerList, instanceData } = props;
|
const { distributed_servers, workerList, instanceData, backend } = props;
|
||||||
const { ray_actors = [], subordinate_workers = [] } =
|
|
||||||
distributed_servers || {};
|
|
||||||
|
|
||||||
let severList: DistributedServerItem[] = [];
|
const severList: DistributedServerItem[] =
|
||||||
if (ray_actors?.length > 0) {
|
distributed_servers?.subordinate_workers || [];
|
||||||
severList = ray_actors;
|
|
||||||
} else if (subordinate_workers?.length > 0) {
|
|
||||||
severList = subordinate_workers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
instanceData.state !== InstanceStatusMap.Downloading ||
|
instanceData.state !== InstanceStatusMap.Downloading ||
|
||||||
!severList.length
|
!severList.length ||
|
||||||
|
backend === backendOptionsMap.llamaBox
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -486,21 +487,8 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderDistributionInfo = (distributed_servers: DistributedServers) => {
|
const renderDistributionInfo = (distributed_servers: DistributedServers) => {
|
||||||
const {
|
const severList: DistributedServerItem[] =
|
||||||
rpc_servers = [],
|
distributed_servers?.subordinate_workers || [];
|
||||||
ray_actors = [],
|
|
||||||
subordinate_workers = []
|
|
||||||
} = distributed_servers || {};
|
|
||||||
|
|
||||||
let severList: DistributedServerItem[] = [];
|
|
||||||
|
|
||||||
if (rpc_servers?.length > 0) {
|
|
||||||
severList = rpc_servers;
|
|
||||||
} else if (ray_actors?.length > 0) {
|
|
||||||
severList = ray_actors;
|
|
||||||
} else if (subordinate_workers?.length > 0) {
|
|
||||||
severList = subordinate_workers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!severList.length) {
|
if (!severList.length) {
|
||||||
return null;
|
return null;
|
||||||
@@ -658,6 +646,7 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
|||||||
handleChildSelect={handleChildSelect}
|
handleChildSelect={handleChildSelect}
|
||||||
/>
|
/>
|
||||||
<RenderWorkerDownloading
|
<RenderWorkerDownloading
|
||||||
|
backend={modelData?.backend}
|
||||||
distributed_servers={instanceData.distributed_servers}
|
distributed_servers={instanceData.distributed_servers}
|
||||||
workerList={workerList}
|
workerList={workerList}
|
||||||
instanceData={instanceData}
|
instanceData={instanceData}
|
||||||
|
|||||||
Reference in New Issue
Block a user