From 537e2c730cebb67c960543bc77fcb1545eca36a6 Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Sat, 28 Feb 2026 17:19:52 +0800 Subject: [PATCH] feat: preserve Feishu account map on config updates (#11990) --- agent/app/service/agents.go | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/agent/app/service/agents.go b/agent/app/service/agents.go index c5ed472c1..cdc53eda3 100644 --- a/agent/app/service/agents.go +++ b/agent/app/service/agents.go @@ -803,26 +803,20 @@ func extractFeishuConfig(conf map[string]interface{}) dto.AgentFeishuConfig { } func setFeishuConfig(conf map[string]interface{}, config dto.AgentFeishuConfig) { - channels, ok := conf["channels"].(map[string]interface{}) - if !ok { - channels = map[string]interface{}{} - conf["channels"] = channels - } - feishu := map[string]interface{}{ - "enabled": config.Enabled, - "dmPolicy": config.DmPolicy, - "accounts": map[string]interface{}{ - "main": map[string]interface{}{ - "appId": config.AppID, - "appSecret": config.AppSecret, - "botName": config.BotName, - }, - }, - } + channels := ensureChildMap(conf, "channels") + feishu := ensureChildMap(channels, "feishu") + feishu["enabled"] = config.Enabled + feishu["dmPolicy"] = config.DmPolicy + + accounts := ensureChildMap(feishu, "accounts") + main := ensureChildMap(accounts, "main") + main["appId"] = config.AppID + main["appSecret"] = config.AppSecret + main["botName"] = config.BotName + if strings.EqualFold(config.DmPolicy, "open") { feishu["allowFrom"] = []string{"*"} } - channels["feishu"] = feishu } func setFeishuPluginEnabled(conf map[string]interface{}, enabled bool) {