mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 21:19:47 +00:00
Added programming languages
This commit is contained in:
parent
d9bc74b992
commit
e40d95f305
@ -18,4 +18,17 @@
|
|||||||
|
|
||||||
<PreviewPrototype/>
|
<PreviewPrototype/>
|
||||||
|
|
||||||
|
<MudStack Row="@true" AlignItems="AlignItems.Center" Class="mb-3">
|
||||||
|
<MudSelect T="ProgrammingLanguages" @bind-Value="@this.selectedProgrammingLanguage" AdornmentIcon="@Icons.Material.Filled.Code" Adornment="Adornment.Start" Label="Programming language" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateProgrammingLanguage">
|
||||||
|
@foreach (var language in Enum.GetValues<ProgrammingLanguages>())
|
||||||
|
{
|
||||||
|
<MudSelectItem Value="@language">@language.Name()</MudSelectItem>
|
||||||
|
}
|
||||||
|
</MudSelect>
|
||||||
|
@if (this.selectedProgrammingLanguage is ProgrammingLanguages.OTHER)
|
||||||
|
{
|
||||||
|
<MudTextField T="string" @bind-Text="@this.otherProgrammingLanguage" Validation="@this.ValidateOtherLanguage" Label="Other language" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
|
}
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
@ -1,7 +1,5 @@
|
|||||||
using AIStudio.Chat;
|
using AIStudio.Chat;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace AIStudio.Assistants.EDI;
|
namespace AIStudio.Assistants.EDI;
|
||||||
|
|
||||||
public partial class AssistantEDI : AssistantBaseCore
|
public partial class AssistantEDI : AssistantBaseCore
|
||||||
@ -43,4 +41,29 @@ public partial class AssistantEDI : AssistantBaseCore
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ProgrammingLanguages selectedProgrammingLanguage = ProgrammingLanguages.NONE;
|
||||||
|
private string otherProgrammingLanguage = string.Empty;
|
||||||
|
|
||||||
|
private string? ValidateProgrammingLanguage(ProgrammingLanguages language)
|
||||||
|
{
|
||||||
|
if (language == ProgrammingLanguages.OTHER)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (language == ProgrammingLanguages.NONE)
|
||||||
|
return "Please select a programming language for the EDI server.";
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? ValidateOtherLanguage(string language)
|
||||||
|
{
|
||||||
|
if(this.selectedProgrammingLanguage != ProgrammingLanguages.OTHER)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if(string.IsNullOrWhiteSpace(language))
|
||||||
|
return "Please specify the custom programming language for the EDI server.";
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
namespace AIStudio.Assistants.EDI;
|
||||||
|
|
||||||
|
public enum ProgrammingLanguages
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
|
||||||
|
C,
|
||||||
|
CPP,
|
||||||
|
CSHARP,
|
||||||
|
GO,
|
||||||
|
JAVA,
|
||||||
|
JAVASCRIPT,
|
||||||
|
JULIA,
|
||||||
|
MATLAB,
|
||||||
|
PHP,
|
||||||
|
PYTHON,
|
||||||
|
RUST,
|
||||||
|
|
||||||
|
OTHER,
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
namespace AIStudio.Assistants.EDI;
|
||||||
|
|
||||||
|
public static class ProgrammingLanguagesExtensions
|
||||||
|
{
|
||||||
|
public static string Name(this ProgrammingLanguages language) => language switch
|
||||||
|
{
|
||||||
|
ProgrammingLanguages.NONE => "None",
|
||||||
|
|
||||||
|
ProgrammingLanguages.C => "C",
|
||||||
|
ProgrammingLanguages.CPP => "C++",
|
||||||
|
ProgrammingLanguages.CSHARP => "C#",
|
||||||
|
ProgrammingLanguages.GO => "Go",
|
||||||
|
ProgrammingLanguages.JAVA => "Java",
|
||||||
|
ProgrammingLanguages.JAVASCRIPT => "JavaScript",
|
||||||
|
ProgrammingLanguages.JULIA => "Julia",
|
||||||
|
ProgrammingLanguages.MATLAB => "MATLAB",
|
||||||
|
ProgrammingLanguages.PHP => "PHP",
|
||||||
|
ProgrammingLanguages.PYTHON => "Python",
|
||||||
|
ProgrammingLanguages.RUST => "Rust",
|
||||||
|
|
||||||
|
ProgrammingLanguages.OTHER => "Other",
|
||||||
|
_ => "Unknown"
|
||||||
|
};
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
using AIStudio.Assistants.Coding;
|
using AIStudio.Assistants.EDI;
|
||||||
using AIStudio.Provider;
|
using AIStudio.Provider;
|
||||||
|
|
||||||
namespace AIStudio.Settings.DataModel;
|
namespace AIStudio.Settings.DataModel;
|
||||||
@ -13,7 +13,7 @@ public sealed class DataEDI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preselect the language for implementing the EDI?
|
/// Preselect the language for implementing the EDI?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CommonCodingLanguages PreselectedProgrammingLanguage { get; set; }
|
public ProgrammingLanguages PreselectedProgrammingLanguage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do you want to preselect any other language?
|
/// Do you want to preselect any other language?
|
||||||
|
Loading…
Reference in New Issue
Block a user