feat: OpenClaw Gateway 配置和连接优化 #1

Open
weworkdev wants to merge 27 commits from weworkdev into main
2 changed files with 15 additions and 3 deletions
Showing only changes of commit cb264d5cd0 - Show all commits

View File

@@ -377,7 +377,16 @@ class OpenClawConnection {
// 处理响应 // 处理响应
if (message.type === 'res') { if (message.type === 'res') {
const resLog = '[OpenClaw] 响应:' + (message.ok ? '✅ 成功' : '❌ 失败') + (message.error ? ' | ' + message.error : ''); let errorDetail = '';
if (!message.ok) {
if (message.error) {
errorDetail = typeof message.error === 'object' ? JSON.stringify(message.error) : String(message.error);
}
if (message.payload) {
errorDetail += ' | payload: ' + JSON.stringify(message.payload);
}
}
const resLog = '[OpenClaw] 响应:' + (message.ok ? '✅ 成功' : '❌ 失败') + (errorDetail ? ' | ' + errorDetail : '');
console.log(resLog); console.log(resLog);
mainWindow.webContents.send('openclaw-log', { type: message.ok ? 'success' : 'error', message: resLog }); mainWindow.webContents.send('openclaw-log', { type: message.ok ? 'success' : 'error', message: resLog });
} }

View File

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