From e1d6b1eeb3749db8dcc08ca8a6337d543d315220 Mon Sep 17 00:00:00 2001 From: Developer Date: Wed, 10 Jun 2026 00:58:04 +0200 Subject: [PATCH] fix: Chat via agentId statt sessionKey + reply aus details parsen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SendChatMessageAsync: sessions_send nutzt agentId (nicht sessionKey) - Reply parsen aus result.details.reply (sessions_send Antwort-Struktur) - ChatRequest.Model: SessionKey → AgentId - Controller default: 'iris' → Agent-ID (nicht Session-Key) --- backend/Controllers/DashboardController.cs | 6 +++--- backend/Models/Dashboard.cs | 2 +- backend/Services/OpenClawGatewayClient.cs | 13 ++++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/Controllers/DashboardController.cs b/backend/Controllers/DashboardController.cs index f53a649..8b3f243 100644 --- a/backend/Controllers/DashboardController.cs +++ b/backend/Controllers/DashboardController.cs @@ -95,11 +95,11 @@ public class DashboardController(OpenClawGatewayClient gateway, ILogger SendChatMessageAsync(string sessionKey, string message) + public async Task SendChatMessageAsync(string agentId, string message) { try { - var result = await InvokeToolAsync("sessions_send", new { sessionKey, message }); + var result = await InvokeToolAsync("sessions_send", new { agentId, message }); if (result is null) return new ChatResponse(false, null, "Gateway nicht erreichbar"); - var ok = result["ok"]?.GetValue() ?? false; - var reply = result["reply"]?.GetValue() + // sessions_send reply is in details.reply or content[0].text + var details = result["details"]; + var ok = (details?["status"]?.GetValue() ?? result["status"]?.GetValue()) == "ok"; + var reply = details?["reply"]?.GetValue() + ?? result["reply"]?.GetValue() ?? result["response"]?.GetValue() ?? result["content"]?[0]?["text"]?.GetValue(); - var error = result["error"]?.GetValue(); + var error = details?["error"]?.GetValue() ?? result["error"]?.GetValue(); return new ChatResponse(ok, reply, error); }