fix: add other category

This commit is contained in:
jialin
2026-02-12 19:38:47 +08:00
parent 16c0e00b4f
commit c67a8c4120
10 changed files with 35 additions and 15 deletions
+1
View File
@@ -40,6 +40,7 @@ export default {
'benchmark.table.filter.bygpu': 'Filter by GPU',
'benchmark.table.filter.bymodel': 'Filter by Model',
'benchmark.table.filter.bydataset': 'Filter by Dataset',
'benchmark.table.filter.byProfile': 'Filter by Profile',
'benchmark.table.avg': 'Avg',
'benchmark.table.columnSettings': 'Column Settings',
'benchmark.detail.summary.results': 'Test Results',
+1
View File
@@ -40,6 +40,7 @@ export default {
'benchmark.table.filter.bygpu': 'Filter by GPU',
'benchmark.table.filter.bymodel': 'Filter by Model',
'benchmark.table.filter.bydataset': 'Filter by Dataset',
'benchmark.table.filter.byProfile': 'Filter by Profile',
'benchmark.table.avg': 'Avg',
'benchmark.table.columnSettings': 'Column Settings',
'benchmark.detail.summary.results': 'Test Results',
+1
View File
@@ -40,6 +40,7 @@ export default {
'benchmark.table.filter.bygpu': 'Filter by GPU',
'benchmark.table.filter.bymodel': 'Filter by Model',
'benchmark.table.filter.bydataset': 'Filter by Dataset',
'benchmark.table.filter.byProfile': 'Filter by Profile',
'benchmark.table.avg': 'Avg',
'benchmark.table.columnSettings': 'Column Settings',
'benchmark.detail.summary.results': 'Test Results',
+1
View File
@@ -40,6 +40,7 @@ export default {
'benchmark.table.filter.bygpu': '按 GPU 过滤',
'benchmark.table.filter.bymodel': '按模型过滤',
'benchmark.table.filter.bydataset': '按数据集过滤',
'benchmark.table.filter.byProfile': '按模式过滤',
'benchmark.table.avg': '均值',
'benchmark.table.columnSettings': '列设置',
'benchmark.detail.summary.results': '测试结果',
@@ -5,12 +5,13 @@ import { useIntl } from '@umijs/max';
import { Button, Input, Space } from 'antd';
import _ from 'lodash';
import React from 'react';
import { profileOptions } from '../../benchmark/config';
export interface RightActionsProps {
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
handleSearch: () => void;
handleQueryChange: (value: any, option?: any) => void;
modelList?: Global.BaseOption<number>[];
modelList?: Global.BaseOption<number, { categories: string[] }>[];
datasetList?: Global.BaseOption<string | number>[];
}
@@ -34,7 +35,7 @@ const RightActions: React.FC<RightActionsProps> = ({
const modelOptions = modelList
?.filter((item) => {
return item.categories.includes(modelCategoriesMap.llm);
return item.categories?.includes(modelCategoriesMap.llm);
})
.map((item) => ({
label: item.label,
@@ -84,17 +85,16 @@ const RightActions: React.FC<RightActionsProps> = ({
<BaseSelect
allowClear
placeholder={intl.formatMessage({
id: 'benchmark.table.filter.bydataset'
id: 'benchmark.table.filter.byProfile'
})}
style={{ width: 200 }}
options={datasetList?.map((item) => ({
...item,
label: item.label,
value: item.label
options={profileOptions.map((item) => ({
label: intl.formatMessage({ id: item.label }),
value: item.value
}))}
onChange={(value, option) =>
handleQueryChange({
dataset_name: value,
profile: value,
page: 1
})
}
@@ -166,7 +166,7 @@ const EnvsOverridePopover: React.FC<EnvsOverridePopoverProps> = (props) => {
icon={<WarningOutlined />}
type="warning"
showIcon
title={'环境变量冲突,点击查看详情'}
title={'检测到环境变量值不一致,请确认使用的值'}
></Alert>
</div>
</Popover>
+1 -1
View File
@@ -1,7 +1,7 @@
import { maasProviderType } from '.';
export interface ProviderModel {
name: string;
category: string;
category?: string;
accessible: boolean | null;
}
export interface FormData {
+4
View File
@@ -143,6 +143,10 @@ const ProviderForm: React.FC<ProviderFormProps> = forwardRef((props, ref) => {
);
form.setFieldsValue({
...currentData,
models: (currentData.models || []).map((item) => ({
...item,
category: item.category || null
})),
api_key: apiTokensList?.[0] || '',
api_tokens: apiTokensList?.slice(1) || [],
proxy_enabled: !!currentData.proxy_url,
+16 -4
View File
@@ -1,7 +1,7 @@
import AutoComplete from '@/components/seal-form/auto-complete';
import SealSelect from '@/components/seal-form/seal-select';
import { PageAction } from '@/config';
import { categoryOptions } from '@/pages/llmodels/config';
import { categoryOptions, modelCategoriesMap } from '@/pages/llmodels/config';
import {
CheckCircleFilled,
LoadingOutlined,
@@ -197,9 +197,16 @@ const ModelItem: React.FC<ModelItemProps> = ({
</span>
</Tooltip>
<SealSelect
value={item.category || undefined}
allowNull
value={item.category}
onChange={handleOnCategoryChange}
options={categoryOptions}
options={[
...categoryOptions,
{
label: intl.formatMessage({ id: 'common.option.other' }),
value: null
}
]}
placeholder={intl.formatMessage({
id: 'models.form.categories'
})}
@@ -207,7 +214,12 @@ const ModelItem: React.FC<ModelItemProps> = ({
<Tooltip
title={intl.formatMessage({ id: 'providers.form.model.test.tips' })}
>
<Button type="link" size="small" onClick={handleTestModel}>
<Button
type="link"
size="small"
onClick={handleTestModel}
disabled={item.category !== modelCategoriesMap.llm || !item.name}
>
{testLoading ? (
<LoadingOutlined />
) : (
@@ -69,7 +69,7 @@ const SupportedModels = () => {
const onAdd = () => {
const newList = [...modelList];
newList.push({ name: '', category: '', accessible: null });
newList.push({ name: '', category: undefined, accessible: null });
updateModelList(newList);
};