feat: 文件对话框全部改用 Electron 原生对话框

- input-area.ts: 图片/文件上传改用 dialog.showOpenDialog(通过 IPC)
- settings-modal.ts: 导入改用原生打开对话框,导出改用原生保存对话框
- kb-modal.ts: 知识库文档上传改用原生打开对话框
- ipc.ts/preload.ts/types.d.ts: writeFile 增加 encoding 参数支持二进制写入
- index.html: 移除 4 个无用的 <input type="file"> 元素
- 清理死代码: fileToBase64, fileToText, isMetonaFile
This commit is contained in:
thzxx
2026-04-07 01:33:51 +08:00
parent 58ef272061
commit 02d5ff19c7
9 changed files with 167 additions and 122 deletions
+2 -2
View File
@@ -46,9 +46,9 @@ export function setupIPC(): void {
}
});
ipcMain.handle('fs:writeFile', async (_, filePath: string, content: string) => {
ipcMain.handle('fs:writeFile', async (_, filePath: string, content: string, encoding?: string) => {
try {
await fs.promises.writeFile(filePath, content, 'utf-8');
await fs.promises.writeFile(filePath, content, (encoding as BufferEncoding) || 'utf-8');
return { success: true };
} catch (err) {
return { success: false, error: (err as Error).message };