Skip to content

Commit 3c4f412

Browse files
committed
fix(MOC-236): #477 bot review round-7(身份变更置显式空池,不回退陈旧映射)
round-5 身份变更用 remove(pooledModels),但缺省会让 unique_pool_slugs 回退到该 provider (同样陈旧的)models 槽位映射 → 旧 slug 立刻又进池广播、路由到新上游不存在模型。改为置 **显式空 []**(round-3 registry 语义 = 不贡献 slug 也不回退),等用户在整合页「重新获取」 对新上游重建池。表单仍只作废池、不填充。
1 parent fe4d5be commit 3c4f412

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • src-tauri/src/admin/handlers/providers

src-tauri/src/admin/handlers/providers/crud.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,16 @@ pub async fn update_provider(
436436
//
437437
// **例外:upstream 身份变了**(baseUrl / apiFormat / apiKey 与原值不同)→ 旧池属于旧端点/
438438
// 旧账号,留着会让 catalog / resolver 继续广播旧 slug、把请求路由到新上游的不存在模型
439-
// (错路由,plan 头号风险)→ **清空** pooledModels(remove → 缺省 → 回退新映射,等用户在
440-
// 整合页「重新获取」对新上游重建池)。注意:表单这里只**作废**池、绝不**填充**池(非 resurrection)。
441-
// (#477 P2 round-5)
439+
// (错路由,plan 头号风险)→ 置 pooledModels 为**显式空 `[]`**(等用户在整合页「重新获取」
440+
// 对新上游重建)。**不能** remove:缺省会让 `unique_pool_slugs` 回退到该 provider 的(同样
441+
// 陈旧的)`models` 槽位映射,旧 slug 立刻又被广播进池(#477 P2 round-7);显式 `[]` 经
442+
// round-3 registry 语义 = 该 provider 不贡献任何 slug、也不回退。表单只**作废**池、绝不
443+
// **填充**(非 resurrection)。(#477 P2 round-5/7)
442444
let identity_changed = existing.get("baseUrl") != updated.get("baseUrl")
443445
|| existing.get("apiFormat") != updated.get("apiFormat")
444446
|| existing.get("apiKey") != updated.get("apiKey");
445447
if identity_changed {
446-
updated.remove("pooledModels");
448+
updated.insert("pooledModels".into(), Value::Array(Vec::new()));
447449
}
448450
updated.insert("id".into(), Value::String(id.clone()));
449451
updated.insert("isBuiltin".into(), Value::Bool(is_builtin));

0 commit comments

Comments
 (0)