fix: benchmark tooltip

This commit is contained in:
jialin
2026-02-06 18:34:20 +08:00
parent 4132494a49
commit 4a582ec8b1
9 changed files with 51 additions and 32 deletions
@@ -1,4 +1,5 @@
import BaseSelect from '@/components/seal-form/base/select';
import { modelCategoriesMap } from '@/pages/llmodels/config';
import { SearchOutlined, SyncOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Button, Input, Space } from 'antd';
@@ -31,6 +32,15 @@ const RightActions: React.FC<RightActionsProps> = ({
const handleGPUChange = debounceUpdateFilter;
const modelOptions = modelList
?.filter((item) => {
return item.categories.includes(modelCategoriesMap.llm);
})
.map((item) => ({
label: item.label,
value: item.label
}));
return (
<Space>
<Input
@@ -63,7 +73,7 @@ const RightActions: React.FC<RightActionsProps> = ({
id: 'benchmark.table.filter.bymodel'
})}
style={{ width: 200 }}
options={modelList}
options={modelOptions}
onChange={(value, option) =>
handleQueryChange({
model_name: value,
@@ -33,6 +33,7 @@ const actionList = [
{
key: 'export',
label: 'benchmark.table.export.results',
status: [BenchmarkStatusValueMap.Completed],
icon: (
<IconFont type="icon-export" style={{ lineHeight: 1, fontSize: 16 }} />
)
@@ -123,6 +123,23 @@ const Instance: React.FC = () => {
</Flex>
)
},
{
key: '2',
label: intl.formatMessage({ id: 'models.form.env' }),
children: (
<Flex gap={8} wrap="wrap">
{instanceData?.env
? Object.entries(instanceData?.env || {}).map(
([key, value], index: number) => (
<Tag key={index} style={{ margin: 0 }}>
{`${key}=${value}`}
</Tag>
)
)
: '-'}
</Flex>
)
},
{
key: '4',
label: intl.formatMessage({
@@ -158,23 +175,6 @@ const Instance: React.FC = () => {
)}
</Flex>
)
},
{
key: '2',
label: intl.formatMessage({ id: 'models.form.env' }),
children: (
<Flex gap={8} wrap="wrap">
{instanceData?.env
? Object.entries(instanceData?.env || {}).map(
([key, value], index: number) => (
<Tag key={index} style={{ margin: 0 }}>
{`${key}=${value}`}
</Tag>
)
)
: '-'}
</Flex>
)
}
];
}, [detailData]);
+1 -1
View File
@@ -99,7 +99,7 @@ const DatasetForm: React.FC = () => {
: false
}
>
{intl.formatMessage({ id: item?.label || '' })}
{item?.label}
</AutoTooltip>
</Select.Option>
))}
@@ -20,7 +20,11 @@ const useBenchmarkColumns = (params: {
return useMemo(() => {
return [
{
title: intl.formatMessage({ id: 'common.table.name' }),
title: (
<AutoTooltip ghost minWidth={20}>
{intl.formatMessage({ id: 'common.table.name' })}
</AutoTooltip>
),
dataIndex: 'name',
sorter: tableSorter(1),
render: (text: string, record) => (
@@ -33,7 +37,11 @@ const useBenchmarkColumns = (params: {
},
...columns,
{
title: intl.formatMessage({ id: 'common.table.operation' }),
title: (
<AutoTooltip ghost minWidth={20}>
{intl.formatMessage({ id: 'common.table.operation' })}
</AutoTooltip>
),
dataIndex: 'operations',
ellipsis: {
showTitle: false
@@ -178,7 +178,7 @@ const useColumnSettings = (options: {
sorter: tableSorter(1),
render: (text: string) => (
<AutoTooltip ghost minWidth={20}>
{_.round(text, 0)}
{_.round(text, 2)}
</AutoTooltip>
)
},
@@ -253,8 +253,11 @@ const useColumnSettings = (options: {
const metadataColumns = [
{
title: renderTitle(intl.formatMessage({ id: 'clusters.title' })),
pos: 1,
title: (
<AutoTooltip ghost minWidth={20}>
{intl.formatMessage({ id: 'clusters.title' })}
</AutoTooltip>
),
dataIndex: 'cluster_id',
render: (text: number) => (
<AutoTooltip ghost minWidth={20}>
@@ -353,7 +356,7 @@ const useColumnSettings = (options: {
(fieldSortPos[a.dataIndex] || 0) - (fieldSortPos[b.dataIndex] || 0)
);
return selected;
}, [selectedColumns, clusterList]);
}, [selectedColumns, clusterList, intl, profileOptions]);
const SettingsButton = (
<ColumnSettings
+1 -5
View File
@@ -201,11 +201,7 @@ const Benchmark: React.FC = () => {
});
const handleExportData = () => {
const firstSelectedRow = dataSource.dataList.find(
(item) => item.id === rowSelection.selectedRowKeys[0]
);
const name = firstSelectedRow ? firstSelectedRow.name : 'benchmark';
exportData(rowSelection.selectedRowKeys, name);
exportData(rowSelection.selectedRowKeys);
};
return (
@@ -13,7 +13,7 @@ const matchFilename = (disposition: string | null): string | undefined => {
};
export function useExportBenchmark() {
const exportData = async (data: any[], name: string) => {
const exportData = async (data: any[], name?: string) => {
const date = dayjs().format('YYYYMMDD_HHmmss');
const fileName = `${name || 'benchmark'}_${date}`;
try {
@@ -31,8 +31,9 @@ export default function useQueryProfiles() {
const list =
res?.profiles?.map((item) => {
const label = profileMap.get(item.name)?.label;
return {
label: profileMap.get(item.name)?.label || item.name,
label: label ? intl.formatMessage({ id: label }) : item.name,
tips: profileMap.get(item.name)?.tips || '',
value: item.name,
config: {