* Add js function to generate gpu and cuda detection * inference nitro manage via json file instead of bash and bat script * Add /usr/lib/x86_64-linux-gnu/ to linux check gpu * chore: add CPU - GPU toggle * correct file path * fix: exist file sync check * fix: get resources path * Fix error jan/engines create existed error * Seting sync to file * Fix error show notification for GPU * Set notify default to true --------- Co-authored-by: Hien To <tominhhien97@gmail.com> Co-authored-by: Louis <louis@jan.ai>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { ipcMain } from 'electron'
|
|
// @ts-ignore
|
|
import reflect from '@alumna/reflect'
|
|
|
|
import { FileManagerRoute } from '@janhq/core'
|
|
import { userSpacePath, getResourcePath } from './../utils/path'
|
|
|
|
/**
|
|
* Handles file system extensions operations.
|
|
*/
|
|
export function handleFileMangerIPCs() {
|
|
// Handles the 'synceFile' IPC event. This event is triggered to synchronize a file from a source path to a destination path.
|
|
ipcMain.handle(
|
|
FileManagerRoute.synceFile,
|
|
async (_event, src: string, dest: string) => {
|
|
return reflect({
|
|
src,
|
|
dest,
|
|
recursive: true,
|
|
delete: false,
|
|
overwrite: true,
|
|
errorOnExist: false,
|
|
})
|
|
}
|
|
)
|
|
|
|
// Handles the 'getUserSpace' IPC event. This event is triggered to get the user space path.
|
|
ipcMain.handle(
|
|
FileManagerRoute.getUserSpace,
|
|
(): Promise<string> => Promise.resolve(userSpacePath)
|
|
)
|
|
|
|
// Handles the 'getResourcePath' IPC event. This event is triggered to get the resource path.
|
|
ipcMain.handle(FileManagerRoute.getResourcePath, async (_event) => {
|
|
return getResourcePath()
|
|
})
|
|
}
|