From 50c3be2136d14f1e5bd47d4f8123af53f222c4a3 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 24 Nov 2024 18:11:48 -0800 Subject: [PATCH] refac --- src/lib/components/chat/Messages/CitationsModal.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Messages/CitationsModal.svelte b/src/lib/components/chat/Messages/CitationsModal.svelte index 88d6c7f6e..9c6b23ecd 100644 --- a/src/lib/components/chat/Messages/CitationsModal.svelte +++ b/src/lib/components/chat/Messages/CitationsModal.svelte @@ -38,7 +38,9 @@ }; }); if (mergedDocuments.every((doc) => doc.distance !== undefined)) { - mergedDocuments.sort((a, b) => (a.distance ?? Infinity) - (b.distance ?? Infinity)); + mergedDocuments = mergedDocuments.sort( + (a, b) => (b.distance ?? Infinity) - (a.distance ?? Infinity) + ); } }