diff --git a/controller/channel_upstream_update.go b/controller/channel_upstream_update.go index 701bef78b..1062adb1e 100644 --- a/controller/channel_upstream_update.go +++ b/controller/channel_upstream_update.go @@ -730,14 +730,6 @@ func DetectChannelUpstreamModelUpdates(c *gin.Context) { } settings := channel.GetOtherSettings() - if !settings.UpstreamModelUpdateCheckEnabled { - c.JSON(http.StatusOK, gin.H{ - "success": false, - "message": "该渠道未开启上游模型更新检测", - }) - return - } - modelsChanged, autoAdded, err := checkAndPersistChannelUpstreamModelUpdates(channel, &settings, true, false) if err != nil { common.ApiError(c, err) diff --git a/dto/channel_settings.go b/dto/channel_settings.go index fc04937e7..8d7466d25 100644 --- a/dto/channel_settings.go +++ b/dto/channel_settings.go @@ -27,12 +27,12 @@ type ChannelOtherSettings struct { AzureResponsesVersion string `json:"azure_responses_version,omitempty"` VertexKeyType VertexKeyType `json:"vertex_key_type,omitempty"` // "json" or "api_key" OpenRouterEnterprise *bool `json:"openrouter_enterprise,omitempty"` - ClaudeBetaQuery bool `json:"claude_beta_query,omitempty"` // Claude 渠道是否强制追加 ?beta=true - AllowServiceTier bool `json:"allow_service_tier,omitempty"` // 是否允许 service_tier 透传(默认过滤以避免额外计费) - AllowInferenceGeo bool `json:"allow_inference_geo,omitempty"` // 是否允许 inference_geo 透传(仅 Claude,默认过滤以满足数据驻留合规 - AllowSafetyIdentifier bool `json:"allow_safety_identifier,omitempty"` // 是否允许 safety_identifier 透传(默认过滤以保护用户隐私) - DisableStore bool `json:"disable_store,omitempty"` // 是否禁用 store 透传(默认允许透传,禁用后可能导致 Codex 无法使用) - AllowIncludeObfuscation bool `json:"allow_include_obfuscation, omitempty"` // 是否允许 stream_options.include_obfuscation 透传(默认过滤以避免关闭流混淆保护) + ClaudeBetaQuery bool `json:"claude_beta_query,omitempty"` // Claude 渠道是否强制追加 ?beta=true + AllowServiceTier bool `json:"allow_service_tier,omitempty"` // 是否允许 service_tier 透传(默认过滤以避免额外计费) + AllowInferenceGeo bool `json:"allow_inference_geo,omitempty"` // 是否允许 inference_geo 透传(仅 Claude,默认过滤以满足数据驻留合规 + AllowSafetyIdentifier bool `json:"allow_safety_identifier,omitempty"` // 是否允许 safety_identifier 透传(默认过滤以保护用户隐私) + DisableStore bool `json:"disable_store,omitempty"` // 是否禁用 store 透传(默认允许透传,禁用后可能导致 Codex 无法使用) + AllowIncludeObfuscation bool `json:"allow_include_obfuscation,omitempty"` // 是否允许 stream_options.include_obfuscation 透传(默认过滤以避免关闭流混淆保护) AwsKeyType AwsKeyType `json:"aws_key_type,omitempty"` UpstreamModelUpdateCheckEnabled bool `json:"upstream_model_update_check_enabled,omitempty"` // 是否检测上游模型更新 UpstreamModelUpdateAutoSyncEnabled bool `json:"upstream_model_update_auto_sync_enabled,omitempty"` // 是否自动同步上游模型更新 diff --git a/web/src/components/table/channels/ChannelsColumnDefs.jsx b/web/src/components/table/channels/ChannelsColumnDefs.jsx index e205a729c..e4bb17d15 100644 --- a/web/src/components/table/channels/ChannelsColumnDefs.jsx +++ b/web/src/components/table/channels/ChannelsColumnDefs.jsx @@ -723,10 +723,6 @@ export const getChannelsColumns = ({ name: t('仅检测上游模型更新'), type: 'tertiary', onClick: () => { - if (!upstreamUpdateMeta.enabled) { - showInfo(t('该渠道未开启上游模型更新检测')); - return; - } detectChannelUpstreamUpdates(record); }, }); diff --git a/web/src/components/table/channels/modals/EditChannelModal.jsx b/web/src/components/table/channels/modals/EditChannelModal.jsx index 6f9f699ce..7f89120b9 100644 --- a/web/src/components/table/channels/modals/EditChannelModal.jsx +++ b/web/src/components/table/channels/modals/EditChannelModal.jsx @@ -3291,6 +3291,18 @@ const EditChannelModal = (props) => { inputs.upstream_model_update_last_check_time, )} + + handleInputChange( + 'upstream_model_update_ignored_models', + value, + ) + } + showClear + /> )} @@ -3460,19 +3472,6 @@ const EditChannelModal = (props) => { )} /> - - handleInputChange( - 'upstream_model_update_ignored_models', - value, - ) - } - showClear - /> -
{t('上次检测到可加入模型')}:  {upstreamDetectedModels.length === 0 ? ( diff --git a/web/src/hooks/channels/useChannelUpstreamUpdates.jsx b/web/src/hooks/channels/useChannelUpstreamUpdates.jsx index cdf694330..3be62c019 100644 --- a/web/src/hooks/channels/useChannelUpstreamUpdates.jsx +++ b/web/src/hooks/channels/useChannelUpstreamUpdates.jsx @@ -21,6 +21,23 @@ import { useRef, useState } from 'react'; import { API, showError, showInfo, showSuccess } from '../../helpers'; import { normalizeModelList } from './upstreamUpdateUtils'; +const getManualIgnoredModelCountFromSettings = (settings) => { + let parsed = null; + if (settings && typeof settings === 'object') { + parsed = settings; + } else if (typeof settings === 'string') { + try { + parsed = JSON.parse(settings); + } catch (error) { + parsed = null; + } + } + if (!parsed || typeof parsed !== 'object') { + return 0; + } + return normalizeModelList(parsed.upstream_model_update_ignored_models).length; +}; + export const useChannelUpstreamUpdates = ({ t, refresh }) => { const [showUpstreamUpdateModal, setShowUpstreamUpdateModal] = useState(false); const [upstreamUpdateChannel, setUpstreamUpdateChannel] = useState(null); @@ -114,14 +131,18 @@ export const useChannelUpstreamUpdates = ({ t, refresh }) => { const addedCount = data?.added_models?.length || 0; const removedCount = data?.removed_models?.length || 0; - const ignoredCount = data?.ignored_models?.length || 0; + const totalIgnoredCount = getManualIgnoredModelCountFromSettings( + data?.settings, + ); + const ignoredCount = normalizeModelList(ignoreModels).length; showSuccess( t( - '已处理上游模型更新:加入 {{added}} 个,删除 {{removed}} 个,忽略 {{ignored}} 个', + '已处理上游模型更新:加入 {{added}} 个,删除 {{removed}} 个,本次忽略 {{ignored}} 个,当前已忽略模型 {{totalIgnored}} 个', { added: addedCount, removed: removedCount, ignored: ignoredCount, + totalIgnored: totalIgnoredCount, }, ), );