1
+ @using MyApp .ServiceInterface
2
+
3
+ <div class =" grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6" >
4
+ <div class =" bg-blue-500 text-white p-6 rounded-lg shadow-lg" >
5
+ <h2 class =" text-2xl font-bold mb-4" >Most Liked Models</h2 >
6
+ <div class =" space-y-4" >
7
+ @foreach ( var model in LeaderBoardData .MostLikedModelsByLlm .OrderByDescending (x => x .StartingUpVotes ))
8
+ {
9
+ <div class =" flex items-center" >
10
+ <img src =" @GetAvatarUrl(model.Id)" alt =" Avatar" class =" w-12 h-12 rounded-full mr-4" />
11
+ <div class =" flex-1" >
12
+ <h3 class =" text-lg font-semibold" >@GetModelName(model.Id) </h3 >
13
+ <div class =" text-sm text-green-200" >@model.StartingUpVotes votes </div >
14
+ </div >
15
+ </div >
16
+ }
17
+ </div >
18
+ </div >
19
+
20
+ <div class =" bg-blue-500 text-white p-6 rounded-lg shadow-lg" >
21
+ <h2 class =" text-2xl font-bold mb-4" >Total Votes</h2 >
22
+ <div class =" space-y-4" >
23
+ @foreach ( var model in LeaderBoardData .ModelTotalScore .OrderByDescending (x => x .TotalScore ))
24
+ {
25
+ <div class =" flex items-center" >
26
+ <img src =" @GetAvatarUrl(model.Id)" alt =" Avatar" class =" w-12 h-12 rounded-full mr-4" />
27
+ <div class =" flex-1" >
28
+ <h3 class =" text-lg font-semibold" >@GetModelName(model.Id) </h3 >
29
+ <div class =" text-sm text-green-200" >@model.TotalScore votes </div >
30
+ </div >
31
+ </div >
32
+ }
33
+ </div >
34
+ </div >
35
+
36
+ <div class =" bg-blue-500 text-white p-6 rounded-lg shadow-lg" >
37
+ <h2 class =" text-2xl font-bold mb-4" >Overall Win Rate</h2 >
38
+ <div class =" space-y-4" >
39
+ @foreach ( var model in LeaderBoardData .AnswererWinRate .OrderByDescending (x => x .WinRate ))
40
+ {
41
+ <div class =" flex items-center" >
42
+ <img src =" @GetAvatarUrl(model.Id)" alt =" Avatar" class =" w-12 h-12 rounded-full mr-4" />
43
+ <div class =" flex-1" >
44
+ <h3 class =" text-lg font-semibold" >@GetModelName(model.Id) </h3 >
45
+ <div class =" text-sm text-green-200" >@( Math .Round (model .WinRate ,2 )) % </div >
46
+ </div >
47
+ </div >
48
+ }
49
+ </div >
50
+ </div >
51
+
52
+ <div class =" bg-blue-500 text-white p-6 rounded-lg shadow-lg" >
53
+ <h2 class =" text-2xl font-bold mb-4" >Win Rate By Models</h2 >
54
+ <div class =" space-y-4" >
55
+ @foreach ( var model in LeaderBoardData .ModelWinRate .OrderByDescending (x => x .WinRate ))
56
+ {
57
+ <div class =" flex items-center" >
58
+ <img src =" @GetAvatarUrl(model.Id)" alt =" Avatar" class =" w-12 h-12 rounded-full mr-4" />
59
+ <div class =" flex-1" >
60
+ <h3 class =" text-lg font-semibold" >@GetModelName(model.Id) </h3 >
61
+ <div class =" text-sm text-green-200" >@( Math .Round (model .WinRate ,2 )) % </div >
62
+ </div >
63
+ </div >
64
+ }
65
+ </div >
66
+ </div >
67
+
68
+ </div >
69
+
70
+ @code {
71
+ [Parameter ]
72
+ public CalculateLeaderboardResponse LeaderBoardData { get ; set ; }
73
+
74
+ private string GetModelName (string modelId )
75
+ {
76
+ if (modelAliases .TryGetValue (modelId , out var alias ))
77
+ {
78
+ return alias ;
79
+ }
80
+ return modelId ;
81
+ }
82
+
83
+ private string GetAvatarUrl (string modelId )
84
+ {
85
+ var userName = modelUserMapping .TryGetValue (modelId , out var value ) ? value : modelId ;
86
+ return $" /avatar/{userName }" ;
87
+ }
88
+
89
+ Dictionary <string , string > modelUserMapping = new ()
90
+ {
91
+ { " mistral" , " mistral" },
92
+ { " mixtral" , " mixtral" },
93
+ { " mixtral-8x7b" , " mixtral" },
94
+ { " mixtral-8x7b-32768" , " mixtral" },
95
+ { " codellama" , " codellama" },
96
+ { " deepseek-coder:6.7b" , " deepseek-coder" },
97
+ { " deepseek-coder-6" , " deepseek-coder" },
98
+ { " gemma-2b" , " gemma-2b" },
99
+ { " gemma" , " gemma" },
100
+ { " gemma-7b" , " gemma" },
101
+ { " phi" , " phi" }
102
+ };
103
+
104
+ Dictionary <string , string > modelAliases = new ()
105
+ {
106
+ { " mistral" , " Mistral 7B" },
107
+ { " mixtral" , " Mixtral 8x7B" },
108
+ { " codellama" , " Codellama" },
109
+ { " deepseek-coder:6.7b" , " Deepseek Coder 6.7B" },
110
+ { " deepseek-coder-6" , " Deepseek Coder 6.7B" },
111
+ { " gemma-2b" , " Gemma 2B" },
112
+ { " gemma" , " Gemma 7B" },
113
+ { " gemma-7b" , " Gemma 7B" },
114
+ { " phi" , " Phi" }
115
+ };
116
+
117
+ }
0 commit comments