Skip to content

Commit

Permalink
chore: filter gguf files when importing model on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Apr 9, 2024
1 parent d5c4f74 commit 6bcf72e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/types/miscellaneous/selectFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 13,13 @@ export type SelectFileOption = {
selectDirectory?: boolean

props?: SelectFileProp[]

filters?: FilterOption[]
}

export type FilterOption = {
name: string
extensions: string[]
}

export const SelectFilePropTuple = [
Expand Down
1 change: 1 addition & 0 deletions electron/handlers/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 112,7 @@ export function handleAppIPCs() {
title,
buttonLabel,
properties: props,
filters: option?.filters,
})

if (canceled) return
Expand Down
4 changes: 4 additions & 0 deletions web/screens/Settings/ChooseWhatToImportModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6bcf72e

Please sign in to comment.