mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-07 16:49:42 +08:00
fix(models): stop auto-filling fallback chain and add clear-all button
The fallback editor's "Add" buttons appeared to do nothing because applyDefaultModel auto-populated defaults.model.fallbacks with every non-primary model whenever the list was empty (and the same for defaults.models). After any save with an empty chain, the chain got filled with all 17+ candidates; the candidate pool became "No candidate models available" and any subsequent Add click hit the early return `if (modelConfig.fallbacks.includes(full)) return`. Even worse, the auto-fill made it impossible for users to keep an empty fallback chain on purpose: deleting all chips would silently get replaced with every model on the next debounced autosave. Remove the auto-fill in applyDefaultModel. An empty fallback chain is a valid configuration that means "no implicit fallback"; Gateway already surfaces a clear primary-model error in that case. normalizeDefaultModel Selection still cleans up invalid/duplicate entries. Also add a small "Clear All" button next to the active chain title so users can drop the entire fallback list in one click instead of removing chips one by one (especially useful for the existing bloated 17-fallback state created by the old auto-fill path). ## Verification - node --check src/pages/models.js - node --check src/locales/modules/models.js - npm run build - Playwright repro: open /#/models → Clear All → fallbacks on disk go from 17 → 0 → click Add on one candidate → fallbacks on disk are exactly that one entry, no longer auto-expanded back to 17.
This commit is contained in:
@@ -191,4 +191,7 @@ export default {
|
||||
setAsPrimary: _('设为主用', 'Set as Primary', '設為主用'),
|
||||
remove: _('移除', 'Remove', '移除'),
|
||||
add: _('加入', 'Add', '加入'),
|
||||
addAll: _('全部加入', 'Add All', '全部加入'),
|
||||
clearAll: _('清空全部', 'Clear All', '清空全部'),
|
||||
confirmClearAll: _('确定清空所有备选模型?主模型不会被影响。', 'Clear all fallback models? Primary model is not affected.', '確定清空所有備選模型?主模型不會被影響。'),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user