mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-21 23:21:04 +08:00
Feat: Adapted for the upgraded knowledge graph of @antv/g6. (#14103)
### What problem does this PR solve? Feat: Adapted for the upgraded knowledge graph of @antv/g6. ### Type of change - [x] Refactoring
This commit is contained in:
@@ -10,14 +10,16 @@ export function groupListByType<T extends Record<string, any>>(
|
||||
labelField: string,
|
||||
) {
|
||||
const fileTypeList: FilterType[] = [];
|
||||
list.forEach((x) => {
|
||||
const item = fileTypeList.find((y) => y.id === x[idField]);
|
||||
if (!item) {
|
||||
fileTypeList.push({ id: x[idField], label: x[labelField], count: 1 });
|
||||
} else {
|
||||
item.count += 1;
|
||||
}
|
||||
});
|
||||
if (Array.isArray(list)) {
|
||||
list.forEach((x) => {
|
||||
const item = fileTypeList.find((y) => y.id === x[idField]);
|
||||
if (!item) {
|
||||
fileTypeList.push({ id: x[idField], label: x[labelField], count: 1 });
|
||||
} else {
|
||||
item.count += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return fileTypeList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user