feat: 完善企业微信机器人配置持久化保存

新增功能:
- 企业微信机器人配置支持持久化保存
- 添加/删除机器人时自动保存配置
- 新增手动保存按钮(💾 保存配置)
- 保存成功后显示提示信息

改进:
- 添加机器人:自动保存并提示  机器人已保存
- 删除机器人:自动保存并提示  配置已保存
- 手动保存:点击按钮保存所有配置变更

配置文件位置:
- Windows: %APPDATA%\wecome-openclaw-client\config.json
- 包含:机器人配置、Gateway 配置、启用状态

所有配置重启后自动加载,无需重新配置。
This commit is contained in:
2026-03-10 03:09:47 +08:00
parent 9520bdada5
commit cb264d5cd0
2 changed files with 15 additions and 3 deletions

View File

@@ -119,7 +119,7 @@ function App() {
setNewBot({ botId: '', secret: '', name: '', enabled: true });
setShowAddBot(false);
await saveConfig();
addLog('success', `添加机器人:${newBot.name || newBot.botId}`);
addLog('success', `机器人已保存${newBot.name || newBot.botId}`);
};
const handleDeleteBot = async (botId) => {
@@ -127,7 +127,7 @@ function App() {
const updatedBots = config.bots.filter(b => b.id !== botId);
setConfig({ ...config, bots: updatedBots });
await saveConfig();
addLog('info', `删除机器人:${botId}`);
addLog('success', `✅ 配置已保存,机器人已删除`);
};
const handleConnectWeCom = async (bot) => {
@@ -356,6 +356,9 @@ function App() {
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '20px' }}>
<h2 className="section-title" style={{ margin: 0 }}>企业微信机器人配置</h2>
<div style={{ display: 'flex', gap: '12px' }}>
<button className="btn btn-primary" onClick={async () => { await saveConfig(); addLog('success', '✅ 机器人配置已保存'); }}>
💾 保存配置
</button>
<button className="btn btn-secondary" onClick={() => setShowTestMessage(true)}>
📝 测试消息
</button>