fix: model and file evaluate over close loading

This commit is contained in:
jialin
2025-04-24 21:15:42 +08:00
parent d4ffd8e8e4
commit c400003ce9
4 changed files with 82 additions and 14 deletions
@@ -140,6 +140,13 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
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;
}, [backend]);
+25 -8
View File
@@ -102,10 +102,19 @@ const AddModal: FC<AddModalProps> = (props) => {
const [collapsed, setCollapsed] = useState<boolean>(false);
const [isGGUF, setIsGGUF] = useState<boolean>(false);
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) => {
isHolderRef.current = flag || false;
const setIsHolderRef = (flag: Record<string, boolean>) => {
isHolderRef.current = {
...isHolderRef.current,
...flag
};
};
const getDefaultSpec = (item: any) => {
@@ -133,7 +142,11 @@ const AddModal: FC<AddModalProps> = (props) => {
categories: getCategory(item)
});
if (item.fakeName) {
if (
item.fakeName &&
!isHolderRef.current.model &&
!isHolderRef.current.file
) {
handleShowCompatibleAlert(item.evaluateResult);
}
};
@@ -144,7 +157,8 @@ const AddModal: FC<AddModalProps> = (props) => {
setIsGGUF(false);
form.current?.form?.resetFields(resetFields);
const modelInfo = onSelectModel(item, props.source);
if (!isHolderRef.current) {
console.log('isholderRef', isHolderRef.current);
if (!isHolderRef.current.model && !isHolderRef.current.file) {
handleShowCompatibleAlert(item.evaluateResult);
}
form.current?.setFieldsValue?.({
@@ -246,10 +260,13 @@ const AddModal: FC<AddModalProps> = (props) => {
return warningStatus.show && warningStatus.type !== 'success';
}, [warningStatus.show, warningStatus.type]);
const displayEvaluateStatus = (show?: boolean) => {
setIsHolderRef(show);
const displayEvaluateStatus = (data: {
show?: boolean;
flag: Record<string, boolean>;
}) => {
setIsHolderRef(data.flag);
setWarningStatus({
show: show || false,
show: isHolderRef.current.model || isHolderRef.current.file,
title: '',
type: 'transition',
message: intl.formatMessage({ id: 'models.form.evaluating' })
@@ -41,7 +41,10 @@ interface HFModelFileProps {
ref: any;
gpuOptions?: any[];
onSelectFile?: (file: any, evaluate?: boolean) => void;
displayEvaluateStatus?: (show?: boolean) => void;
displayEvaluateStatus?: (data: {
show?: boolean;
flag: Record<string, boolean>;
}) => void;
}
const pattern = /^(.*)-(\d+)-of-(\d+)\.(.*)$/;
@@ -251,7 +254,6 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
});
setIsEvaluating(true);
displayEvaluateStatus?.(true);
const evaluationList = await getEvaluateResults(evaluateFileList);
const resultList = _.map(list, (item: any, index: number) => {
@@ -264,7 +266,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
resultList,
(item: any) => item.path === currentPathRef.current
);
displayEvaluateStatus?.(false);
displayEvaluateStatus?.({
show: false,
flag: {
file: false
}
});
if (currentItem) {
handleSelectModelFile(currentItem, true);
}
@@ -272,6 +279,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
setIsEvaluating(false);
} catch (error) {
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 = new AbortController();
setDataSource({ ...dataSource, loading: true });
displayEvaluateStatus?.({
show: true,
flag: {
file: true
}
});
setCurrent('');
try {
let list = [];
@@ -306,6 +325,12 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
} catch (error) {
setDataSource({ fileList: [], loading: false });
handleSelectModelFile({});
displayEvaluateStatus?.({
show: false,
flag: {
file: false
}
});
}
};
+22 -3
View File
@@ -43,7 +43,10 @@ interface SearchInputProps {
setLoadingModel?: (flag: boolean) => void;
onSourceChange?: (source: string) => 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) => {
@@ -258,7 +261,12 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
const currentItem = resultList.find(
(item) => item.id === currentRef.current
);
displayEvaluateStatus?.(false);
displayEvaluateStatus?.({
show: false,
flag: {
model: false
}
});
if (currentItem) {
handleOnSelectModel(currentItem, true);
}
@@ -284,7 +292,12 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
return { ...pre };
});
setLoadingModel?.(true);
displayEvaluateStatus?.(true);
displayEvaluateStatus?.({
show: true,
flag: {
model: true
}
});
cacheRepoOptions.current = [];
let list: any[] = [];
if (modelSource === modelSourceMap.huggingface_value) {
@@ -313,6 +326,12 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
networkError: error?.message === 'Failed to fetch'
});
setLoadingModel?.(false);
displayEvaluateStatus?.({
show: false,
flag: {
model: false
}
});
handleOnSelectModel({});
cacheRepoOptions.current = [];
}