From a5cbe98f255adec3c4dc4c1d8dc7fecc6322b510 Mon Sep 17 00:00:00 2001 From: Developer Date: Wed, 10 Jun 2026 01:11:52 +0200 Subject: [PATCH] fix: Chat-Messages Merge + Session-Key agent:iris:main - fetchChatMessages merged statt replace (verhindert Poll-wipe) - Chat/Send bereits korrekt via agentId=iris - Chat/Messages nutzt jetzt agent:iris:main als Session-Key - Cron-Job deaktiviert (verhinderte Selbst-Konversation) --- backend/Controllers/DashboardController.cs | 2 +- frontend/src/composables/useDashboardData.ts | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/backend/Controllers/DashboardController.cs b/backend/Controllers/DashboardController.cs index 8b3f243..d771973 100644 --- a/backend/Controllers/DashboardController.cs +++ b/backend/Controllers/DashboardController.cs @@ -119,7 +119,7 @@ public class DashboardController(OpenClawGatewayClient gateway, ILogger { const res = await apiFetch('/api/dashboard/chat/messages?limit=50') if (!res.ok) return const data: DashboardChatMessage[] = await res.json() - chatMessages.value = data.map((msg, idx) => ({ - id: `msg-${idx}`, - sender: msg.role === 'assistant' ? 'iris' : 'user', - text: msg.content, - timestamp: new Date(msg.timestamp).getTime(), - })) + // Merge instead of replace — only add messages not already present + const existingTexts = new Set(chatMessages.value.map(m => m.text)) + const existingTimestamps = new Set(chatMessages.value.map(m => m.timestamp)) + for (const msg of data) { + const msgTime = new Date(msg.timestamp).getTime() + if (existingTexts.has(msg.content) && existingTimestamps.has(msgTime)) continue + chatMessages.value.push({ + id: `msg-${msgTime}-${msg.role}`, + sender: msg.role === 'assistant' ? 'iris' : 'user', + text: msg.content, + timestamp: msgTime, + }) + } } catch { // API unreachable – keep current values }