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); }