chore: filter gguf files when importing model on windows (#2653)

Co-authored-by: Louis <louis@jan.ai>
This commit is contained in:
NamH 2024-04-09 10:36:01 +07:00 committed by GitHub
parent d5c4f745f1
commit c0c038f4f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,13 @@ export type SelectFileOption = {
selectDirectory?: boolean
props?: SelectFileProp[]
filters?: FilterOption[]
}
export type FilterOption = {
name: string
extensions: string[]
}
export const SelectFilePropTuple = [

View File

@ -112,6 +112,7 @@ export function handleAppIPCs() {
title,
buttonLabel,
properties: props,
filters: option?.filters,
})
if (canceled) return

View File

@ -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