fix logo display
Browse files- frontend/src/components/Logo/Logo.js +12 -4
- frontend/src/pages/LeaderboardPage/LeaderboardPage.js +44 -31
- frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useDataUtils.js +4 -4
- frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useLeaderboardData.js +53 -4
- frontend/src/pages/LeaderboardPage/components/Leaderboard/utils/columnUtils.js +23 -23
frontend/src/components/Logo/Logo.js
CHANGED
@@ -44,33 +44,41 @@ const Logo = ({ height = "40px" }) => {
|
|
44 |
<Box
|
45 |
component="img"
|
46 |
src="/logofinai.png"
|
|
|
47 |
sx={{
|
48 |
-
height: 80,
|
49 |
mx: 2,
|
|
|
50 |
}}
|
51 |
/>
|
52 |
<Box
|
53 |
component="img"
|
54 |
src="/nactemlogo.png"
|
|
|
55 |
sx={{
|
56 |
-
height: 60,
|
57 |
mx: 2,
|
|
|
58 |
}}
|
59 |
/>
|
60 |
<Box
|
61 |
component="img"
|
62 |
src="/archimedeslogo.png"
|
|
|
63 |
sx={{
|
64 |
-
height: 60,
|
65 |
mx: 2,
|
|
|
66 |
}}
|
67 |
/>
|
68 |
<Box
|
69 |
component="img"
|
70 |
src="/airclogo.png"
|
|
|
71 |
sx={{
|
72 |
-
height: 80,
|
73 |
mx: 2,
|
|
|
74 |
}}
|
75 |
/>
|
76 |
</Box>
|
|
|
44 |
<Box
|
45 |
component="img"
|
46 |
src="/logofinai.png"
|
47 |
+
alt="FinAI Logo"
|
48 |
sx={{
|
49 |
+
height: "80%",
|
50 |
mx: 2,
|
51 |
+
maxHeight: 80,
|
52 |
}}
|
53 |
/>
|
54 |
<Box
|
55 |
component="img"
|
56 |
src="/nactemlogo.png"
|
57 |
+
alt="NACTEM Logo"
|
58 |
sx={{
|
59 |
+
height: "60%",
|
60 |
mx: 2,
|
61 |
+
maxHeight: 60,
|
62 |
}}
|
63 |
/>
|
64 |
<Box
|
65 |
component="img"
|
66 |
src="/archimedeslogo.png"
|
67 |
+
alt="Archimedes Logo"
|
68 |
sx={{
|
69 |
+
height: "60%",
|
70 |
mx: 2,
|
71 |
+
maxHeight: 60,
|
72 |
}}
|
73 |
/>
|
74 |
<Box
|
75 |
component="img"
|
76 |
src="/airclogo.png"
|
77 |
+
alt="AIRC Logo"
|
78 |
sx={{
|
79 |
+
height: "80%",
|
80 |
mx: 2,
|
81 |
+
maxHeight: 80,
|
82 |
}}
|
83 |
/>
|
84 |
</Box>
|
frontend/src/pages/LeaderboardPage/LeaderboardPage.js
CHANGED
@@ -1,44 +1,57 @@
|
|
1 |
-
import
|
2 |
-
import { Box, Typography, Container } from "@mui/material";
|
3 |
import Leaderboard from "./components/Leaderboard/Leaderboard";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
const LeaderboardPage = () => {
|
6 |
return (
|
7 |
-
<
|
8 |
-
maxWidth={false}
|
9 |
sx={{
|
10 |
-
|
11 |
display: "flex",
|
12 |
flexDirection: "column",
|
13 |
-
alignItems: "center",
|
14 |
-
height: "100%",
|
15 |
-
maxWidth: "100vw",
|
16 |
-
overflow: "hidden"
|
17 |
}}
|
18 |
>
|
19 |
-
<Box
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
<Typography
|
32 |
-
variant="body1"
|
33 |
-
color="text.secondary"
|
34 |
-
sx={{ maxWidth: "800px", mx: "auto" }}
|
35 |
-
>
|
36 |
-
Comprehensive evaluation of language models on financial tasks across multiple languages and modalities
|
37 |
-
</Typography>
|
38 |
</Box>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
<Leaderboard />
|
40 |
-
</
|
41 |
);
|
42 |
-
}
|
43 |
|
44 |
export default LeaderboardPage;
|
|
|
1 |
+
import { useEffect } from "react";
|
|
|
2 |
import Leaderboard from "./components/Leaderboard/Leaderboard";
|
3 |
+
import { Box } from "@mui/material";
|
4 |
+
import PageHeader from "../../components/shared/PageHeader";
|
5 |
+
import Logo from "../../components/Logo/Logo";
|
6 |
+
import { useLeaderboardData } from "../../pages/LeaderboardPage/components/Leaderboard/hooks/useLeaderboardData";
|
7 |
+
import { useLeaderboard } from "../../pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext";
|
8 |
+
|
9 |
+
function LeaderboardPage() {
|
10 |
+
const { data, isLoading, error } = useLeaderboardData();
|
11 |
+
const { actions } = useLeaderboard();
|
12 |
+
|
13 |
+
useEffect(() => {
|
14 |
+
if (data) {
|
15 |
+
actions.setModels(data);
|
16 |
+
}
|
17 |
+
actions.setLoading(isLoading);
|
18 |
+
actions.setError(error);
|
19 |
+
}, [data, isLoading, error, actions]);
|
20 |
|
|
|
21 |
return (
|
22 |
+
<Box
|
|
|
23 |
sx={{
|
24 |
+
ph: 2,
|
25 |
display: "flex",
|
26 |
flexDirection: "column",
|
|
|
|
|
|
|
|
|
27 |
}}
|
28 |
>
|
29 |
+
<Box
|
30 |
+
sx={{
|
31 |
+
display: "flex",
|
32 |
+
justifyContent: "center",
|
33 |
+
pt: 6,
|
34 |
+
mb: -4,
|
35 |
+
pb: 0,
|
36 |
+
width: "100%",
|
37 |
+
overflow: "visible"
|
38 |
+
}}
|
39 |
+
>
|
40 |
+
<Logo height="80px" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
</Box>
|
42 |
+
<PageHeader
|
43 |
+
title="Open Financial LLM Leaderboard"
|
44 |
+
subtitle={
|
45 |
+
<>
|
46 |
+
Benchmark for large language models in {" "}
|
47 |
+
<span style={{ fontWeight: 600 }}>financial</span> domain {" "}
|
48 |
+
across multiple languages
|
49 |
+
</>
|
50 |
+
}
|
51 |
+
/>
|
52 |
<Leaderboard />
|
53 |
+
</Box>
|
54 |
);
|
55 |
+
}
|
56 |
|
57 |
export default LeaderboardPage;
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useDataUtils.js
CHANGED
@@ -177,7 +177,7 @@ export const useProcessedData = (data, averageMode, visibleColumns) => {
|
|
177 |
isMissing: false,
|
178 |
});
|
179 |
});
|
180 |
-
|
181 |
// 根据平均分排序
|
182 |
modelList.sort((a, b) => {
|
183 |
if (a.model.average_score === null && b.model.average_score === null)
|
@@ -186,7 +186,7 @@ export const useProcessedData = (data, averageMode, visibleColumns) => {
|
|
186 |
if (b.model.average_score === null) return -1;
|
187 |
return b.model.average_score - a.model.average_score;
|
188 |
});
|
189 |
-
|
190 |
// 添加排名
|
191 |
return modelList.map((item, index) => ({
|
192 |
...item,
|
@@ -229,10 +229,10 @@ export const useFilteredData = (
|
|
229 |
return useMemo(() => {
|
230 |
// 由于使用的是硬编码数据,这里直接返回所有数据而不进行过滤
|
231 |
return processedData.map((item, index) => ({
|
232 |
-
|
233 |
dynamic_rank: index + 1,
|
234 |
rank: rankingMode === "static" ? item.static_rank : index + 1,
|
235 |
-
|
236 |
}));
|
237 |
}, [
|
238 |
processedData,
|
|
|
177 |
isMissing: false,
|
178 |
});
|
179 |
});
|
180 |
+
|
181 |
// 根据平均分排序
|
182 |
modelList.sort((a, b) => {
|
183 |
if (a.model.average_score === null && b.model.average_score === null)
|
|
|
186 |
if (b.model.average_score === null) return -1;
|
187 |
return b.model.average_score - a.model.average_score;
|
188 |
});
|
189 |
+
|
190 |
// 添加排名
|
191 |
return modelList.map((item, index) => ({
|
192 |
...item,
|
|
|
229 |
return useMemo(() => {
|
230 |
// 由于使用的是硬编码数据,这里直接返回所有数据而不进行过滤
|
231 |
return processedData.map((item, index) => ({
|
232 |
+
...item,
|
233 |
dynamic_rank: index + 1,
|
234 |
rank: rankingMode === "static" ? item.static_rank : index + 1,
|
235 |
+
isPinned: pinnedModels.includes(item.id),
|
236 |
}));
|
237 |
}, [
|
238 |
processedData,
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/hooks/useLeaderboardData.js
CHANGED
@@ -8,11 +8,60 @@ const CACHE_KEY = "leaderboardData";
|
|
8 |
const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes
|
9 |
|
10 |
export const useLeaderboardData = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
return {
|
12 |
-
data
|
13 |
-
isLoading
|
14 |
-
error
|
15 |
-
refetch: () =>
|
16 |
};
|
17 |
};
|
18 |
|
|
|
8 |
const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes
|
9 |
|
10 |
export const useLeaderboardData = () => {
|
11 |
+
const queryClient = useQueryClient();
|
12 |
+
const [searchParams] = useSearchParams();
|
13 |
+
const isInitialLoadRef = useRef(true);
|
14 |
+
|
15 |
+
const { data, isLoading, error } = useQuery({
|
16 |
+
queryKey: ["leaderboard"],
|
17 |
+
queryFn: async () => {
|
18 |
+
try {
|
19 |
+
const cachedData = localStorage.getItem(CACHE_KEY);
|
20 |
+
if (cachedData) {
|
21 |
+
const { data: cached, timestamp } = JSON.parse(cachedData);
|
22 |
+
const age = Date.now() - timestamp;
|
23 |
+
if (age < CACHE_DURATION) {
|
24 |
+
return cached;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
const response = await fetch("/api/leaderboard/formatted");
|
29 |
+
if (!response.ok) {
|
30 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
31 |
+
}
|
32 |
+
|
33 |
+
const newData = await response.json();
|
34 |
+
localStorage.setItem(
|
35 |
+
CACHE_KEY,
|
36 |
+
JSON.stringify({
|
37 |
+
data: newData,
|
38 |
+
timestamp: Date.now(),
|
39 |
+
})
|
40 |
+
);
|
41 |
+
|
42 |
+
return newData;
|
43 |
+
} catch (error) {
|
44 |
+
console.error("Detailed error:", error);
|
45 |
+
throw error;
|
46 |
+
}
|
47 |
+
},
|
48 |
+
staleTime: CACHE_DURATION,
|
49 |
+
cacheTime: CACHE_DURATION * 2,
|
50 |
+
refetchOnWindowFocus: false,
|
51 |
+
enabled: isInitialLoadRef.current || !!searchParams.toString(),
|
52 |
+
});
|
53 |
+
|
54 |
+
useMemo(() => {
|
55 |
+
if (data && isInitialLoadRef.current) {
|
56 |
+
isInitialLoadRef.current = false;
|
57 |
+
}
|
58 |
+
}, [data]);
|
59 |
+
|
60 |
return {
|
61 |
+
data,
|
62 |
+
isLoading,
|
63 |
+
error,
|
64 |
+
refetch: () => queryClient.invalidateQueries(["leaderboard"]),
|
65 |
};
|
66 |
};
|
67 |
|
frontend/src/pages/LeaderboardPage/components/Leaderboard/utils/columnUtils.js
CHANGED
@@ -689,28 +689,28 @@ export const createColumns = (
|
|
689 |
}
|
690 |
|
691 |
return (
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
);
|
715 |
},
|
716 |
size: TABLE_DEFAULTS.COLUMNS.COLUMN_SIZES["model.type_icon"],
|
@@ -1123,7 +1123,7 @@ export const createColumns = (
|
|
1123 |
padding: "8px 16px",
|
1124 |
backgroundColor: (theme) => alpha(theme.palette.secondary.main, 0.05),
|
1125 |
}),
|
1126 |
-
|
1127 |
}
|
1128 |
];
|
1129 |
|
|
|
689 |
}
|
690 |
|
691 |
return (
|
692 |
+
<Box
|
693 |
+
sx={{
|
694 |
+
display: "flex",
|
695 |
+
alignItems: "center",
|
696 |
+
justifyContent: "center",
|
697 |
+
width: "100%",
|
698 |
+
}}
|
699 |
+
>
|
700 |
+
<Tooltip title={row.original.model.type}>
|
701 |
+
<Typography
|
702 |
+
sx={{
|
703 |
+
fontSize: "1.2rem",
|
704 |
+
cursor: "help",
|
705 |
+
lineHeight: 1,
|
706 |
+
fontFamily:
|
707 |
+
'"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif',
|
708 |
+
}}
|
709 |
+
>
|
710 |
+
{getModelTypeIcon(row.original.model.type)}
|
711 |
+
</Typography>
|
712 |
+
</Tooltip>
|
713 |
+
</Box>
|
714 |
);
|
715 |
},
|
716 |
size: TABLE_DEFAULTS.COLUMNS.COLUMN_SIZES["model.type_icon"],
|
|
|
1123 |
padding: "8px 16px",
|
1124 |
backgroundColor: (theme) => alpha(theme.palette.secondary.main, 0.05),
|
1125 |
}),
|
1126 |
+
},
|
1127 |
}
|
1128 |
];
|
1129 |
|