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) + ); } }