/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Alert, Button, Checkbox, Collapse, Form, Input, InputNumber, Modal, Select, Switch, Typography, } from 'antd'; import { ConsoleDrawer as Drawer } from '../console/ConsolePrimitives'; import { Plus, Trash2 } from '../common/icons/ActionIcons'; import { showError, showSuccess } from '../../helpers'; import { saveProfile } from './api'; const { TextArea } = Input; // 等价 Semi Select 的 filter + allowCreate:可搜索,输入的新模型名作为临时选项出现, // 只有选中后才回调 onChange(与原行为一致,不在每次键入时写值)。 const CreatableSelect = ({ options, value, onChange, ...props }) => { const [search, setSearch] = useState(''); const keyword = search.trim(); const merged = keyword && !options.some((o) => o.value === keyword) ? [...options, { label: keyword, value: keyword }] : options; return ( set('slug', e.target.value.toLowerCase()) } placeholder='coding' /> set('name', e.target.value)} maxLength={64} /> set('description', e.target.value)} maxLength={255} /> set('tier_thresholds', e.target.value)} placeholder='0.45,0.50,0.55' />
set('status', v ? 1 : 2)} aria-label={t('启用')} /> {t('启用')}
), }, { key: 'models', label: t('候选模型'), children: (
{t( '能力档 0~4:数值越大能力越强;推理模型通常配为 4。能力标签用于按请求过滤候选。', )} {state.models.map((m, idx) => (
o.value === m.model_name || !state.models.some( (x, i) => i !== idx && x.model_name === o.value, ), )} placeholder={t('选择模型')} aria-label={t('选择模型')} onChange={(v) => updateModel(idx, { model_name: v || '' }) } /> updateLabel(l.id, { name: e.target.value.toLowerCase(), }) } /> updateLabel(l.id, { desc: e.target.value }) } /> setCell(l.id, col, v)} /> ))} ))}
), }, { key: 'roles', label: t('模型角色与阈值'), children: (
set('baseline_model', v || '')} />