mudancinhas
All checks were successful
Mindforge API Build and Deploy / Build Mindforge API Image (push) Successful in 2m12s
Mindforge API Build and Deploy / Deploy Mindforge API (internal) (push) Successful in 8s
Mindforge Web Build and Deploy (internal) / Build Mindforge Web Image (push) Successful in 3m41s
Mindforge Web Build and Deploy (internal) / Deploy Mindforge Web (internal) (push) Successful in 8s

This commit is contained in:
2026-06-11 20:26:08 -03:00
parent b29ae991c8
commit 21186c9270
13 changed files with 927 additions and 82 deletions

View File

@@ -10,14 +10,13 @@ namespace Mindforge.API.Providers
{
public class OpenAIApiProvider : ILlmApiProvider
{
private readonly HttpClient _httpClient;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IConfiguration _configuration;
private readonly ILogger<OpenAIApiProvider> _logger;
public OpenAIApiProvider(HttpClient httpClient, IConfiguration configuration, ILogger<OpenAIApiProvider> logger)
public OpenAIApiProvider(IHttpClientFactory httpClientFactory, IConfiguration configuration, ILogger<OpenAIApiProvider> logger)
{
_httpClient = httpClient;
_httpClient.Timeout = TimeSpan.FromMinutes(5);
_httpClientFactory = httpClientFactory;
_configuration = configuration;
_logger = logger;
}
@@ -52,6 +51,9 @@ namespace Mindforge.API.Providers
Exception? lastErr = null;
using var httpClient = _httpClientFactory.CreateClient();
httpClient.Timeout = TimeSpan.FromMinutes(5);
for (int i = 0; i < 5; i++)
{
using var request = new HttpRequestMessage(HttpMethod.Post, url);
@@ -60,7 +62,7 @@ namespace Mindforge.API.Providers
try
{
var response = await _httpClient.SendAsync(request);
var response = await httpClient.SendAsync(request);
var responseBody = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)