fix(config): 供应商改名同步重键模型别名 + 删除时清理关联配置(v0.8.3-rc1)
Release / Version consistency (push) Canceled after 0s
Release / Build (macos-latest) (push) Canceled after 0s
Release / Build (ubuntu-latest) (push) Canceled after 0s
Release / Build (windows-latest) (push) Canceled after 0s
Release / Attach macOS install script (push) Canceled after 0s
Release / Version consistency (push) Canceled after 0s
Release / Build (macos-latest) (push) Canceled after 0s
Release / Build (ubuntu-latest) (push) Canceled after 0s
Release / Build (windows-latest) (push) Canceled after 0s
Release / Attach macOS install script (push) Canceled after 0s
修复「改名后模型别名保留旧前缀,僵尸条目删了又出现」这一类配置不一致。 - 改名时同步重键模型别名、全局默认模型、供应商记住的默认模型、子代理池条目 - 改名冲突(撞已存在供应商名 / 遗留裸别名)加 -2/-3 后缀,不再静默吞模型 - 修复复制供应商复用移动语义 rekey 导致源供应商模型被清空 - 加载时不再合并「供应商已不存在」的 SQLite 僵尸模型 - 删除供应商/模型时清理子代理池条目、池默认回落、default_model 置空、 SQLite 用量查询配置(不误删另一 agent,读取失败即跳过) - 防呆:复制供应商改为 dirty-only,放弃修改不再落盘 - 测试基建:统一 crate 级 test_state 锁,消除环境变量并发竞争 测试:前端 146(新增 16)、Rust 197(新增 4)
This commit is contained in:
1 parent
317562781c
commit
35788c2783
20 files changed
+4217
-3893
No files matched your search
@@ -428,6 +428,33 @@ pub fn delete_setting_pub(key: &str) -> DbResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete `usage_kinds:<name>` / `usage_config:<name>` settings rows whose
|
||||
/// provider no longer exists in any agent's config, so deleting a provider in
|
||||
/// the UI also clears its usage-query settings instead of leaving orphan rows
|
||||
/// that outlive every rename of that provider.
|
||||
pub fn prune_orphan_usage_settings(
|
||||
live_providers: &std::collections::HashSet<String>,
|
||||
) -> DbResult<()> {
|
||||
with_conn(|conn| {
|
||||
let keys: Vec<String> = {
|
||||
let mut stmt = conn.prepare(
|
||||
"SELECT key FROM settings WHERE key LIKE 'usage_kinds:%' OR key LIKE 'usage_config:%'",
|
||||
)?;
|
||||
let rows = stmt.query_map([], |row| row.get::<_, String>(0))?;
|
||||
rows.collect::<Result<Vec<_>, _>>()?
|
||||
};
|
||||
for key in keys {
|
||||
let name = key.split_once(':').map(|(_, n)| n).unwrap_or("");
|
||||
if !live_providers.contains(name) {
|
||||
conn.execute("DELETE FROM settings WHERE key = ?1", params![key])?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
bump_generation();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Archived-session usage snapshots
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user