From 331c0e04a5dfdbf1d00b354fa08e8903e724c32b Mon Sep 17 00:00:00 2001 From: Akarshan Biswas Date: Mon, 2 Jun 2025 06:42:29 +0530 Subject: [PATCH] fix: use modelId instead of sessionId for unloading The loop now extracts session info to retrieve the model ID, ensuring correct unloading of sessions by their associated model identifiers rather than session IDs. This aligns the cleanup process with the actual model resources being managed. --- extensions/llamacpp-extension/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/llamacpp-extension/src/index.ts b/extensions/llamacpp-extension/src/index.ts index f8b8347b8..55402412d 100644 --- a/extensions/llamacpp-extension/src/index.ts +++ b/extensions/llamacpp-extension/src/index.ts @@ -139,11 +139,11 @@ export default class llamacpp_extension extends AIEngine { override async onUnload(): Promise { // Terminate all active sessions - for (const [sessionId, _] of this.activeSessions) { + for (const [_, sInfo] of this.activeSessions) { try { - await this.unload(sessionId) + await this.unload(sInfo.modelId) } catch (error) { - console.error(`Failed to unload session ${sessionId}:`, error) + console.error(`Failed to unload model ${sInfo.modelId}:`, error) } }