From 04e640a7915d582bcc26c73fb127d05e1563d808 Mon Sep 17 00:00:00 2001 From: Bo26fhmC5M <88071760+Bo26fhmC5M@users.noreply.github.com> Date: Mon, 13 Jan 2025 13:02:22 +0900 Subject: [PATCH] refactor: improve array conversion and sorting syntax --- src/ts/process/memory/hypav3.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ts/process/memory/hypav3.ts b/src/ts/process/memory/hypav3.ts index c9a96037..7da40d4c 100644 --- a/src/ts/process/memory/hypav3.ts +++ b/src/ts/process/memory/hypav3.ts @@ -51,7 +51,7 @@ function toSerializableHypaV3Data(data: HypaV3Data): SerializableHypaV3Data { return { summaries: data.summaries.map((summary) => ({ text: summary.text, - chatMemos: Array.from(summary.chatMemos), + chatMemos: [...summary.chatMemos], })), }; } @@ -725,8 +725,8 @@ export async function hypaMemoryV3( } // Sort in descending order - const scoredArray = Array.from(scoredSummaries.entries()).sort( - (a, b) => b[1] - a[1] + const scoredArray = [...scoredSummaries.entries()].sort( + ([, scoreA], [, scoreB]) => scoreB - scoreA ); while (scoredArray.length > 0) {