From 169e1cb6013dbe8007cb8bfad6e96d2babfe0930 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 27 Dec 2024 13:14:49 +0100 Subject: [PATCH] Limit the embedding name and type length --- app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor | 6 ++++++ .../Dialogs/EmbeddingMethodDialog.razor.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor b/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor index 0fe1b64b..5d8da890 100644 --- a/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor +++ b/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor @@ -12,6 +12,9 @@ AdornmentIcon="@Icons.Material.Filled.Label" AdornmentColor="Color.Info" Validation="@this.ValidateName" + Counter="26" + MaxLength="26" + Immediate="@true" UserAttributes="@SPELLCHECK_ATTRIBUTES" /> @@ -24,7 +27,10 @@ Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Extension" AdornmentColor="Color.Info" + Counter="56" + MaxLength="56" Validation="@this.ValidateType" + Immediate="@true" UserAttributes="@SPELLCHECK_ATTRIBUTES" /> diff --git a/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor.cs b/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor.cs index 2b394f5f..5fbec1ca 100644 --- a/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/EmbeddingMethodDialog.razor.cs @@ -86,6 +86,9 @@ public partial class EmbeddingMethodDialog : ComponentBase if (string.IsNullOrWhiteSpace(name)) return "The embedding name must not be empty. Please name the embedding."; + if (name.Length > 26) + return "The embedding name must not be longer than 26 characters."; + return null; } @@ -94,6 +97,9 @@ public partial class EmbeddingMethodDialog : ComponentBase if (string.IsNullOrWhiteSpace(type)) return "The embedding type must not be empty. Please specify the embedding type."; + if (type.Length > 56) + return "The embedding type must not be longer than 56 characters."; + return null; }