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