From 24ced30d41c738d939bc62565feb32b550e779da Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 15 Sep 2026 15:30:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(upstreams):=20accounts=3DNone=20=E4=BF=9D?= =?UTF-8?q?=E7=95=99=E9=A1=B6=E5=B1=82=20accounts=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=88=E4=B8=8D=E5=86=8D=E6=B8=85=E7=A9=BA=EF=BC=89=20(1.0.2?= =?UTF-8?q?6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `accounts = None` 走 legacy auth 路径时**写空 vec 覆盖**了 existing.accounts, 导致管理台 toggle「停用/启用」(只发 {slot, enabled})会把账号清单 全部清空——用户现场踩坑:minimax 2 个账号点停用变 0 个。 修:`accounts = None` 时保留 `existing.accounts`(含 note/resets), 与 base/models/note 字段的 None = 保留原值语义对齐。 回归 228/0 全绿。 --- rust/crates/plugin-llm/src/upstreams.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rust/crates/plugin-llm/src/upstreams.rs b/rust/crates/plugin-llm/src/upstreams.rs index 0081441..4afe0b8 100644 --- a/rust/crates/plugin-llm/src/upstreams.rs +++ b/rust/crates/plugin-llm/src/upstreams.rs @@ -764,7 +764,15 @@ pub fn upsert( (merged, String::new()) } None => ( - Vec::new(), + // accounts = None = 保留原 accounts 字段(与 base/models/note 语义一致)。 + // 1.0.25 修:之前写空 vec,toggle「停用/启用」会把账号清单清空。 + // 注意:existing.accounts(顶层字段)保存的是账号的 note/resets, + // auth 在 effective_accounts() 时合并 auth 与 accounts[*].auth。 + // 完整保留 = 保留顶层 accounts(保留 note/resets)即可。 + existing + .as_ref() + .map(|e| e.accounts.clone()) + .unwrap_or_default(), match auth_raw { Some(a) => normalize_auth(a), None => existing.as_ref().map(|e| e.auth.clone()).unwrap_or_default(),