tfrere commited on
Commit
00c453b
·
1 Parent(s): bf58a54

update modality:agent

Browse files
client/src/components/LeaderboardSection.jsx CHANGED
@@ -71,22 +71,27 @@ const LeaderboardSection = ({
71
  return stats;
72
  }, [languages, leaderboards]);
73
 
 
 
 
 
 
74
  // On ne retourne null que si on n'a pas de leaderboards bruts
75
  if (!leaderboards) return null;
76
 
77
  // On affiche toujours les 3 premiers
78
- const displayedLeaderboards = filteredLeaderboards.slice(0, ITEMS_PER_PAGE);
79
  // Le reste sera dans le Collapse
80
- const remainingLeaderboards = filteredLeaderboards.slice(ITEMS_PER_PAGE);
81
 
82
  // Calculate how many skeletons we need
83
- const skeletonsNeeded = Math.max(0, 3 - filteredLeaderboards.length);
84
 
85
  // On affiche le bouton seulement si aucune catégorie n'est sélectionnée
86
  const showExpandButton = !selectedCategory;
87
 
88
  // Le bouton est actif seulement s'il y a plus de 3 leaderboards
89
- const isExpandButtonEnabled = filteredLeaderboards.length > ITEMS_PER_PAGE;
90
 
91
  const toggleExpanded = () => {
92
  setExpandedSections((prev) => {
@@ -140,7 +145,7 @@ const LeaderboardSection = ({
140
  fontSize: { xs: "1.25rem", md: "1.5rem" },
141
  }}
142
  >
143
- {filteredLeaderboards.length}
144
  </Typography>
145
  </Box>
146
  {showExpandButton && (
@@ -182,7 +187,7 @@ const LeaderboardSection = ({
182
  defaultExpanded={false}
183
  elevation={0}
184
  sx={{
185
- mb: filteredLeaderboards.length > 0 ? 4 : 2,
186
  "&:before": {
187
  display: "none",
188
  },
@@ -289,7 +294,7 @@ const LeaderboardSection = ({
289
  </Accordion>
290
  )}
291
 
292
- {filteredLeaderboards.length === 0 ? (
293
  <Box
294
  sx={{
295
  display: "flex",
 
71
  return stats;
72
  }, [languages, leaderboards]);
73
 
74
+ // Filtrer pour n'avoir que les leaderboards approuvés
75
+ const approvedLeaderboards = filteredLeaderboards.filter(
76
+ (leaderboard) => leaderboard.approval_status === "approved"
77
+ );
78
+
79
  // On ne retourne null que si on n'a pas de leaderboards bruts
80
  if (!leaderboards) return null;
81
 
82
  // On affiche toujours les 3 premiers
83
+ const displayedLeaderboards = approvedLeaderboards.slice(0, ITEMS_PER_PAGE);
84
  // Le reste sera dans le Collapse
85
+ const remainingLeaderboards = approvedLeaderboards.slice(ITEMS_PER_PAGE);
86
 
87
  // Calculate how many skeletons we need
88
+ const skeletonsNeeded = Math.max(0, 3 - approvedLeaderboards.length);
89
 
90
  // On affiche le bouton seulement si aucune catégorie n'est sélectionnée
91
  const showExpandButton = !selectedCategory;
92
 
93
  // Le bouton est actif seulement s'il y a plus de 3 leaderboards
94
+ const isExpandButtonEnabled = approvedLeaderboards.length > ITEMS_PER_PAGE;
95
 
96
  const toggleExpanded = () => {
97
  setExpandedSections((prev) => {
 
145
  fontSize: { xs: "1.25rem", md: "1.5rem" },
146
  }}
147
  >
148
+ {approvedLeaderboards.length}
149
  </Typography>
150
  </Box>
151
  {showExpandButton && (
 
187
  defaultExpanded={false}
188
  elevation={0}
189
  sx={{
190
+ mb: approvedLeaderboards.length > 0 ? 4 : 2,
191
  "&:before": {
192
  display: "none",
193
  },
 
294
  </Accordion>
295
  )}
296
 
297
+ {approvedLeaderboards.length === 0 ? (
298
  <Box
299
  sx={{
300
  display: "flex",
client/src/context/LeaderboardContext.jsx CHANGED
@@ -33,6 +33,37 @@ const getURLParams = () => {
33
  };
34
  };
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  export const LeaderboardProvider = ({ children }) => {
37
  // Lire les paramètres initiaux depuis l'URL
38
  const initialParams = getURLParams();
@@ -101,12 +132,28 @@ export const LeaderboardProvider = ({ children }) => {
101
 
102
  let filtered = [...boards];
103
 
104
- // Filter by search query (text only)
105
  if (searchQuery) {
106
  const query = searchQuery.toLowerCase();
107
- filtered = filtered.filter((board) =>
108
- board.card_data?.title?.toLowerCase().includes(query)
109
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
 
112
  // Filter arena only
@@ -168,22 +215,7 @@ export const LeaderboardProvider = ({ children }) => {
168
  case "safety":
169
  return tags.includes("eval:safety");
170
  case "uncategorized":
171
- return !tags.some(
172
- (tag) =>
173
- [
174
- "modality:agent",
175
- "eval:code",
176
- "eval:math",
177
- "modality:video",
178
- "modality:image",
179
- "modality:3d",
180
- "modality:audio",
181
- "domain:financial",
182
- "domain:medical",
183
- "domain:legal",
184
- "eval:safety",
185
- ].includes(tag) || tag.startsWith("language:")
186
- );
187
  default:
188
  return true;
189
  }
@@ -384,8 +416,9 @@ export const LeaderboardProvider = ({ children }) => {
384
  {
385
  id: "uncategorized",
386
  title: "Uncategorized",
387
- // Mettre dans uncategorized uniquement les leaderboards qui n'apparaissent nulle part ailleurs
388
- data: leaderboards.filter((board) => !categorizedIds.has(board.id)),
 
389
  },
390
  ];
391
 
 
33
  };
34
  };
35
 
36
+ // Constantes pour les tags de catégorisation
37
+ const CATEGORIZATION_TAGS = [
38
+ "modality:agent",
39
+ "eval:code",
40
+ "eval:math",
41
+ "modality:video",
42
+ "modality:image",
43
+ "modality:3d",
44
+ "modality:audio",
45
+ "domain:financial",
46
+ "domain:medical",
47
+ "domain:legal",
48
+ "eval:safety",
49
+ ];
50
+
51
+ // Helper pour déterminer si un leaderboard est non catégorisé
52
+ const isUncategorized = (board) => {
53
+ const tags = board.tags || [];
54
+ console.log("Checking uncategorized for board:", {
55
+ id: board.id,
56
+ tags,
57
+ approval_status: board.approval_status,
58
+ isUncategorized: !tags.some(
59
+ (tag) => CATEGORIZATION_TAGS.includes(tag) || tag.startsWith("language:")
60
+ ),
61
+ });
62
+ return !tags.some(
63
+ (tag) => CATEGORIZATION_TAGS.includes(tag) || tag.startsWith("language:")
64
+ );
65
+ };
66
+
67
  export const LeaderboardProvider = ({ children }) => {
68
  // Lire les paramètres initiaux depuis l'URL
69
  const initialParams = getURLParams();
 
132
 
133
  let filtered = [...boards];
134
 
135
+ // Filter by search query
136
  if (searchQuery) {
137
  const query = searchQuery.toLowerCase();
138
+ const tagMatch = query.match(/^(\w+):(\w+)$/);
139
+
140
+ if (tagMatch) {
141
+ // Search by tag (ex: language:french)
142
+ const [_, category, value] = tagMatch;
143
+ const searchTag = `${category}:${value}`.toLowerCase();
144
+ filtered = filtered.filter((board) => {
145
+ const allTags = [
146
+ ...(board.tags || []),
147
+ ...(board.editor_tags || []),
148
+ ];
149
+ return allTags.some((tag) => tag.toLowerCase() === searchTag);
150
+ });
151
+ } else {
152
+ // Regular search in title
153
+ filtered = filtered.filter((board) =>
154
+ board.card_data?.title?.toLowerCase().includes(query)
155
+ );
156
+ }
157
  }
158
 
159
  // Filter arena only
 
215
  case "safety":
216
  return tags.includes("eval:safety");
217
  case "uncategorized":
218
+ return isUncategorized(board);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  default:
220
  return true;
221
  }
 
416
  {
417
  id: "uncategorized",
418
  title: "Uncategorized",
419
+ data: leaderboards
420
+ .filter(isUncategorized)
421
+ .filter((board) => board.approval_status === "approved"),
422
  },
423
  ];
424
 
client/src/pages/HowToSubmitPage/HowToSubmitPage.jsx CHANGED
@@ -664,7 +664,7 @@ const HowToSubmitPage = () => {
664
  "modality:image",
665
  "modality:audio",
666
  "modality:video",
667
- "modality:tools",
668
  "modality:artefacts",
669
  "modality:3d",
670
  ]}
 
664
  "modality:image",
665
  "modality:audio",
666
  "modality:video",
667
+ "modality:agent",
668
  "modality:artefacts",
669
  "modality:3d",
670
  ]}