fix: do nothing when clicking the selected model or file
This commit is contained in:
@@ -291,9 +291,6 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
const handleOnSelectModel = async (item: any, manual?: boolean) => {
|
const handleOnSelectModel = async (item: any, manual?: boolean) => {
|
||||||
// If the item is empty or the same as the selected model, do nothing
|
// If the item is empty or the same as the selected model, do nothing
|
||||||
|
|
||||||
if (currentModelDuringEvaluate(item)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
handleCancelFiles();
|
handleCancelFiles();
|
||||||
if (
|
if (
|
||||||
_.isEmpty(item) ||
|
_.isEmpty(item) ||
|
||||||
|
|||||||
@@ -97,6 +97,13 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
currentPathRef.current = item.path;
|
currentPathRef.current = item.path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSelectModelFileManually = (data: any) => {
|
||||||
|
if (data.path === currentPathRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handleSelectModelFile(data, true);
|
||||||
|
};
|
||||||
|
|
||||||
const parseFilename = (filename: string) => {
|
const parseFilename = (filename: string) => {
|
||||||
const match = filename.match(pattern);
|
const match = filename.match(pattern);
|
||||||
|
|
||||||
@@ -403,9 +410,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
|
|||||||
data={item}
|
data={item}
|
||||||
isEvaluating={isEvaluating}
|
isEvaluating={isEvaluating}
|
||||||
active={item.path === current}
|
active={item.path === current}
|
||||||
handleSelectModelFile={(data) =>
|
handleSelectModelFile={handleSelectModelFileManually}
|
||||||
handleSelectModelFile(data, true)
|
|
||||||
}
|
|
||||||
></ModelFileItem>
|
></ModelFileItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -496,6 +496,9 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSelectModelManually = (model: any) => {
|
const handleSelectModelManually = (model: any) => {
|
||||||
|
if (model.id === currentRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
handleOnSelectModel(model, true);
|
handleOnSelectModel(model, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user