refactor: remove unused Electron API check and update search space ID handling in document upload

This commit is contained in:
Anish Sarkar 2026-04-03 02:56:24 +05:30
parent e0b35cfbab
commit 530db10539
7 changed files with 100 additions and 101 deletions

View file

@ -475,23 +475,13 @@ export async function unregisterFolderWatcher(): Promise<void> {
watchers.clear();
}
export interface BrowseResult {
type: 'files' | 'folder';
paths: string[];
}
export async function browseFileOrFolder(): Promise<BrowseResult | null> {
export async function browseFiles(): Promise<string[] | null> {
const result = await dialog.showOpenDialog({
properties: ['openFile', 'openDirectory', 'multiSelections'],
title: 'Select files or a folder',
properties: ['openFile', 'multiSelections'],
title: 'Select files',
});
if (result.canceled || result.filePaths.length === 0) return null;
const stat = fs.statSync(result.filePaths[0]);
if (stat.isDirectory()) {
return { type: 'folder', paths: [result.filePaths[0]] };
}
return { type: 'files', paths: result.filePaths };
return result.filePaths;
}
const MIME_MAP: Record<string, string> = {