* 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>
33 lines
902 B
TypeScript
33 lines
902 B
TypeScript
import { ipcMain } from 'electron'
|
|
|
|
import { FileSystemRoute } from '@janhq/core'
|
|
import { userSpacePath } from '../utils/path'
|
|
import { join } from 'path'
|
|
/**
|
|
* Handles file system operations.
|
|
*/
|
|
export function handleFsIPCs() {
|
|
const moduleName = 'fs'
|
|
Object.values(FileSystemRoute).forEach((route) => {
|
|
ipcMain.handle(route, async (event, ...args) => {
|
|
return import(moduleName).then((mdl) =>
|
|
mdl[route](
|
|
...args.map((arg) =>
|
|
typeof arg === 'string' &&
|
|
(arg.includes(`file:/`) || arg.includes(`file:\\`))
|
|
? join(
|
|
userSpacePath,
|
|
arg
|
|
.replace(`file://`, '')
|
|
.replace(`file:/`, '')
|
|
.replace(`file:\\\\`, '')
|
|
.replace(`file:\\`, '')
|
|
)
|
|
: arg
|
|
)
|
|
)
|
|
)
|
|
})
|
|
})
|
|
}
|