From dbebb3360882043f53313abc1fcebc12834f581a Mon Sep 17 00:00:00 2001 From: yaqi <1360968891@qq.com> Date: Wed, 25 Nov 2026 09:53:41 +0800 Subject: [PATCH] fix(settings): stop the chain editor from offering an already chosen model --- .../sections/models/FallbackChainEditor.tsx | 5 ++-- .../sections/models/fallback-chain.ts | 28 ++++++++++++++++++ web/tests/fallback-chain.spec.ts | 29 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/web/features/settings/sections/models/FallbackChainEditor.tsx b/web/features/settings/sections/models/FallbackChainEditor.tsx index 98811aafc..70867d3c0 100644 --- a/web/features/settings/sections/models/FallbackChainEditor.tsx +++ b/web/features/settings/sections/models/FallbackChainEditor.tsx @@ -9,6 +9,7 @@ import { useSettings } from "@/features/settings/store/SettingsStore"; import { apiFetch, apiUrl } from "@/lib/api"; import { + availableChoices, fallbackChoices, sanitizeChain, withoutActive, @@ -118,7 +119,7 @@ export function FallbackChainEditor() { setRows((current) => [...current, emptyRow()]); setSaved(null); }} - disabled={rows.length >= MAX_FALLBACKS} + disabled={rows.length >= MAX_FALLBACKS || choices.length <= rows.length} > {t("Add fallback")} @@ -148,7 +149,7 @@ export function FallbackChainEditor() { }} > - {choices.map((choice) => ( + {availableChoices(choices, rows, index).map((choice) => (