fix: do not close loading when evaluating
This commit is contained in:
@@ -102,6 +102,11 @@ 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 setIsHolderRef = (flag?: boolean) => {
|
||||
isHolderRef.current = flag || false;
|
||||
};
|
||||
|
||||
const getDefaultSpec = (item: any) => {
|
||||
const defaultSpec = item.evaluateResult?.default_spec || {};
|
||||
@@ -139,7 +144,9 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
setIsGGUF(false);
|
||||
form.current?.form?.resetFields(resetFields);
|
||||
const modelInfo = onSelectModel(item, props.source);
|
||||
handleShowCompatibleAlert(item.evaluateResult);
|
||||
if (!isHolderRef.current) {
|
||||
handleShowCompatibleAlert(item.evaluateResult);
|
||||
}
|
||||
form.current?.setFieldsValue?.({
|
||||
...getDefaultSpec(item),
|
||||
...modelInfo,
|
||||
@@ -239,9 +246,10 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
return warningStatus.show && warningStatus.type !== 'success';
|
||||
}, [warningStatus.show, warningStatus.type]);
|
||||
|
||||
const displayEvaluateStatus = () => {
|
||||
const displayEvaluateStatus = (show?: boolean) => {
|
||||
setIsHolderRef(show);
|
||||
setWarningStatus({
|
||||
show: true,
|
||||
show: show || false,
|
||||
title: '',
|
||||
type: 'transition',
|
||||
message: intl.formatMessage({ id: 'models.form.evaluating' })
|
||||
|
||||
@@ -264,6 +264,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
||||
resultList,
|
||||
(item: any) => item.path === currentPathRef.current
|
||||
);
|
||||
displayEvaluateStatus?.(false);
|
||||
if (currentItem) {
|
||||
handleSelectModelFile(currentItem, true);
|
||||
}
|
||||
|
||||
@@ -239,7 +239,6 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
};
|
||||
});
|
||||
setIsEvaluating(true);
|
||||
displayEvaluateStatus?.(true);
|
||||
const evaluations = await getEvaluateResults(repoList);
|
||||
const resultList = list.map((item, index) => {
|
||||
return {
|
||||
@@ -248,6 +247,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
};
|
||||
});
|
||||
setIsEvaluating(false);
|
||||
|
||||
setDataSource((pre) => {
|
||||
return {
|
||||
...pre,
|
||||
@@ -258,6 +258,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
const currentItem = resultList.find(
|
||||
(item) => item.id === currentRef.current
|
||||
);
|
||||
displayEvaluateStatus?.(false);
|
||||
if (currentItem) {
|
||||
handleOnSelectModel(currentItem, true);
|
||||
}
|
||||
@@ -283,6 +284,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
||||
return { ...pre };
|
||||
});
|
||||
setLoadingModel?.(true);
|
||||
displayEvaluateStatus?.(true);
|
||||
cacheRepoOptions.current = [];
|
||||
let list: any[] = [];
|
||||
if (modelSource === modelSourceMap.huggingface_value) {
|
||||
|
||||
Reference in New Issue
Block a user