fix: model and file evaluate over close loading
This commit is contained in:
@@ -140,6 +140,13 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
link: 'https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#cli-reference'
|
link: 'https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#cli-reference'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (backend === backendOptionsMap.ascendMindie) {
|
||||||
|
return {
|
||||||
|
backend: 'Ascend MindIE',
|
||||||
|
releases: '',
|
||||||
|
link: 'http://docs.gpustack.ai/latest/user-guide/inference-backends/#parameters-reference_2'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}, [backend]);
|
}, [backend]);
|
||||||
|
|||||||
@@ -102,10 +102,19 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
const [collapsed, setCollapsed] = useState<boolean>(false);
|
const [collapsed, setCollapsed] = useState<boolean>(false);
|
||||||
const [isGGUF, setIsGGUF] = useState<boolean>(false);
|
const [isGGUF, setIsGGUF] = useState<boolean>(false);
|
||||||
const modelFileRef = useRef<any>(null);
|
const modelFileRef = useRef<any>(null);
|
||||||
const isHolderRef = useRef<boolean>(false);
|
const isHolderRef = useRef<{
|
||||||
|
model: boolean;
|
||||||
|
file: boolean;
|
||||||
|
}>({
|
||||||
|
model: false,
|
||||||
|
file: false
|
||||||
|
});
|
||||||
|
|
||||||
const setIsHolderRef = (flag?: boolean) => {
|
const setIsHolderRef = (flag: Record<string, boolean>) => {
|
||||||
isHolderRef.current = flag || false;
|
isHolderRef.current = {
|
||||||
|
...isHolderRef.current,
|
||||||
|
...flag
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDefaultSpec = (item: any) => {
|
const getDefaultSpec = (item: any) => {
|
||||||
@@ -133,7 +142,11 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
categories: getCategory(item)
|
categories: getCategory(item)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (item.fakeName) {
|
if (
|
||||||
|
item.fakeName &&
|
||||||
|
!isHolderRef.current.model &&
|
||||||
|
!isHolderRef.current.file
|
||||||
|
) {
|
||||||
handleShowCompatibleAlert(item.evaluateResult);
|
handleShowCompatibleAlert(item.evaluateResult);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -144,7 +157,8 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
setIsGGUF(false);
|
setIsGGUF(false);
|
||||||
form.current?.form?.resetFields(resetFields);
|
form.current?.form?.resetFields(resetFields);
|
||||||
const modelInfo = onSelectModel(item, props.source);
|
const modelInfo = onSelectModel(item, props.source);
|
||||||
if (!isHolderRef.current) {
|
console.log('isholderRef', isHolderRef.current);
|
||||||
|
if (!isHolderRef.current.model && !isHolderRef.current.file) {
|
||||||
handleShowCompatibleAlert(item.evaluateResult);
|
handleShowCompatibleAlert(item.evaluateResult);
|
||||||
}
|
}
|
||||||
form.current?.setFieldsValue?.({
|
form.current?.setFieldsValue?.({
|
||||||
@@ -246,10 +260,13 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
return warningStatus.show && warningStatus.type !== 'success';
|
return warningStatus.show && warningStatus.type !== 'success';
|
||||||
}, [warningStatus.show, warningStatus.type]);
|
}, [warningStatus.show, warningStatus.type]);
|
||||||
|
|
||||||
const displayEvaluateStatus = (show?: boolean) => {
|
const displayEvaluateStatus = (data: {
|
||||||
setIsHolderRef(show);
|
show?: boolean;
|
||||||
|
flag: Record<string, boolean>;
|
||||||
|
}) => {
|
||||||
|
setIsHolderRef(data.flag);
|
||||||
setWarningStatus({
|
setWarningStatus({
|
||||||
show: show || false,
|
show: isHolderRef.current.model || isHolderRef.current.file,
|
||||||
title: '',
|
title: '',
|
||||||
type: 'transition',
|
type: 'transition',
|
||||||
message: intl.formatMessage({ id: 'models.form.evaluating' })
|
message: intl.formatMessage({ id: 'models.form.evaluating' })
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ interface HFModelFileProps {
|
|||||||
ref: any;
|
ref: any;
|
||||||
gpuOptions?: any[];
|
gpuOptions?: any[];
|
||||||
onSelectFile?: (file: any, evaluate?: boolean) => void;
|
onSelectFile?: (file: any, evaluate?: boolean) => void;
|
||||||
displayEvaluateStatus?: (show?: boolean) => void;
|
displayEvaluateStatus?: (data: {
|
||||||
|
show?: boolean;
|
||||||
|
flag: Record<string, boolean>;
|
||||||
|
}) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pattern = /^(.*)-(\d+)-of-(\d+)\.(.*)$/;
|
const pattern = /^(.*)-(\d+)-of-(\d+)\.(.*)$/;
|
||||||
@@ -251,7 +254,6 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setIsEvaluating(true);
|
setIsEvaluating(true);
|
||||||
displayEvaluateStatus?.(true);
|
|
||||||
const evaluationList = await getEvaluateResults(evaluateFileList);
|
const evaluationList = await getEvaluateResults(evaluateFileList);
|
||||||
|
|
||||||
const resultList = _.map(list, (item: any, index: number) => {
|
const resultList = _.map(list, (item: any, index: number) => {
|
||||||
@@ -264,7 +266,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
resultList,
|
resultList,
|
||||||
(item: any) => item.path === currentPathRef.current
|
(item: any) => item.path === currentPathRef.current
|
||||||
);
|
);
|
||||||
displayEvaluateStatus?.(false);
|
displayEvaluateStatus?.({
|
||||||
|
show: false,
|
||||||
|
flag: {
|
||||||
|
file: false
|
||||||
|
}
|
||||||
|
});
|
||||||
if (currentItem) {
|
if (currentItem) {
|
||||||
handleSelectModelFile(currentItem, true);
|
handleSelectModelFile(currentItem, true);
|
||||||
}
|
}
|
||||||
@@ -272,6 +279,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
setIsEvaluating(false);
|
setIsEvaluating(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsEvaluating(false);
|
setIsEvaluating(false);
|
||||||
|
displayEvaluateStatus?.({
|
||||||
|
show: false,
|
||||||
|
flag: {
|
||||||
|
file: false
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -285,6 +298,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
axiosTokenRef.current?.abort?.();
|
axiosTokenRef.current?.abort?.();
|
||||||
axiosTokenRef.current = new AbortController();
|
axiosTokenRef.current = new AbortController();
|
||||||
setDataSource({ ...dataSource, loading: true });
|
setDataSource({ ...dataSource, loading: true });
|
||||||
|
displayEvaluateStatus?.({
|
||||||
|
show: true,
|
||||||
|
flag: {
|
||||||
|
file: true
|
||||||
|
}
|
||||||
|
});
|
||||||
setCurrent('');
|
setCurrent('');
|
||||||
try {
|
try {
|
||||||
let list = [];
|
let list = [];
|
||||||
@@ -306,6 +325,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
setDataSource({ fileList: [], loading: false });
|
setDataSource({ fileList: [], loading: false });
|
||||||
handleSelectModelFile({});
|
handleSelectModelFile({});
|
||||||
|
displayEvaluateStatus?.({
|
||||||
|
show: false,
|
||||||
|
flag: {
|
||||||
|
file: false
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ interface SearchInputProps {
|
|||||||
setLoadingModel?: (flag: boolean) => void;
|
setLoadingModel?: (flag: boolean) => void;
|
||||||
onSourceChange?: (source: string) => void;
|
onSourceChange?: (source: string) => void;
|
||||||
onSelectModel: (model: any, evaluate?: boolean) => void;
|
onSelectModel: (model: any, evaluate?: boolean) => void;
|
||||||
displayEvaluateStatus?: (show?: boolean) => void;
|
displayEvaluateStatus?: (data: {
|
||||||
|
show?: boolean;
|
||||||
|
flag: Record<string, boolean>;
|
||||||
|
}) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SearchModel: React.FC<SearchInputProps> = (props) => {
|
const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||||
@@ -258,7 +261,12 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
const currentItem = resultList.find(
|
const currentItem = resultList.find(
|
||||||
(item) => item.id === currentRef.current
|
(item) => item.id === currentRef.current
|
||||||
);
|
);
|
||||||
displayEvaluateStatus?.(false);
|
displayEvaluateStatus?.({
|
||||||
|
show: false,
|
||||||
|
flag: {
|
||||||
|
model: false
|
||||||
|
}
|
||||||
|
});
|
||||||
if (currentItem) {
|
if (currentItem) {
|
||||||
handleOnSelectModel(currentItem, true);
|
handleOnSelectModel(currentItem, true);
|
||||||
}
|
}
|
||||||
@@ -284,7 +292,12 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
return { ...pre };
|
return { ...pre };
|
||||||
});
|
});
|
||||||
setLoadingModel?.(true);
|
setLoadingModel?.(true);
|
||||||
displayEvaluateStatus?.(true);
|
displayEvaluateStatus?.({
|
||||||
|
show: true,
|
||||||
|
flag: {
|
||||||
|
model: true
|
||||||
|
}
|
||||||
|
});
|
||||||
cacheRepoOptions.current = [];
|
cacheRepoOptions.current = [];
|
||||||
let list: any[] = [];
|
let list: any[] = [];
|
||||||
if (modelSource === modelSourceMap.huggingface_value) {
|
if (modelSource === modelSourceMap.huggingface_value) {
|
||||||
@@ -313,6 +326,12 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
networkError: error?.message === 'Failed to fetch'
|
networkError: error?.message === 'Failed to fetch'
|
||||||
});
|
});
|
||||||
setLoadingModel?.(false);
|
setLoadingModel?.(false);
|
||||||
|
displayEvaluateStatus?.({
|
||||||
|
show: false,
|
||||||
|
flag: {
|
||||||
|
model: false
|
||||||
|
}
|
||||||
|
});
|
||||||
handleOnSelectModel({});
|
handleOnSelectModel({});
|
||||||
cacheRepoOptions.current = [];
|
cacheRepoOptions.current = [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user