diff --git a/csharp/App/Backend/Services/AlarmKnowledgeBase.cs b/csharp/App/Backend/Services/AlarmKnowledgeBase.cs index 6573f36c4..15848c769 100644 --- a/csharp/App/Backend/Services/AlarmKnowledgeBase.cs +++ b/csharp/App/Backend/Services/AlarmKnowledgeBase.cs @@ -1,5 +1,3 @@ -using System.Collections.Frozen; - namespace InnovEnergy.App.Backend.Services; /// @@ -43,7 +41,7 @@ public static class AlarmKnowledgeBase // Register addresses: 0x1048 - 0x10D5 // Recovery types: AUTO (wait), MANUAL (fix and restart), SERVICE (contact service) - private static readonly FrozenDictionary SinexcelAlarms = new Dictionary + private static readonly IReadOnlyDictionary SinexcelAlarms = new Dictionary { // Grid-related alarms ["Abnormal grid voltage"] = new() @@ -958,12 +956,12 @@ public static class AlarmKnowledgeBase Causes = new[] { "Load exceeds generator capacity" }, NextSteps = new[] { "Reduce load", "Fix the cause, then restart" } }, - }.ToFrozenDictionary(); + }; // ── Growatt Alarms ─────────────────────────────────────────────────────── // Format: "Warning XXX" or "Error XXX" or descriptive text - private static readonly FrozenDictionary GrowattAlarms = new Dictionary + private static readonly IReadOnlyDictionary GrowattAlarms = new Dictionary { // Warnings (200-series: PV/String) ["Warning 200"] = new() @@ -1510,5 +1508,5 @@ public static class AlarmKnowledgeBase Causes = new[] { "Too many PV modules in series", "Cold temperature increasing Voc" }, NextSteps = new[] { "Disconnect DC switch immediately", "Check voltage", "Reconfigure strings if needed" } }, - }.ToFrozenDictionary(); + }; } diff --git a/csharp/App/Backend/Services/DiagnosticService.cs b/csharp/App/Backend/Services/DiagnosticService.cs index b2948f3de..ed0b2e30f 100644 --- a/csharp/App/Backend/Services/DiagnosticService.cs +++ b/csharp/App/Backend/Services/DiagnosticService.cs @@ -126,8 +126,7 @@ Reply with ONLY valid JSON, no markdown: }; var responseText = await MistralUrl - .SetHeader("Authorization", $"Bearer {_apiKey}") - .SetHeader("Content-Type", "application/json") + .WithHeader("Authorization", $"Bearer {_apiKey}") .PostJsonAsync(requestBody) .ReceiveString(); @@ -147,7 +146,7 @@ Reply with ONLY valid JSON, no markdown: } catch (FlurlHttpException httpEx) { - Console.Error.WriteLine($"[DiagnosticService] HTTP error {httpEx.Response?.StatusCode}: {await httpEx.Response?.GetStringAsync()}"); + Console.Error.WriteLine($"[DiagnosticService] HTTP error {httpEx.StatusCode}: {httpEx.Message}"); return null; } catch (Exception ex)