mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 23:07:23 +00:00
Improved adding local data sources without an embedding provider (#1084)
This commit is contained in:
1 parent
bca9e7ea89
commit
92fa0d08ef
20 files changed
+590
-154
No files matched your search
@@ -46,9 +46,6 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
|
||||
[Parameter]
|
||||
public bool LockSource { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public IReadOnlyList<ConfigurationSelectData<string>> AvailableEmbeddings { get; set; } = [];
|
||||
|
||||
[Inject]
|
||||
private IDialogService DialogService { get; init; } = null!;
|
||||
|
||||
@@ -370,12 +367,6 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
|
||||
? Icons.Material.Outlined.HourglassEmpty
|
||||
: this.testFailure is null ? Icons.Material.Outlined.CheckCircle : Icons.Material.Outlined.Error;
|
||||
|
||||
private EmbeddingProvider? GetEmbeddingProvider(string providerId)
|
||||
{
|
||||
var provider = this.SettingsManager.GetEmbeddingProviderById(providerId);
|
||||
return provider == EmbeddingProvider.NONE ? null : provider;
|
||||
}
|
||||
|
||||
private EmbeddingProvider? SelectedEmbedding => this.SettingsManager.ConfigurationData.EmbeddingProviders
|
||||
.FirstOrDefault(x => x.Id == this.dataEmbeddingId);
|
||||
|
||||
@@ -745,5 +736,22 @@ public partial class DataSourceMailboxDialog : MSGComponentBase
|
||||
this.revalidateAfterRender = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the embedding provider the user just added from within this dialog, so that what they
|
||||
/// entered so far, the password and the tested connection included, can be saved right away.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only when no existing provider is selected, which includes the provider of a mailbox that was
|
||||
/// deleted since. Like the token limit in ToggleExpertSettings, the field learns its new value only
|
||||
/// with the next render, so it is checked after that.
|
||||
/// </remarks>
|
||||
private void SelectAddedEmbeddingProvider(EmbeddingProvider provider)
|
||||
{
|
||||
if (this.SelectedEmbedding is null)
|
||||
this.dataEmbeddingId = provider.Id;
|
||||
|
||||
this.revalidateAfterRender = true;
|
||||
}
|
||||
|
||||
private string GetExpertStyles => this.showExpertSettings ? "border-2 border-dashed rounded pa-2" : string.Empty;
|
||||
}
|
||||
Reference in new issue
Block a user