fix(admin): persist provider settings and enforce quotas

This commit is contained in:
ZheFox
2026-08-28 12:47:54 +08:00
parent c4b4dfa996
commit dd2958a458
9 changed files with 197 additions and 68 deletions
@@ -2896,8 +2896,21 @@ async function openAntigravityQuotaDialog(key: EndpointAPIKey) {
}
}
async function handleKeyChanged() {
function applyUpdatedKeySnapshot(updatedKey: EndpointAPIKey) {
const index = providerKeys.value.findIndex(key => key.id === updatedKey.id)
if (index >= 0) {
providerKeys.value.splice(index, 1, updatedKey)
}
if (editingKey.value?.id === updatedKey.id) {
editingKey.value = updatedKey
}
syncCurrentSelections(endpoints.value, providerKeys.value)
}
async function handleKeyChanged(updatedKey?: EndpointAPIKey) {
if (updatedKey) applyUpdatedKeySnapshot(updatedKey)
await Promise.all([loadProvider(), loadEndpoints(), loadMappingPreview()])
if (updatedKey) applyUpdatedKeySnapshot(updatedKey)
emit('refresh')
// 添加/修改 key 后自动获取已支持 provider 的配额(新 key 的 upstream_metadata 为空)
void autoRefreshQuotaInBackground().then((changed) => {