mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 19:19:47 +00:00
Implemented preselection of coding assistant settings
This commit is contained in:
parent
2cc21083fa
commit
6169c244d0
@ -29,6 +29,21 @@ public partial class AssistantCoding : AssistantBaseCore
|
|||||||
private string compilerMessages = string.Empty;
|
private string compilerMessages = string.Empty;
|
||||||
private string questions = 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)
|
private string? ValidatingCompilerMessages(string checkCompilerMessages)
|
||||||
{
|
{
|
||||||
if(!this.provideCompilerMessages)
|
if(!this.provideCompilerMessages)
|
||||||
@ -53,6 +68,8 @@ public partial class AssistantCoding : AssistantBaseCore
|
|||||||
this.codingContexts.Add(new()
|
this.codingContexts.Add(new()
|
||||||
{
|
{
|
||||||
Id = $"Context {this.codingContexts.Count + 1}",
|
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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@page "/settings"
|
@page "/settings"
|
||||||
|
@using AIStudio.Components.Pages.Coding
|
||||||
@using AIStudio.Provider
|
@using AIStudio.Provider
|
||||||
@using AIStudio.Settings
|
@using AIStudio.Settings
|
||||||
@using AIStudio.Tools
|
@using AIStudio.Tools
|
||||||
@ -99,5 +100,17 @@
|
|||||||
}
|
}
|
||||||
<ConfigurationProviderSelection Data="@this.availableProviders" Disabled="@(() => !this.SettingsManager.ConfigurationData.PreselectTranslationOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.PreselectedTranslationProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.PreselectedTranslationProvider = selectedValue)"/>
|
<ConfigurationProviderSelection Data="@this.availableProviders" Disabled="@(() => !this.SettingsManager.ConfigurationData.PreselectTranslationOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.PreselectedTranslationProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.PreselectedTranslationProvider = selectedValue)"/>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
|
|
||||||
|
<MudText Typo="Typo.h5" Class="mb-3">Coding Options</MudText>
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<ConfigurationOption OptionDescription="Preselect coding options?" LabelOn="Coding options are preselected" LabelOff="No coding options are preselected" State="@(() => this.SettingsManager.ConfigurationData.PreselectCodingOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.PreselectCodingOptions = updatedState)" OptionHelp="When enabled, you can preselect the coding options. This is might be useful when you prefer a specific programming language or LLM model."/>
|
||||||
|
<ConfigurationOption OptionDescription="Preselect compiler messages?" Disabled="@(() => !this.SettingsManager.ConfigurationData.PreselectCodingOptions)" LabelOn="Compiler messages are preselected" LabelOff="Compiler messages are not preselected" State="@(() => this.SettingsManager.ConfigurationData.PreselectCodingCompilerMessages)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.PreselectCodingCompilerMessages = updatedState)" />
|
||||||
|
<ConfigurationSelect OptionDescription="Preselected programming language" Disabled="@(() => !this.SettingsManager.ConfigurationData.PreselectCodingOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.PreselectedCodingLanguage)" Data="@ConfigurationSelectDataFactory.GetCommonCodingLanguagesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.PreselectedCodingLanguage = selectedValue)" OptionHelp="Which programming language should be preselected for added contexts?"/>
|
||||||
|
@if (this.SettingsManager.ConfigurationData.PreselectedCodingLanguage is CommonCodingLanguages.OTHER)
|
||||||
|
{
|
||||||
|
<ConfigurationText OptionDescription="Preselected other programming language" Disabled="@(() => !this.SettingsManager.ConfigurationData.PreselectCodingOptions)" Icon="@Icons.Material.Filled.Code" Text="@(() => this.SettingsManager.ConfigurationData.PreselectedCodingOtherLanguage)" TextUpdate="@(updatedText => this.SettingsManager.ConfigurationData.PreselectedCodingOtherLanguage = updatedText)"/>
|
||||||
|
}
|
||||||
|
<ConfigurationProviderSelection Data="@this.availableProviders" Disabled="@(() => !this.SettingsManager.ConfigurationData.PreselectCodingOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.PreselectedCodingProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.PreselectedCodingProvider = selectedValue)"/>
|
||||||
|
</MudPaper>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
</InnerScrolling>
|
</InnerScrolling>
|
@ -1,3 +1,4 @@
|
|||||||
|
using AIStudio.Components.Pages.Coding;
|
||||||
using AIStudio.Components.Pages.IconFinder;
|
using AIStudio.Components.Pages.IconFinder;
|
||||||
using AIStudio.Settings.DataModel;
|
using AIStudio.Settings.DataModel;
|
||||||
using AIStudio.Tools;
|
using AIStudio.Tools;
|
||||||
@ -69,4 +70,10 @@ public static class ConfigurationSelectDataFactory
|
|||||||
foreach (var language in Enum.GetValues<CommonLanguages>())
|
foreach (var language in Enum.GetValues<CommonLanguages>())
|
||||||
yield return new(language.Name(), language);
|
yield return new(language.Name(), language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<ConfigurationSelectData<CommonCodingLanguages>> GetCommonCodingLanguagesData()
|
||||||
|
{
|
||||||
|
foreach (var language in Enum.GetValues<CommonCodingLanguages>())
|
||||||
|
yield return new(language.Name(), language);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using AIStudio.Components.Pages.Coding;
|
||||||
using AIStudio.Components.Pages.IconFinder;
|
using AIStudio.Components.Pages.IconFinder;
|
||||||
using AIStudio.Tools;
|
using AIStudio.Tools;
|
||||||
|
|
||||||
@ -124,4 +125,33 @@ public sealed class Data
|
|||||||
public string PreselectedTranslationProvider { get; set; } = string.Empty;
|
public string PreselectedTranslationProvider { get; set; } = string.Empty;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Assistant: Coding Settings
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preselect any coding options?
|
||||||
|
/// </summary>
|
||||||
|
public bool PreselectCodingOptions { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preselect the compiler messages?
|
||||||
|
/// </summary>
|
||||||
|
public bool PreselectCodingCompilerMessages { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preselect the coding language for new contexts?
|
||||||
|
/// </summary>
|
||||||
|
public CommonCodingLanguages PreselectedCodingLanguage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Do you want to preselect any other language?
|
||||||
|
/// </summary>
|
||||||
|
public string PreselectedCodingOtherLanguage { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Which coding provider should be preselected?
|
||||||
|
/// </summary>
|
||||||
|
public string PreselectedCodingProvider { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
# v0.8.4, build 167
|
# v0.8.4, build 167
|
||||||
- Added the possibility to provide default options for the icon finder assistant
|
- Added the possibility to provide default options for the icon finder assistant
|
||||||
- Added the possibility to provide default options for the translation assistant
|
- Added the possibility to provide default options for the translation assistant
|
||||||
|
- Added the possibility to provide default options for the coding assistant
|
||||||
- Improved switch component for settings: when an option is enabled, the switch is using a different color
|
- Improved switch component for settings: when an option is enabled, the switch is using a different color
|
||||||
- Fixed the applying of spellchecking settings to the single-line dialog
|
- Fixed the applying of spellchecking settings to the single-line dialog
|
||||||
- Restructured the layout of the settings page
|
- Restructured the layout of the settings page
|
||||||
|
Loading…
Reference in New Issue
Block a user