(conf map[string]interface{}, config dto.AgentQQBotConfig)
| 1225 | } |
| 1226 | |
| 1227 | func setQQBotConfig(conf map[string]interface{}, config dto.AgentQQBotConfig) { |
| 1228 | channels := ensureChildMap(conf, "channels") |
| 1229 | qqbot := ensureChildMap(channels, "qqbot") |
| 1230 | defaultBot := getDefaultQQBot(config.Bots) |
| 1231 | effectiveEnabled := config.Enabled && hasEnabledBots(config.Bots) |
| 1232 | delete(qqbot, "dmPolicy") |
| 1233 | qqbot["enabled"] = effectiveEnabled |
| 1234 | qqbot["appId"] = defaultBot.AppID |
| 1235 | qqbot["clientSecret"] = defaultBot.ClientSecret |
| 1236 | qqbot["name"] = defaultBot.Name |
| 1237 | if len(defaultBot.AllowFrom) > 0 { |
| 1238 | qqbot["allowFrom"] = append([]string(nil), defaultBot.AllowFrom...) |
| 1239 | } else { |
| 1240 | delete(qqbot, "allowFrom") |
| 1241 | } |
| 1242 | if defaultBot.SystemPrompt != "" { |
| 1243 | qqbot["systemPrompt"] = defaultBot.SystemPrompt |
| 1244 | } else { |
| 1245 | delete(qqbot, "systemPrompt") |
| 1246 | } |
| 1247 | |
| 1248 | accounts := make(map[string]interface{}, len(config.Bots)) |
| 1249 | for _, bot := range config.Bots { |
| 1250 | if bot.AccountID == "default" || bot.IsDefault { |
| 1251 | continue |
| 1252 | } |
| 1253 | account := map[string]interface{}{ |
| 1254 | "enabled": bot.Enabled, |
| 1255 | "name": bot.Name, |
| 1256 | "appId": bot.AppID, |
| 1257 | "clientSecret": bot.ClientSecret, |
| 1258 | } |
| 1259 | if len(bot.AllowFrom) > 0 { |
| 1260 | account["allowFrom"] = append([]string(nil), bot.AllowFrom...) |
| 1261 | } |
| 1262 | if bot.SystemPrompt != "" { |
| 1263 | account["systemPrompt"] = bot.SystemPrompt |
| 1264 | } |
| 1265 | accounts[bot.AccountID] = account |
| 1266 | } |
| 1267 | qqbot["accounts"] = accounts |
| 1268 | |
| 1269 | plugins := ensureChildMap(conf, "plugins") |
| 1270 | entries := ensureChildMap(plugins, "entries") |
| 1271 | delete(entries, "qqbot") |
| 1272 | qqbotEntry := ensureChildMap(entries, "openclaw-qqbot") |
| 1273 | qqbotEntry["enabled"] = effectiveEnabled |
| 1274 | } |
| 1275 | |
| 1276 | func appendPluginAllow(conf map[string]interface{}, pluginID string) { |
| 1277 | plugins := ensureChildMap(conf, "plugins") |
no test coverage detected