Correction
This commit is contained in:
22
Program.cs
22
Program.cs
@@ -4,6 +4,7 @@ using administration.Models.HelloFresh;
|
|||||||
using administration.Services;
|
using administration.Services;
|
||||||
using IngredientsAI.Services;
|
using IngredientsAI.Services;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@@ -94,13 +95,21 @@ namespace administration
|
|||||||
var baseUrl = cfg["Ollama:Url"] ?? "http://ollama:11434";
|
var baseUrl = cfg["Ollama:Url"] ?? "http://ollama:11434";
|
||||||
client.BaseAddress = new Uri(baseUrl);
|
client.BaseAddress = new Uri(baseUrl);
|
||||||
client.Timeout = TimeSpan.FromSeconds(25);
|
client.Timeout = TimeSpan.FromSeconds(25);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
var ollamaBuilder = builder.Services.AddHttpClient("ollama", (sp, client) =>
|
||||||
|
{
|
||||||
|
var cfg = sp.GetRequiredService<IConfiguration>();
|
||||||
|
var baseUrl = cfg["Ollama:Url"] ?? "http://ollama:11434";
|
||||||
|
client.BaseAddress = new Uri(baseUrl);
|
||||||
|
client.Timeout = TimeSpan.FromSeconds(25);
|
||||||
|
});
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
|
ollamaBuilder.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
|
||||||
{
|
{
|
||||||
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
|
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
// ...
|
// ...
|
||||||
@@ -118,6 +127,7 @@ namespace administration
|
|||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto });
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors("AllowFrontend");
|
app.UseCors("AllowFrontend");
|
||||||
|
|||||||
Reference in New Issue
Block a user