Added data sources

This commit is contained in:
Thorsten Sommer 2024-12-04 21:19:59 +01:00
parent e40d95f305
commit 2aa912f23f
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
5 changed files with 80 additions and 0 deletions

View File

@ -31,4 +31,17 @@
} }
</MudStack> </MudStack>
<MudStack Row="@false" AlignItems="AlignItems.Stretch" Class="mb-3">
<MudSelect T="DataSources" @bind-Value="@this.selectedDataSource" AdornmentIcon="@Icons.Material.Filled.Dataset" Adornment="Adornment.Start" Label="Data source" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateDataSource">
@foreach (var dataSource in Enum.GetValues<DataSources>())
{
<MudSelectItem Value="@dataSource">@dataSource.Name()</MudSelectItem>
}
</MudSelect>
@if (this.selectedDataSource is DataSources.CUSTOM)
{
<MudTextField T="string" @bind-Text="@this.otherDataSource" Validation="@this.ValidateOtherDataSource" Label="Describe your data source" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
}
</MudStack>
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/> <ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>

View File

@ -44,6 +44,8 @@ public partial class AssistantEDI : AssistantBaseCore
private ProgrammingLanguages selectedProgrammingLanguage = ProgrammingLanguages.NONE; private ProgrammingLanguages selectedProgrammingLanguage = ProgrammingLanguages.NONE;
private string otherProgrammingLanguage = string.Empty; private string otherProgrammingLanguage = string.Empty;
private DataSources selectedDataSource = DataSources.NONE;
private string otherDataSource = string.Empty;
private string? ValidateProgrammingLanguage(ProgrammingLanguages language) private string? ValidateProgrammingLanguage(ProgrammingLanguages language)
{ {
@ -66,4 +68,26 @@ public partial class AssistantEDI : AssistantBaseCore
return null; return null;
} }
private string? ValidateDataSource(DataSources dataSource)
{
if (dataSource == DataSources.CUSTOM)
return null;
if (dataSource == DataSources.NONE)
return "Please select a data source for the EDI server.";
return null;
}
private string? ValidateOtherDataSource(string dataSource)
{
if(this.selectedDataSource != DataSources.CUSTOM)
return null;
if(string.IsNullOrWhiteSpace(dataSource))
return "Please describe the data source of your EDI server.";
return null;
}
} }

View File

@ -0,0 +1,14 @@
namespace AIStudio.Assistants.EDI;
public enum DataSources
{
NONE,
CUSTOM,
FILE_SYSTEM,
OBJECT_STORAGE,
KEY_VALUE_STORE,
DOCUMENT_STORE,
RELATIONAL_DATABASE,
GRAPH_DATABASE,
}

View File

@ -0,0 +1,19 @@
namespace AIStudio.Assistants.EDI;
public static class DataSourcesExtensions
{
public static string Name(this DataSources dataSource) => dataSource switch
{
DataSources.NONE => "No data source selected",
DataSources.CUSTOM => "Custom description",
DataSources.FILE_SYSTEM => "File system (local or network share)",
DataSources.OBJECT_STORAGE => "Object storage, like Amazon S3, MinIO, etc.",
DataSources.KEY_VALUE_STORE => "Key-Value store, like Redis, etc.",
DataSources.DOCUMENT_STORE => "Document store, like MongoDB, etc.",
DataSources.RELATIONAL_DATABASE => "Relational database, like MySQL, PostgreSQL, etc.",
DataSources.GRAPH_DATABASE => "Graph database, like Neo4j, ArangoDB, etc.",
_ => "Unknown data source"
};
}

View File

@ -20,6 +20,16 @@ public sealed class DataEDI
/// </summary> /// </summary>
public string PreselectedOtherProgrammingLanguage { get; set; } = string.Empty; public string PreselectedOtherProgrammingLanguage { get; set; } = string.Empty;
/// <summary>
/// Preselect a data source?
/// </summary>
public DataSources PreselectedDataSource { get; set; }
/// <summary>
/// Do you want to preselect any other data source?
/// </summary>
public string PreselectedOtherDataSource { get; set; } = string.Empty;
/// <summary> /// <summary>
/// The minimum confidence level required for a provider to be considered. /// The minimum confidence level required for a provider to be considered.
/// </summary> /// </summary>