mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 10:57:03 +08:00
fix(admin): 修复 Key 自动获取模型时 allowed_models 同步逻辑
- 关闭自动获取上游模型时清空 allowed_models - 开启自动获取上游模型时立即拉取并覆盖 allowed_models - 增加模型覆盖提示并补充相关回归测试
This commit is contained in:
@@ -22,6 +22,8 @@ pub(crate) async fn build_admin_update_provider_key_record(
|
||||
let state = state.as_ref();
|
||||
let mut updated = existing.clone();
|
||||
let (fields, payload) = patch.into_parts();
|
||||
let auto_fetch_disabled =
|
||||
existing.auto_fetch_models && matches!(payload.auto_fetch_models, Some(false));
|
||||
let current_auth_type = normalize_auth_type(Some(&existing.auth_type))?;
|
||||
let target_auth_type = payload
|
||||
.auth_type
|
||||
@@ -245,6 +247,9 @@ pub(crate) async fn build_admin_update_provider_key_record(
|
||||
if let Some(auto_fetch_models) = payload.auto_fetch_models {
|
||||
updated.auto_fetch_models = auto_fetch_models;
|
||||
}
|
||||
if auto_fetch_disabled {
|
||||
updated.allowed_models = None;
|
||||
}
|
||||
if fields.contains("locked_models") {
|
||||
updated.locked_models =
|
||||
normalize_string_list(payload.locked_models).map(|value| json!(value));
|
||||
|
||||
Reference in New Issue
Block a user