feat: Key 删除时自动解除不再匹配的 GlobalModel 关联

- 新增 auto_disassociate_provider_by_key_whitelist 方法检测并解除关联
- 删除 Key 后检查 Provider 剩余 Key 白名单,移除不再匹配的 Model
- 前端删除密钥后并行刷新端点列表、模型列表和模型映射

Closes #102

Co-authored-by: AAEE86 <ppk0227@hotmail.com>
This commit is contained in:
fawney19
2026-01-17 22:05:09 +08:00
parent 4fa0201b7e
commit f002f8de03
3 changed files with 183 additions and 8 deletions

View File

@@ -779,7 +779,12 @@ async function confirmDeleteKey() {
try {
await deleteEndpointKey(keyId)
showSuccess('密钥已删除')
await loadEndpoints()
// 并行刷新:端点列表、模型列表、模型映射(删除 Key 触发自动解除模型关联)
await Promise.all([
loadEndpoints(),
modelsTabRef.value?.reload(),
modelMappingTabRef.value?.reload()
])
emit('refresh')
} catch (err: any) {
showError(err.response?.data?.detail || '删除密钥失败', '错误')