Ensure unique names for embedding methods and retrieval processes

This commit is contained in:
tsommer committed 2024-12-27 13:28:48 +01:00
1 parent 67ab9c6d97
commit 36c65849ea
3 files changed
+23

No files matched your search

@@ -39,6 +39,12 @@ public partial class EmbeddingMethodDialog : ComponentBase
/// </summary>
[Parameter]
public string DataLink { get; set; } = string.Empty;
/// <summary>
/// The embedding method names that are already used. The user must choose a unique name.
/// </summary>
[Parameter]
public IReadOnlyList<string> UsedEmbeddingMethodNames { get; set; } = new List<string>();
/// <summary>
/// Should the dialog be in editing mode?
@@ -89,6 +95,9 @@ public partial class EmbeddingMethodDialog : ComponentBase
if (name.Length > 26)
return "The embedding name must not be longer than 26 characters.";
if (this.UsedEmbeddingMethodNames.Contains(name))
return $"The embedding method name '{name}' is already used. Please choose a unique name.";
return null;
}
@@ -47,6 +47,12 @@ public partial class RetrievalProcessDialog : ComponentBase
/// </summary>
[Parameter]
public IReadOnlyList<EmbeddingInfo> AvailableEmbeddings { get; set; } = new List<EmbeddingInfo>();
/// <summary>
/// The retrieval process names that are already used. The user must choose a unique name.
/// </summary>
[Parameter]
public IReadOnlyList<string> UsedRetrievalProcessNames { get; set; } = new List<string>();
/// <summary>
/// Should the dialog be in editing mode?
@@ -103,6 +109,9 @@ public partial class RetrievalProcessDialog : ComponentBase
if (name.Length > 26)
return "The retrieval process name must not be longer than 26 characters.";
if (this.UsedRetrievalProcessNames.Contains(name))
return $"The retrieval process name '{name}' must be unique. Please choose a different name.";
return null;
}