chore: add model file ux

This commit is contained in:
jialin
2025-03-25 12:33:29 +08:00
parent 05ef2b8eaa
commit dca7a6f270
26 changed files with 1160 additions and 330 deletions
+23 -1
View File
@@ -143,7 +143,29 @@ export const useGenerateModelFileOptions = () => {
Object.entries(worker).filter(([key]) => workerFields.has(key))
)
}));
return result;
// extract a list from the result, and the structure is like:
// [
// {
// label: 'worker_name/child_label',
// value: 'child_value',
// ...other child properties
// }
// ]
const childrenList = result.reduce((acc: any[], cur) => {
if (cur.children) {
const list = cur.children.map((child: any) => ({
...child,
label: `${cur.label}${child.label}`,
value: child.value
}));
acc.push(...list);
}
return acc;
}, []);
return childrenList;
// return result;
};
return {