fix: 号池调度 label 在无配置时错误显示为 LRU + 粘性

pool_advanced 为 null 时,poolSchedulingLabel 的 fallback 逻辑因
可选链默认值导致 lruEnabled=true、stickyEnabled=true,始终显示
"LRU + 粘性"。现在提前返回 "2 维度" 以匹配后端默认行为
(cache_affinity + recent_refresh)。
This commit is contained in:
fawney19
2026-03-09 15:42:32 +08:00
parent c4877e3b6a
commit e60462e068

View File

@@ -1284,7 +1284,11 @@ const poolSchedulingLabel = computed(() => {
} }
const cfg = selectedProviderConfig.value const cfg = selectedProviderConfig.value
const presets = Array.isArray(cfg?.scheduling_presets) ? cfg.scheduling_presets : []
// No pool_advanced config at all: show default (cache_affinity + recent_refresh)
if (!cfg) return '2 维度'
const presets = Array.isArray(cfg.scheduling_presets) ? cfg.scheduling_presets : []
const presetLabels = presetLabelsByName.value const presetLabels = presetLabelsByName.value
if (presets.length > 0) { if (presets.length > 0) {
@@ -1307,12 +1311,12 @@ const poolSchedulingLabel = computed(() => {
} }
// Fallback: legacy scheduling_mode field // Fallback: legacy scheduling_mode field
if (cfg?.scheduling_mode === 'multi_score') { if (cfg.scheduling_mode === 'multi_score') {
return '多维评分' return '多维评分'
} }
const lruEnabled = cfg?.lru_enabled !== false const lruEnabled = cfg.lru_enabled !== false
const stickyTtl = Number(cfg?.sticky_session_ttl_seconds ?? 3600) const stickyTtl = Number(cfg.sticky_session_ttl_seconds ?? 3600)
const stickyEnabled = Number.isFinite(stickyTtl) && stickyTtl > 0 const stickyEnabled = Number.isFinite(stickyTtl) && stickyTtl > 0
if (lruEnabled && stickyEnabled) return 'LRU + 粘性' if (lruEnabled && stickyEnabled) return 'LRU + 粘性'