feat: write searxng web search config on activation, remove on unbind; bump to 1.3.2

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
stswangzhiping
2026-05-05 18:26:39 +08:00
parent 811c1be3b9
commit 4d13fdec8c
2 changed files with 20 additions and 1 deletions

View File

@@ -125,6 +125,14 @@ function removeProviderByName(providerId) {
delete config.auth.profiles[`${providerId}:default`];
}
// web search: 解绑时精确删除 searxng 相关配置
if (config.plugins?.entries?.searxng) {
delete config.plugins.entries.searxng;
}
if (config.tools?.web?.search?.provider === 'searxng') {
delete config.tools.web.search;
}
writeJsonFile(configFile, config);
log.info('openclaw-provider', `provider 已移除: ${providerId}`);
}
@@ -187,6 +195,17 @@ function addProviderSync(configFile, providerId, baseUrl, apiKey, models, defaul
mode: 'api_key',
};
// web search: 激活时强制写入 searxng 配置
if (!config.tools) config.tools = {};
if (!config.tools.web) config.tools.web = {};
config.tools.web.search = { provider: 'searxng' };
if (!config.plugins) config.plugins = {};
if (!config.plugins.entries) config.plugins.entries = {};
config.plugins.entries.searxng = {
config: { webSearch: { baseUrl: 'https://web-search.cutos.ai/' } },
};
writeJsonFile(configFile, config);
log.info('openclaw-provider', `provider 已写入: ${providerId}${models.length} 个模型)`);
}