Add default configuration for assistants (#52)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-07-28 11:20:00 +02:00
1 parent a1c4618796
commit b3b8bf23dc
42 files changed
+729 -138

No files matched your search

@@ -16,7 +16,7 @@
</MudButton>
<MudStack Row="@false" Class="mb-3">
<MudSwitch T="bool" @bind-Value="@this.provideCompilerMessages">
<MudSwitch T="bool" @bind-Value="@this.provideCompilerMessages" Color="Color.Primary">
@(this.provideCompilerMessages ? "Provide compiler messages" : "Provide no compiler messages")
</MudSwitch>
@if (this.provideCompilerMessages)
@@ -28,7 +28,22 @@ public partial class AssistantCoding : AssistantBaseCore
private bool provideCompilerMessages;
private string compilerMessages = string.Empty;
private string questions = string.Empty;
#region Overrides of ComponentBase
protected override async Task OnInitializedAsync()
{
if (this.SettingsManager.ConfigurationData.PreselectCodingOptions)
{
this.provideCompilerMessages = this.SettingsManager.ConfigurationData.PreselectCodingCompilerMessages;
this.providerSettings = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == this.SettingsManager.ConfigurationData.PreselectedCodingProvider);
}
await base.OnInitializedAsync();
}
#endregion
private string? ValidatingCompilerMessages(string checkCompilerMessages)
{
if(!this.provideCompilerMessages)
@@ -53,6 +68,8 @@ public partial class AssistantCoding : AssistantBaseCore
this.codingContexts.Add(new()
{
Id = $"Context {this.codingContexts.Count + 1}",
Language = this.SettingsManager.ConfigurationData.PreselectCodingOptions ? this.SettingsManager.ConfigurationData.PreselectedCodingLanguage : default,
OtherLanguage = this.SettingsManager.ConfigurationData.PreselectCodingOptions ? this.SettingsManager.ConfigurationData.PreselectedCodingOtherLanguage : string.Empty,
});
}