webui: 修复 '删除源/服务器' 只置 <nil> 不真删的问题

前端 deleteSource/deleteMCPServer 通过 PUT value:null 删除,但后端 handleSettings
PUT 只 SetCore/SetPlugin(fmt.Sprint(nil) → 字面 '<nil>'),导致 core.llm.sources.<name>.*
等键残留不可达的 <nil> 行,污染 LLM 源与探活。

- SettingsAPI 新增 RemoveCore/RemovePlugin;settingsImpl 接入 ConfigRegistry.Delete
- webui handleSettings PUT:body.Value==null 时改走删除分支(核心表/插件表均适配)
- 现状验证:mocktest.* 残留已从本机 config.db 清除,sources=3,无无效源
This commit is contained in:
root
2026-08-10 09:35:29 +08:00
parent aeb1647fe0
commit c1186d6d9e
3 changed files with 106 additions and 30 deletions

View File

@ -11,6 +11,10 @@ type SettingsAPI interface {
DefsPlugin(plugin, prefix string) []*ConfigDef
// Remove 删除本插件配置中的单个键(插件删除时清理自身配置用)。
Remove(key string) error
// RemoveCore 删除核心配置表中的单个键。
RemoveCore(key string) error
// RemovePlugin 删除另一个插件配置表中的单个键。
RemovePlugin(plugin, key string) error
}
type ConfigDef = pubsdk.ConfigDef