fix: benchmark tooltip
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user