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