chore: remove rmdirsync from core api since it is deprecated (#2459)
* chore: remove rmdirsync from core api since it is deprecated Signed-off-by: James <james@jan.ai> * chore: remove mkdirsync Signed-off-by: James <james@jan.ai> --------- Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai>
This commit is contained in:
parent
3c0383f6d8
commit
67e285fa96
@ -82,9 +82,9 @@ export enum FileSystemRoute {
|
|||||||
unlinkSync = 'unlinkSync',
|
unlinkSync = 'unlinkSync',
|
||||||
existsSync = 'existsSync',
|
existsSync = 'existsSync',
|
||||||
readdirSync = 'readdirSync',
|
readdirSync = 'readdirSync',
|
||||||
mkdirSync = 'mkdirSync',
|
rm = 'rm',
|
||||||
|
mkdir = 'mkdir',
|
||||||
readFileSync = 'readFileSync',
|
readFileSync = 'readFileSync',
|
||||||
rmdirSync = 'rmdirSync',
|
|
||||||
writeFileSync = 'writeFileSync',
|
writeFileSync = 'writeFileSync',
|
||||||
}
|
}
|
||||||
export enum FileManagerRoute {
|
export enum FileManagerRoute {
|
||||||
@ -95,8 +95,6 @@ export enum FileManagerRoute {
|
|||||||
getUserHomePath = 'getUserHomePath',
|
getUserHomePath = 'getUserHomePath',
|
||||||
fileStat = 'fileStat',
|
fileStat = 'fileStat',
|
||||||
writeBlob = 'writeBlob',
|
writeBlob = 'writeBlob',
|
||||||
mkdir = 'mkdir',
|
|
||||||
rm = 'rm',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ApiFunction = (...args: any[]) => any
|
export type ApiFunction = (...args: any[]) => any
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export abstract class AIEngine extends BaseExtension {
|
|||||||
// Attempt to create the model folder
|
// Attempt to create the model folder
|
||||||
joinPath([janDataFolder, this.modelFolder, model.id]).then((path) =>
|
joinPath([janDataFolder, this.modelFolder, model.id]).then((path) =>
|
||||||
fs
|
fs
|
||||||
.mkdirSync(path)
|
.mkdir(path)
|
||||||
.catch()
|
.catch()
|
||||||
.then(() => path)
|
.then(() => path)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -35,18 +35,13 @@ const readdirSync = (...args: any[]) => globalThis.core.api?.readdirSync(...args
|
|||||||
* Creates a directory at the specified path.
|
* Creates a directory at the specified path.
|
||||||
* @returns {Promise<any>} A Promise that resolves when the directory is created successfully.
|
* @returns {Promise<any>} A Promise that resolves when the directory is created successfully.
|
||||||
*/
|
*/
|
||||||
const mkdirSync = (...args: any[]) => globalThis.core.api?.mkdirSync(...args)
|
|
||||||
|
|
||||||
const mkdir = (...args: any[]) => globalThis.core.api?.mkdir(...args)
|
const mkdir = (...args: any[]) => globalThis.core.api?.mkdir(...args)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a directory at the specified path.
|
* Removes a directory at the specified path.
|
||||||
* @returns {Promise<any>} A Promise that resolves when the directory is removed successfully.
|
* @returns {Promise<any>} A Promise that resolves when the directory is removed successfully.
|
||||||
*/
|
*/
|
||||||
const rmdirSync = (...args: any[]) =>
|
const rm = (...args: any[]) => globalThis.core.api?.rm(...args, { recursive: true, force: true })
|
||||||
globalThis.core.api?.rmdirSync(...args, { recursive: true, force: true })
|
|
||||||
|
|
||||||
const rm = (path: string) => globalThis.core.api?.rm(path)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a file from the local file system.
|
* Deletes a file from the local file system.
|
||||||
@ -96,9 +91,7 @@ export const fs = {
|
|||||||
readFileSync,
|
readFileSync,
|
||||||
existsSync,
|
existsSync,
|
||||||
readdirSync,
|
readdirSync,
|
||||||
mkdirSync,
|
|
||||||
mkdir,
|
mkdir,
|
||||||
rmdirSync,
|
|
||||||
rm,
|
rm,
|
||||||
unlinkSync,
|
unlinkSync,
|
||||||
appendFileSync,
|
appendFileSync,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { join } from 'path'
|
|||||||
import { normalizeFilePath } from '../../helper/path'
|
import { normalizeFilePath } from '../../helper/path'
|
||||||
import { getJanDataFolderPath } from '../../helper'
|
import { getJanDataFolderPath } from '../../helper'
|
||||||
import { Processor } from './Processor'
|
import { Processor } from './Processor'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
export class FileSystem implements Processor {
|
export class FileSystem implements Processor {
|
||||||
observer?: Function
|
observer?: Function
|
||||||
@ -11,15 +12,65 @@ export class FileSystem implements Processor {
|
|||||||
this.observer = observer
|
this.observer = observer
|
||||||
}
|
}
|
||||||
|
|
||||||
process(route: string, ...args: any[]): any {
|
process(route: string, ...args: any): any {
|
||||||
|
const instance = this as any
|
||||||
|
const func = instance[route]
|
||||||
|
|
||||||
|
if (func) {
|
||||||
|
return func(...args)
|
||||||
|
} else {
|
||||||
return import(FileSystem.moduleName).then((mdl) =>
|
return import(FileSystem.moduleName).then((mdl) =>
|
||||||
mdl[route](
|
mdl[route](
|
||||||
...args.map((arg: any) =>
|
...args.map((arg: any) => {
|
||||||
typeof arg === 'string' && (arg.startsWith(`file:/`) || arg.startsWith(`file:\\`))
|
return typeof arg === 'string' &&
|
||||||
|
(arg.startsWith(`file:/`) || arg.startsWith(`file:\\`))
|
||||||
? join(getJanDataFolderPath(), normalizeFilePath(arg))
|
? join(getJanDataFolderPath(), normalizeFilePath(arg))
|
||||||
: arg
|
: arg
|
||||||
)
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rm(...args: any): Promise<void> {
|
||||||
|
if (typeof args[0] !== 'string') {
|
||||||
|
throw new Error(`rm error: Invalid argument ${JSON.stringify(args)}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
let path = args[0]
|
||||||
|
if (path.startsWith(`file:/`) || path.startsWith(`file:\\`)) {
|
||||||
|
path = join(getJanDataFolderPath(), normalizeFilePath(path))
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fs.rm(path, { recursive: true, force: true }, (err) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
|
} else {
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir(...args: any): Promise<void> {
|
||||||
|
if (typeof args[0] !== 'string') {
|
||||||
|
throw new Error(`mkdir error: Invalid argument ${JSON.stringify(args)}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
let path = args[0]
|
||||||
|
if (path.startsWith(`file:/`) || path.startsWith(`file:\\`)) {
|
||||||
|
path = join(getJanDataFolderPath(), normalizeFilePath(path))
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fs.mkdir(path, { recursive: true }, (err) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err)
|
||||||
|
} else {
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,28 +88,4 @@ export class FSExt implements Processor {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir(path: string): Promise<void> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
fs.mkdir(path, { recursive: true }, (err) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
} else {
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
rm(path: string): Promise<void> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
fs.rm(path, { recursive: true }, (err) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
} else {
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,7 +182,7 @@ export default class Extension {
|
|||||||
async uninstall(): Promise<void> {
|
async uninstall(): Promise<void> {
|
||||||
const path = ExtensionManager.instance.getExtensionsPath()
|
const path = ExtensionManager.instance.getExtensionsPath()
|
||||||
const extPath = resolve(path ?? '', this.name ?? '')
|
const extPath = resolve(path ?? '', this.name ?? '')
|
||||||
await rmdirSync(extPath, { recursive: true })
|
rmdirSync(extPath, { recursive: true })
|
||||||
|
|
||||||
this.emitUpdate()
|
this.emitUpdate()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export default class JanAssistantExtension extends AssistantExtension {
|
|||||||
localStorage.getItem(`${EXTENSION_NAME}-version`) !== VERSION ||
|
localStorage.getItem(`${EXTENSION_NAME}-version`) !== VERSION ||
|
||||||
!assistantDirExist
|
!assistantDirExist
|
||||||
) {
|
) {
|
||||||
if (!assistantDirExist) await fs.mkdirSync(JanAssistantExtension._homeDir)
|
if (!assistantDirExist) await fs.mkdir(JanAssistantExtension._homeDir)
|
||||||
|
|
||||||
// Write assistant metadata
|
// Write assistant metadata
|
||||||
await this.createJanAssistant()
|
await this.createJanAssistant()
|
||||||
@ -184,7 +184,7 @@ export default class JanAssistantExtension extends AssistantExtension {
|
|||||||
JanAssistantExtension._homeDir,
|
JanAssistantExtension._homeDir,
|
||||||
assistant.id,
|
assistant.id,
|
||||||
])
|
])
|
||||||
if (!(await fs.existsSync(assistantDir))) await fs.mkdirSync(assistantDir)
|
if (!(await fs.existsSync(assistantDir))) await fs.mkdir(assistantDir)
|
||||||
|
|
||||||
// store the assistant metadata json
|
// store the assistant metadata json
|
||||||
const assistantMetadataPath = await joinPath([
|
const assistantMetadataPath = await joinPath([
|
||||||
@ -247,8 +247,7 @@ export default class JanAssistantExtension extends AssistantExtension {
|
|||||||
JanAssistantExtension._homeDir,
|
JanAssistantExtension._homeDir,
|
||||||
assistant.id,
|
assistant.id,
|
||||||
])
|
])
|
||||||
await fs.rmdirSync(assistantDir)
|
return fs.rm(assistantDir)
|
||||||
return Promise.resolve()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createJanAssistant(): Promise<void> {
|
private async createJanAssistant(): Promise<void> {
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import {
|
|||||||
ConversationalExtension,
|
ConversationalExtension,
|
||||||
Thread,
|
Thread,
|
||||||
ThreadMessage,
|
ThreadMessage,
|
||||||
events,
|
|
||||||
} from '@janhq/core'
|
} from '@janhq/core'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +20,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
*/
|
*/
|
||||||
async onLoad() {
|
async onLoad() {
|
||||||
if (!(await fs.existsSync(JSONConversationalExtension._threadFolder))) {
|
if (!(await fs.existsSync(JSONConversationalExtension._threadFolder))) {
|
||||||
await fs.mkdirSync(JSONConversationalExtension._threadFolder)
|
await fs.mkdir(JSONConversationalExtension._threadFolder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +75,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
JSONConversationalExtension._threadInfoFileName,
|
JSONConversationalExtension._threadInfoFileName,
|
||||||
])
|
])
|
||||||
if (!(await fs.existsSync(threadDirPath))) {
|
if (!(await fs.existsSync(threadDirPath))) {
|
||||||
await fs.mkdirSync(threadDirPath)
|
await fs.mkdir(threadDirPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
await fs.writeFileSync(threadJsonPath, JSON.stringify(thread, null, 2))
|
await fs.writeFileSync(threadJsonPath, JSON.stringify(thread, null, 2))
|
||||||
@ -96,11 +95,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
`${threadId}`,
|
`${threadId}`,
|
||||||
])
|
])
|
||||||
try {
|
try {
|
||||||
if (await fs.existsSync(path)) {
|
await fs.rm(path)
|
||||||
await fs.rmdirSync(path, { recursive: true })
|
|
||||||
} else {
|
|
||||||
console.debug(`${path} does not exist`)
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
@ -117,11 +112,11 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
JSONConversationalExtension._threadMessagesFileName,
|
JSONConversationalExtension._threadMessagesFileName,
|
||||||
])
|
])
|
||||||
if (!(await fs.existsSync(threadDirPath)))
|
if (!(await fs.existsSync(threadDirPath)))
|
||||||
await fs.mkdirSync(threadDirPath)
|
await fs.mkdir(threadDirPath)
|
||||||
|
|
||||||
if (message.content[0]?.type === 'image') {
|
if (message.content[0]?.type === 'image') {
|
||||||
const filesPath = await joinPath([threadDirPath, 'files'])
|
const filesPath = await joinPath([threadDirPath, 'files'])
|
||||||
if (!(await fs.existsSync(filesPath))) await fs.mkdirSync(filesPath)
|
if (!(await fs.existsSync(filesPath))) await fs.mkdir(filesPath)
|
||||||
|
|
||||||
const imagePath = await joinPath([filesPath, `${message.id}.png`])
|
const imagePath = await joinPath([filesPath, `${message.id}.png`])
|
||||||
const base64 = message.content[0].text.annotations[0]
|
const base64 = message.content[0].text.annotations[0]
|
||||||
@ -134,7 +129,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
|
|
||||||
if (message.content[0]?.type === 'pdf') {
|
if (message.content[0]?.type === 'pdf') {
|
||||||
const filesPath = await joinPath([threadDirPath, 'files'])
|
const filesPath = await joinPath([threadDirPath, 'files'])
|
||||||
if (!(await fs.existsSync(filesPath))) await fs.mkdirSync(filesPath)
|
if (!(await fs.existsSync(filesPath))) await fs.mkdir(filesPath)
|
||||||
|
|
||||||
const filePath = await joinPath([filesPath, `${message.id}.pdf`])
|
const filePath = await joinPath([filesPath, `${message.id}.pdf`])
|
||||||
const blob = message.content[0].text.annotations[0]
|
const blob = message.content[0].text.annotations[0]
|
||||||
@ -184,8 +179,7 @@ export default class JSONConversationalExtension extends ConversationalExtension
|
|||||||
threadDirPath,
|
threadDirPath,
|
||||||
JSONConversationalExtension._threadMessagesFileName,
|
JSONConversationalExtension._threadMessagesFileName,
|
||||||
])
|
])
|
||||||
if (!(await fs.existsSync(threadDirPath)))
|
if (!(await fs.existsSync(threadDirPath))) await fs.mkdir(threadDirPath)
|
||||||
await fs.mkdirSync(threadDirPath)
|
|
||||||
await fs.writeFileSync(
|
await fs.writeFileSync(
|
||||||
threadMessagePath,
|
threadMessagePath,
|
||||||
messages.map((msg) => JSON.stringify(msg)).join('\n') +
|
messages.map((msg) => JSON.stringify(msg)).join('\n') +
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import {
|
|||||||
log,
|
log,
|
||||||
DownloadRequest,
|
DownloadRequest,
|
||||||
} from '@janhq/core'
|
} from '@janhq/core'
|
||||||
import { ggufMetadata } from 'hyllama'
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
@ -138,7 +137,7 @@ export default class JanHuggingFaceExtension extends HuggingFaceExtension {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (this.interrupted) return
|
if (this.interrupted) return
|
||||||
const modelDirPath = await this.getModelDirPath(repoID)
|
const modelDirPath = await this.getModelDirPath(repoID)
|
||||||
if (!(await fs.existsSync(modelDirPath))) await fs.mkdirSync(modelDirPath)
|
if (!(await fs.existsSync(modelDirPath))) await fs.mkdir(modelDirPath)
|
||||||
const files = this.getFileList(repoData)
|
const files = this.getFileList(repoData)
|
||||||
const filePaths: string[] = []
|
const filePaths: string[] = []
|
||||||
|
|
||||||
@ -394,7 +393,6 @@ export default class JanHuggingFaceExtension extends HuggingFaceExtension {
|
|||||||
const localPath = await joinPath([modelDirPath, filePath])
|
const localPath = await joinPath([modelDirPath, filePath])
|
||||||
await abortDownload(localPath)
|
await abortDownload(localPath)
|
||||||
}
|
}
|
||||||
// ;(await fs.existsSync(modelDirPath)) && (await fs.rmdirSync(modelDirPath))
|
|
||||||
|
|
||||||
executeOnMain(NODE_MODULE_PATH, 'killProcesses')
|
executeOnMain(NODE_MODULE_PATH, 'killProcesses')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ export default class JanInferenceGroqExtension extends RemoteOAIEngine {
|
|||||||
super.onLoad()
|
super.onLoad()
|
||||||
|
|
||||||
if (!(await fs.existsSync(this._engineDir))) {
|
if (!(await fs.existsSync(this._engineDir))) {
|
||||||
await fs.mkdirSync(this._engineDir).catch((err) => console.debug(err))
|
await fs.mkdir(this._engineDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writeDefaultEngineSettings()
|
this.writeDefaultEngineSettings()
|
||||||
|
|||||||
@ -45,9 +45,7 @@ export default class JanInferenceOpenAIExtension extends RemoteOAIEngine {
|
|||||||
super.onLoad()
|
super.onLoad()
|
||||||
|
|
||||||
if (!(await fs.existsSync(JanInferenceOpenAIExtension._engineDir))) {
|
if (!(await fs.existsSync(JanInferenceOpenAIExtension._engineDir))) {
|
||||||
await fs
|
await fs.mkdir(JanInferenceOpenAIExtension._engineDir)
|
||||||
.mkdirSync(JanInferenceOpenAIExtension._engineDir)
|
|
||||||
.catch((err) => console.debug(err))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writeDefaultEngineSettings()
|
this.writeDefaultEngineSettings()
|
||||||
|
|||||||
@ -40,7 +40,7 @@ export default class JanInferenceTritonTrtLLMExtension extends RemoteOAIEngine {
|
|||||||
async onLoad() {
|
async onLoad() {
|
||||||
super.onLoad()
|
super.onLoad()
|
||||||
if (!(await fs.existsSync(this._engineDir))) {
|
if (!(await fs.existsSync(this._engineDir))) {
|
||||||
await fs.mkdirSync(this._engineDir).catch((err) => console.debug(err))
|
await fs.mkdir(this._engineDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writeDefaultEngineSettings()
|
this.writeDefaultEngineSettings()
|
||||||
|
|||||||
@ -100,7 +100,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// create corresponding directory
|
// create corresponding directory
|
||||||
const modelDirPath = await joinPath([JanModelExtension._homeDir, model.id])
|
const modelDirPath = await joinPath([JanModelExtension._homeDir, model.id])
|
||||||
if (!(await fs.existsSync(modelDirPath))) await fs.mkdirSync(modelDirPath)
|
if (!(await fs.existsSync(modelDirPath))) await fs.mkdir(modelDirPath)
|
||||||
|
|
||||||
if (model.engine === InferenceEngine.nitro_tensorrt_llm) {
|
if (model.engine === InferenceEngine.nitro_tensorrt_llm) {
|
||||||
if (!gpuSettings || gpuSettings.gpus.length === 0) {
|
if (!gpuSettings || gpuSettings.gpus.length === 0) {
|
||||||
@ -249,7 +249,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
modelInfo.metadata?.author?.toLowerCase() === 'user'
|
modelInfo.metadata?.author?.toLowerCase() === 'user'
|
||||||
if (isUserImportModel) {
|
if (isUserImportModel) {
|
||||||
// just delete the folder
|
// just delete the folder
|
||||||
return fs.rmdirSync(dirPath)
|
return fs.rm(dirPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove all files under dirPath except model.json
|
// remove all files under dirPath except model.json
|
||||||
@ -630,7 +630,7 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const modelFolderPath = await this.getModelFolderName(modelFolderName)
|
const modelFolderPath = await this.getModelFolderName(modelFolderName)
|
||||||
await fs.mkdirSync(modelFolderPath)
|
await fs.mkdir(modelFolderPath)
|
||||||
|
|
||||||
const uniqueFolderName = await baseName(modelFolderPath)
|
const uniqueFolderName = await baseName(modelFolderPath)
|
||||||
const modelBinaryFile = binaryName.endsWith(
|
const modelBinaryFile = binaryName.endsWith(
|
||||||
|
|||||||
@ -151,10 +151,11 @@ export default class TensorRTLLMExtension extends LocalOAIEngine {
|
|||||||
|
|
||||||
for (const model of models) {
|
for (const model of models) {
|
||||||
const modelPath = await joinPath([modelFolderPath, model.id])
|
const modelPath = await joinPath([modelFolderPath, model.id])
|
||||||
console.debug(`modelPath: ${modelPath}`)
|
|
||||||
if (await fs.existsSync(modelPath)) {
|
try {
|
||||||
console.debug(`Removing model ${modelPath}`)
|
await fs.rm(modelPath)
|
||||||
await fs.rmdirSync(modelPath)
|
} catch (err) {
|
||||||
|
console.error(`Error removing model ${modelPath}`, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
events.emit(ModelEvent.OnModelsUpdate, {})
|
events.emit(ModelEvent.OnModelsUpdate, {})
|
||||||
|
|||||||
@ -138,9 +138,12 @@ const Advanced = () => {
|
|||||||
}, [readSettings, setGpuList, setGpuEnabled, setGpusInUse, setVulkanEnabled])
|
}, [readSettings, setGpuList, setGpuEnabled, setGpusInUse, setVulkanEnabled])
|
||||||
|
|
||||||
const clearLogs = async () => {
|
const clearLogs = async () => {
|
||||||
if (await fs.existsSync(`file://logs`)) {
|
try {
|
||||||
await fs.rmdirSync(`file://logs`, { recursive: true })
|
await fs.rm(`file://logs`)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error clearing logs: ', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
toaster({
|
toaster({
|
||||||
title: 'Logs cleared',
|
title: 'Logs cleared',
|
||||||
description: 'All logs have been cleared.',
|
description: 'All logs have been cleared.',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user