fix: filter non-normal gguf files

This commit is contained in:
jialin
2025-08-14 11:03:55 +08:00
parent ccfdb99348
commit d6dce4021d
12 changed files with 107 additions and 51 deletions
@@ -161,6 +161,11 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
return filterRegGGUF.test(file.path) || _.includes(file.path, '.gguf');
};
const isNormalGGUFModelFile = (filename: string) => {
const file = filename?.toLowerCase() ?? '';
return file.indexOf('mmproj') === -1 && file.indexOf('imatrix') === -1;
};
// hugging face files
const getHuggingfaceFiles = async () => {
try {
@@ -175,7 +180,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
});
const list = _.filter(fileList, (file: any) => {
return hfFileFilter(file) && file.path.indexOf('mmproj') === -1;
return hfFileFilter(file) && isNormalGGUFModelFile(file.path);
});
return list;
@@ -188,7 +193,7 @@ const HFModelFile: React.FC<HFModelFileProps> = forwardRef((props, ref) => {
return (
filterRegGGUF.test(file.Path) &&
file.Type === 'blob' &&
file.Path.indexOf('mmproj') === -1
isNormalGGUFModelFile(file.Path)
);
};