fix: mixture files display error

This commit is contained in:
jialin
2024-09-06 19:58:36 +08:00
parent 7b999e6692
commit 5c372bbaa3
+26 -10
View File
@@ -69,17 +69,26 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
return !!parsed; return !!parsed;
}); });
// general file const generalFileList = _.filter(list, (item: any) => {
if (!data) { const parsed = parseFilename(item.path);
return _.map(list, (item: any) => { return !parsed;
item.fakeName = item.path; });
return item;
const newGeneralFileList = _.map(generalFileList, (item: any) => {
return {
...item,
fakeName: item.path
};
}); });
}
// shard file // shard file
const newList = _.map(list, (item: any) => { const shardFileList = _.filter(list, (item: any) => {
const parsed = parseFilename(item.path);
return !!parsed;
});
const newShardFileList = _.map(shardFileList, (item: any) => {
const parsed = parseFilename(item.path); const parsed = parseFilename(item.path);
return { return {
...item, ...item,
@@ -87,16 +96,21 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
}; };
}); });
const group = _.groupBy(newList, 'filename'); const group = _.groupBy(newShardFileList, 'filename');
return _.map(group, (value: any[], filename: string) => { const shardFileListResult = _.map(
group,
(value: any[], filename: string) => {
return { return {
path: filename, path: filename,
fakeName: `${filename}*.gguf`, fakeName: `${filename}*.gguf`,
size: _.sumBy(value, 'size'), size: _.sumBy(value, 'size'),
parts: value parts: value
}; };
}); }
);
return [...shardFileListResult, ...newGeneralFileList];
}, []); }, []);
const handleFetchModelFiles = async () => { const handleFetchModelFiles = async () => {
@@ -126,6 +140,8 @@ const HFModelFile: React.FC<HFModelFileProps> = (props) => {
const newList = generateGroupByFilename(list); const newList = generateGroupByFilename(list);
console.log('newList==========', newList);
const sortList = _.sortBy(newList, (item: any) => { const sortList = _.sortBy(newList, (item: any) => {
return sortType === 'size' ? item.size : item.path; return sortType === 'size' ? item.size : item.path;
}); });