fix: 修复模型权限正则匹配逻辑及相关缓存清除

- 修复 model_mappings 正则匹配不再受 candidate_models 限制
- Provider 启用/禁用/删除时清除 GlobalModel 解析缓存
- 优先级管理对话框中启用的 Provider 排在禁用的前面
- 修复请求时间线 skipped 状态颜色适配主题
This commit is contained in:
fawney19
2026-01-23 16:10:53 +08:00
parent 3963e424f8
commit 6f597a5f54
6 changed files with 77 additions and 26 deletions

View File

@@ -567,10 +567,20 @@ const availableFormats = computed(() => {
return Object.keys(keysByFormat.value).sort()
})
// 排序 providers启用的在前停用的在后各自按优先级排序
function sortProvidersByActiveAndPriority(providers: ProviderWithEndpointsSummary[]) {
return [...providers].sort((a, b) => {
if (a.is_active !== b.is_active) {
return a.is_active ? -1 : 1
}
return a.provider_priority - b.provider_priority
})
}
// 监听 props.providers 变化
watch(() => props.providers, (newProviders) => {
if (newProviders) {
sortedProviders.value = [...newProviders].sort((a, b) => a.provider_priority - b.provider_priority)
sortedProviders.value = sortProvidersByActiveAndPriority(newProviders)
}
}, { immediate: true })
@@ -691,8 +701,8 @@ function finishEditProviderPriority(provider: ProviderWithEndpointsSummary, even
provider_priority: newPriority
}
}
// 按 provider_priority 重新排序
sortedProviders.value = [...sortedProviders.value].sort((a, b) => a.provider_priority - b.provider_priority)
// 重新排序
sortedProviders.value = sortProvidersByActiveAndPriority(sortedProviders.value)
}
editingProviderPriority.value = null
@@ -777,7 +787,7 @@ function handleProviderDrop(dropIndex: number) {
})
// 重新排序
sortedProviders.value = [...items].sort((a, b) => a.provider_priority - b.provider_priority)
sortedProviders.value = sortProvidersByActiveAndPriority(items)
draggedProvider.value = null
dragOverProvider.value = null
}