diff --git a/src/lib/components/admin/Evaluations/Leaderboard.svelte b/src/lib/components/admin/Evaluations/Leaderboard.svelte index e5d8a2166..d8407a574 100644 --- a/src/lib/components/admin/Evaluations/Leaderboard.svelte +++ b/src/lib/components/admin/Evaluations/Leaderboard.svelte @@ -11,6 +11,9 @@ import Tooltip from '$lib/components/common/Tooltip.svelte'; import MagnifyingGlass from '$lib/components/icons/MagnifyingGlass.svelte'; + import ChevronUp from '$lib/components/icons/ChevronUp.svelte'; + import ChevronDown from '$lib/components/icons/ChevronDown.svelte'; + const i18n = getContext('i18n'); const EMBEDDING_MODEL = 'TaylorAI/bge-micro-v2'; @@ -28,6 +31,9 @@ let loadingLeaderboard = true; let debounceTimer; + let orderBy: string = 'rating'; // default sort column + let direction: 'asc' | 'desc' = 'desc'; // default sort order + type Feedback = { id: string; data: { @@ -51,6 +57,15 @@ lost: number; }; + function setSortKey(key) { + if (orderBy === key) { + direction = direction === 'asc' ? 'desc' : 'asc'; + } else { + orderBy = key; + direction = key === 'name' ? 'asc' : 'desc'; + } + } + ////////////////////// // // Rank models by Elo rating @@ -324,25 +339,140 @@ class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-850 dark:text-gray-400 -translate-y-0.5" >