From 2aa912f23fd9739305897e44ce4e8b5d08a9c488 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 4 Dec 2024 21:19:59 +0100 Subject: [PATCH] Added data sources --- .../Assistants/EDI/AssistantEDI.razor | 13 ++++++++++ .../Assistants/EDI/AssistantEDI.razor.cs | 24 +++++++++++++++++++ .../Assistants/EDI/DataSources.cs | 14 +++++++++++ .../Assistants/EDI/DataSourcesExtensions.cs | 19 +++++++++++++++ .../Settings/DataModel/DataEDI.cs | 10 ++++++++ 5 files changed, 80 insertions(+) create mode 100644 app/MindWork AI Studio/Assistants/EDI/DataSources.cs create mode 100644 app/MindWork AI Studio/Assistants/EDI/DataSourcesExtensions.cs diff --git a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor index dd994681..fc6af704 100644 --- a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor +++ b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor @@ -31,4 +31,17 @@ } + + + @foreach (var dataSource in Enum.GetValues()) + { + @dataSource.Name() + } + + @if (this.selectedDataSource is DataSources.CUSTOM) + { + + } + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs index 267c86b7..7a5f2b53 100644 --- a/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs +++ b/app/MindWork AI Studio/Assistants/EDI/AssistantEDI.razor.cs @@ -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; + } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/EDI/DataSources.cs b/app/MindWork AI Studio/Assistants/EDI/DataSources.cs new file mode 100644 index 00000000..33e788f4 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/EDI/DataSources.cs @@ -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, +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Assistants/EDI/DataSourcesExtensions.cs b/app/MindWork AI Studio/Assistants/EDI/DataSourcesExtensions.cs new file mode 100644 index 00000000..27062768 --- /dev/null +++ b/app/MindWork AI Studio/Assistants/EDI/DataSourcesExtensions.cs @@ -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" + }; +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs b/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs index dcfd8fde..35297174 100644 --- a/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs +++ b/app/MindWork AI Studio/Settings/DataModel/DataEDI.cs @@ -20,6 +20,16 @@ public sealed class DataEDI /// public string PreselectedOtherProgrammingLanguage { get; set; } = string.Empty; + /// + /// Preselect a data source? + /// + public DataSources PreselectedDataSource { get; set; } + + /// + /// Do you want to preselect any other data source? + /// + public string PreselectedOtherDataSource { get; set; } = string.Empty; + /// /// The minimum confidence level required for a provider to be considered. ///