From 83edb79736cc7a6a28d04f7754fe89bb08d4ce67 Mon Sep 17 00:00:00 2001 From: Thomas Beverley Date: Mon, 4 Nov 2024 14:03:21 +0000 Subject: [PATCH] Move the model disposer so we don't prematurely drop the model from memory --- src/native/main/APIHandler/PrompterAPIHandler.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/native/main/APIHandler/PrompterAPIHandler.ts b/src/native/main/APIHandler/PrompterAPIHandler.ts index 12e7882..812631c 100644 --- a/src/native/main/APIHandler/PrompterAPIHandler.ts +++ b/src/native/main/APIHandler/PrompterAPIHandler.ts @@ -137,6 +137,9 @@ class PrompterAPIHandler { useMmap } + // Clear the auto-dispose timer + clearTimeout(this.#promptSession?.autoDispose) + // Create or re-use the session if (deepEqual(this.#promptSession?.options, sessionOptions)) { Logger.log(`Reusing AI instance ${modelId}`) @@ -146,7 +149,6 @@ class PrompterAPIHandler { Logger.log(`Loading new AI instance ${modelId}`) this.#disposePromptSession() - clearTimeout(this.#promptSession?.autoDispose) const nextPromptSession: Partial = { sessionIds: [sessionId], options: sessionOptions