Try catches, ensuring SuccessStatusCode

This commit is contained in:
Nickk888 committed 2026-10-12 17:02:40 +02:00
1 parent 8b476e6939
commit 4494a2a202
4 files changed
+43 -20

No files matched your search

+2
View File
@@ -24,6 +24,7 @@ public class LLMAgentService(ApiService apiService, Configuration config, ILogge
Reasoning = config.Reasoning
};
var response = await apiService.Post("chat", content);
response.EnsureSuccessStatusCode();
// Response
var contentMessage = await response.Content.ReadAsStringAsync();
@@ -55,6 +56,7 @@ public class LLMAgentService(ApiService apiService, Configuration config, ILogge
};
var response = await apiService.Post("models/unload", content);
response.EnsureSuccessStatusCode();
var message = await response.Content.ReadAsStringAsync();
logger.LogInformation(message);
}