diff --git a/core/src/types/miscellaneous/selectFiles.ts b/core/src/types/miscellaneous/selectFiles.ts index 3120be24e..5e4a95906 100644 --- a/core/src/types/miscellaneous/selectFiles.ts +++ b/core/src/types/miscellaneous/selectFiles.ts @@ -13,6 +13,13 @@ export type SelectFileOption = { selectDirectory?: boolean props?: SelectFileProp[] + + filters?: FilterOption[] +} + +export type FilterOption = { + name: string + extensions: string[] } export const SelectFilePropTuple = [ diff --git a/electron/handlers/native.ts b/electron/handlers/native.ts index 34bfeffa3..556b66e66 100644 --- a/electron/handlers/native.ts +++ b/electron/handlers/native.ts @@ -112,6 +112,7 @@ export function handleAppIPCs() { title, buttonLabel, properties: props, + filters: option?.filters, }) if (canceled) return diff --git a/web/screens/Settings/ChooseWhatToImportModal/index.tsx b/web/screens/Settings/ChooseWhatToImportModal/index.tsx index 8aa416992..60cbc817c 100644 --- a/web/screens/Settings/ChooseWhatToImportModal/index.tsx +++ b/web/screens/Settings/ChooseWhatToImportModal/index.tsx @@ -25,6 +25,10 @@ const ChooseWhatToImportModal: React.FC = () => { title: 'Select model files', buttonLabel: 'Select', allowMultiple: true, + filters: [ + { name: 'GGUF Files', extensions: ['gguf'] }, + { name: 'All Files', extensions: ['*'] }, + ], } const filePaths = await window.core?.api?.selectFiles(options) if (!filePaths || filePaths.length === 0) return