From 77f67703336ea94c1a04ceb28832fee4f1c4ade6 Mon Sep 17 00:00:00 2001 From: Thien Tran Date: Mon, 26 May 2025 18:51:56 +0800 Subject: [PATCH] update fileStat() --- extensions/llamacpp-extension/src/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/extensions/llamacpp-extension/src/index.ts b/extensions/llamacpp-extension/src/index.ts index c634e85a0..f421e8ad5 100644 --- a/extensions/llamacpp-extension/src/index.ts +++ b/extensions/llamacpp-extension/src/index.ts @@ -101,11 +101,11 @@ export default class llamacpp_extension extends AIEngine { } catch (error) { console.error(`Failed to unload session ${sessionId}:`, error); } + } + + // Clear the sessions map + this.activeSessions.clear(); } - - // Clear the sessions map - this.activeSessions.clear(); -} // Implement the required LocalProvider interface methods override async list(): Promise { @@ -133,10 +133,8 @@ export default class llamacpp_extension extends AIEngine { // otherwise, look into subdirectories const children = await fs.readdirSync(currentDir) for (const child of children) { - // NOTE: currently fs.fileStat() output is a string - // TODO: fix this in core // skip files - const dirInfo = await fs.fileStat(child).then(JSON.parse) + const dirInfo = await fs.fileStat(child) if (!dirInfo.isDirectory) { continue }