diff --git a/model/model_meta.go b/model/model_meta.go index 4f76898..b734350 100644 --- a/model/model_meta.go +++ b/model/model_meta.go @@ -89,7 +89,7 @@ func (mi *Model) Update() error { mi.UpdatedTime = common.GetTimestamp() // 使用 Select 强制更新所有字段,包括零值 return DB.Model(&Model{}).Where("id = ?", mi.Id). - Select("model_name", "description", "icon", "tags", "vendor_id", "endpoints", "status", "sync_official", "name_rule", "updated_time"). + Select("model_name", "description", "icon", "tags", "type", "vendor_id", "endpoints", "status", "sync_official", "name_rule", "updated_time"). Updates(mi).Error } diff --git a/web/src/components/table/models/modals/EditModelModal.jsx b/web/src/components/table/models/modals/EditModelModal.jsx index 12ca48e..683d13d 100644 --- a/web/src/components/table/models/modals/EditModelModal.jsx +++ b/web/src/components/table/models/modals/EditModelModal.jsx @@ -38,6 +38,7 @@ import { IconAlertTriangle, IconLink } from '@douyinfe/semi-icons'; import { API, showError, showSuccess } from '../../../../helpers'; import { useTranslation } from 'react-i18next'; import { useIsMobile } from '../../../../hooks/common/useIsMobile'; +import { MODEL_TYPE_OPTIONS } from '../../../../constants/common.constant'; const { Text, Title } = Typography; @@ -117,6 +118,7 @@ const EditModelModal = (props) => { description: '', icon: '', tags: [], + type: 1, // 默认对话模型 vendor_id: undefined, vendor: '', vendor_icon: '', @@ -330,6 +332,25 @@ const EditModelModal = (props) => { /> + + ({ + label: t(o.label), + value: o.value, + }))} + rules={[ + { required: true, message: t('请选择模型类型') }, + ]} + extraText={t( + '选择模型的类型,用于分类和筛选', + )} + style={{ width: '100%' }} + /> + + { } }); const vendors = Array.from(vendorSet).sort(); - const getCount = (v) => { + const getVendorCount = () => { + // 计算供应商数量(包含未知供应商) + const count = vendorSet.size + (hasUnknown ? 1 : 0); + return count; + }; + const getModelCount = (v) => { if (v === 'all') return vendorModels.length; if (v === 'unknown') return vendorModels.filter((m) => !m.vendor_name).length; return vendorModels.filter((m) => m.vendor_name === v).length; }; const items = [ - { value: 'all', label: t('全部供应商'), tagCount: getCount('all'), disabled: (models || []).length === 0 }, + { value: 'all', label: t('全部供应商'), tagCount: getVendorCount(), disabled: (models || []).length === 0 }, ]; vendors.forEach((v) => { - const count = getCount(v); + const count = getModelCount(v); items.push({ value: v, label: v, @@ -93,8 +98,8 @@ const HomePricingFilters = ({ t }) => { items.push({ value: 'unknown', label: t('未知供应商'), - tagCount: getCount('unknown'), - disabled: getCount('unknown') === 0, + tagCount: getModelCount('unknown'), + disabled: getModelCount('unknown') === 0, }); } return items;