diff --git a/src/web/pages/Settings.tsx b/src/web/pages/Settings.tsx index cf89640..4f1ece5 100644 --- a/src/web/pages/Settings.tsx +++ b/src/web/pages/Settings.tsx @@ -235,7 +235,7 @@ export default function Settings() { const [savingProxyFailureRules, setSavingProxyFailureRules] = useState(false); const [savingRouting, setSavingRouting] = useState(false); const [showAdvancedRouting, setShowAdvancedRouting] = useState(false); - const [allBrandNames, setAllBrandNames] = useState([]); + const [allBrandNames, setAllBrandNames] = useState(null); const [blockedBrands, setBlockedBrands] = useState([]); const [savingBrandFilter, setSavingBrandFilter] = useState(false); const [savingSecurity, setSavingSecurity] = useState(false); @@ -503,7 +503,7 @@ export default function Settings() { // Load brand list in background (non-blocking, best-effort) api.getBrandList() .then((res: any) => setAllBrandNames(Array.isArray(res?.brands) ? res.brands : [])) - .catch(() => {/* best-effort */}); + .catch(() => setAllBrandNames([])); }; useEffect(() => { @@ -1464,7 +1464,7 @@ export default function Settings() { 屏蔽选定品牌后,路由重建时将自动跳过匹配该品牌的所有模型。点击品牌切换屏蔽状态,保存后自动触发路由重建。
- {allBrandNames.map((brand) => { + {(allBrandNames || []).map((brand) => { const isBlocked = blockedBrands.includes(brand); return (
{blockedBrands.length > 0 && (