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
}

View File

@@ -905,7 +905,7 @@ const getStatusColorClass = (status: string) => {
.sub-dot.status-failed { background: #ef4444; color: #ef4444; }
.sub-dot.status-cancelled { background: #f59e0b; color: #f59e0b; }
.sub-dot.status-pending { background: #3b82f6; color: #3b82f6; }
.sub-dot.status-skipped { background: #1f2937; color: #1f2937; }
.sub-dot.status-skipped { background: hsl(var(--primary)); color: hsl(var(--primary)); }
.sub-dot.status-available { background: #d1d5db; color: #d1d5db; }
/* 选中状态:呼吸动画 + 涟漪效果 */
@@ -968,7 +968,7 @@ const getStatusColorClass = (status: string) => {
.node-dot.status-failed { color: #ef4444; }
.node-dot.status-cancelled { color: #f59e0b; }
.node-dot.status-pending { color: #3b82f6; }
.node-dot.status-skipped { color: #1f2937; }
.node-dot.status-skipped { color: hsl(var(--primary)); }
.node-dot.status-available { color: #d1d5db; }
.node-line {
@@ -1016,7 +1016,7 @@ const getStatusColorClass = (status: string) => {
.title-dot.status-failed { background: #ef4444; }
.title-dot.status-cancelled { background: #f59e0b; }
.title-dot.status-pending { background: #3b82f6; }
.title-dot.status-skipped { background: #1f2937; }
.title-dot.status-skipped { background: hsl(var(--primary)); }
.title-dot.status-available { background: #d1d5db; }
.title-text {
@@ -1090,27 +1090,27 @@ const getStatusColorClass = (status: string) => {
.status-tag.status-success {
background: #22c55e20;
color: #16a34a;
color: #22c55e;
}
.status-tag.status-failed {
background: #ef444420;
color: #dc2626;
color: #ef4444;
}
.status-tag.status-cancelled {
background: #f59e0b20;
color: #d97706;
color: #f59e0b;
}
.status-tag.status-pending {
background: #3b82f620;
color: #2563eb;
color: #3b82f6;
}
.status-tag.status-skipped {
background: #1f293720;
color: #1f2937;
background: hsl(var(--primary) / 0.15);
color: hsl(var(--primary));
}
.status-tag.status-available {