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
+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);
};