Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
- DatabaseSettings__DBProvider=${DB_PROVIDER}
- DatabaseSettings__ConnectionString=${DB_CONNECTION_STRING}
- AISettings__GeminiApiKey=${GEMINI_API_KEY}
- AISettings__OpenAIApiKey=${OPENAI_API_KEY}
- SmtpClientOptions__UserName=${SMTP_USERNAME}
- SmtpClientOptions__Port=${SMTP_PORT}
- SmtpClientOptions__Host=${SMTP_HOST}
Expand Down
8 changes: 6 additions & 2 deletions src/Application/Common/Interfaces/IAISettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace CleanArchitecture.Blazor.Application.Common.Interfaces;
namespace CleanArchitecture.Blazor.Application.Common.Interfaces;

/// <summary>
/// AI configuration settings interface
Expand All @@ -9,4 +9,8 @@ public interface IAISettings
/// Gets the Gemini API key
/// </summary>
string GeminiApiKey { get; }
}
/// <summary>
/// Gets the API key used to authenticate requests to the OpenAI service.
/// </summary>
string OpenAIApiKey { get; }
}
7 changes: 7 additions & 0 deletions src/Infrastructure/Configurations/AISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ public class AISettings : IAISettings
/// Gets or sets the Gemini API key
/// </summary>
public string GeminiApiKey { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the API key used to authenticate requests to the OpenAI service.
/// </summary>
/// <remarks>The API key must be valid and authorized for the intended OpenAI operations. Storing
/// sensitive credentials such as API keys should be done securely to prevent unauthorized access.</remarks>
public string OpenAIApiKey { get; set; } = string.Empty;
}
4 changes: 4 additions & 0 deletions src/Server.UI/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using MudBlazor.Services;
using QuestPDF;
using QuestPDF.Infrastructure;
using Betalgo.Ranul.OpenAI.Extensions;



Expand Down Expand Up @@ -103,6 +104,9 @@ public static IServiceCollection AddServerUI(this IServiceCollection services, I
c.DefaultRequestHeaders.Add("x-goog-api-key", aiSettings.GeminiApiKey);

});
services.AddOpenAIService(s => {
s.ApiKey = config.GetValue<string>("AISettings:OpenAIApiKey")??string.Empty;
});
services.AddScoped<LocalTimeOffset>();
services.AddScoped<HubClient>();
services
Expand Down
Loading
Loading