mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 17:39:47 +00:00
Added data sources
This commit is contained in:
parent
e40d95f305
commit
2aa912f23f
@ -31,4 +31,17 @@
|
||||
}
|
||||
</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"/>
|
@ -44,6 +44,8 @@ public partial class AssistantEDI : AssistantBaseCore
|
||||
|
||||
private ProgrammingLanguages selectedProgrammingLanguage = ProgrammingLanguages.NONE;
|
||||
private string otherProgrammingLanguage = string.Empty;
|
||||
private DataSources selectedDataSource = DataSources.NONE;
|
||||
private string otherDataSource = string.Empty;
|
||||
|
||||
private string? ValidateProgrammingLanguage(ProgrammingLanguages language)
|
||||
{
|
||||
@ -66,4 +68,26 @@ public partial class AssistantEDI : AssistantBaseCore
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
14
app/MindWork AI Studio/Assistants/EDI/DataSources.cs
Normal file
14
app/MindWork AI Studio/Assistants/EDI/DataSources.cs
Normal 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,
|
||||
}
|
@ -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"
|
||||
};
|
||||
}
|
@ -20,6 +20,16 @@ public sealed class DataEDI
|
||||
/// </summary>
|
||||
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>
|
||||
/// The minimum confidence level required for a provider to be considered.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user