|
|
@@ -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);
|
|
|
@@ -115,13 +132,17 @@ 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,
|
|
|
+ );
|
|
|
showSuccess(
|
|
|
t(
|
|
|
- '已处理上游模型更新:加入 {{added}} 个,删除 {{removed}} 个,忽略 {{ignored}} 个',
|
|
|
+ '已处理上游模型更新:加入 {{added}} 个,删除 {{removed}} 个,本次忽略 {{ignored}} 个,当前已忽略模型 {{totalIgnored}} 个',
|
|
|
{
|
|
|
added: addedCount,
|
|
|
removed: removedCount,
|
|
|
ignored: ignoredCount,
|
|
|
+ totalIgnored: totalIgnoredCount,
|
|
|
},
|
|
|
),
|
|
|
);
|