From be82ed5e132145821cfd00b16d713d6e5a51f8ef Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Thu, 10 Oct 2024 22:12:31 +0200 Subject: [PATCH] fix(memory): make shallow copy of handlers Signed-off-by: Tomas Dvorak --- src/memory/tokenMemory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memory/tokenMemory.ts b/src/memory/tokenMemory.ts index f5c5b25e..a5e82110 100644 --- a/src/memory/tokenMemory.ts +++ b/src/memory/tokenMemory.ts @@ -151,7 +151,7 @@ export class TokenMemory extends BaseMemory { threshold: this.threshold, syncThreshold: this.syncThreshold, messages: shallowCopy(this.messages), - handlers: this.handlers, + handlers: shallowCopy(this.handlers), tokensByMessage: this.messages .map((message) => [message, this.tokensByMessage.get(message)]) .filter(([_, value]) => value !== undefined) as [BaseMessage, number][],