mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 07:57:59 +00:00
Ask before a change re-indexes local data sources
This commit is contained in:
1 file changed
+22
-1
@@ -116,6 +116,12 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
|
|||||||
[Inject]
|
[Inject]
|
||||||
private ILogger<EmbeddingProviderDialog> Logger { get; init; } = null!;
|
private ILogger<EmbeddingProviderDialog> Logger { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private DataSourceEmbeddingService DataSourceEmbeddingService { get; init; } = null!;
|
||||||
|
|
||||||
private static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();
|
private static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -293,7 +299,22 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId
|
|||||||
// When the data is not valid, we don't store it:
|
// When the data is not valid, we don't store it:
|
||||||
if (!this.dataIsValid)
|
if (!this.dataIsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ask before anything is written. Storing a tokenizer deletes the previous one before it
|
||||||
|
// copies, and the API key goes into the OS keyring right after, so asking any later would
|
||||||
|
// leave those changes behind even when the user says no. Saying no also keeps this dialog
|
||||||
|
// open, which is the point: the value which would have cost the index can be corrected
|
||||||
|
// right away.
|
||||||
|
//
|
||||||
|
// Enterprise-managed providers are left out. Every field which reaches the embedding
|
||||||
|
// signature is locked for them, and their data sources are not queued for indexing either.
|
||||||
|
//
|
||||||
|
if (this.IsEditing && !this.IsEnterpriseConfiguration && !await DataSourceReindexWarning.ConfirmEmbeddingProviderChangeAsync(
|
||||||
|
this.DialogService, this.SettingsManager, this.DataSourceEmbeddingService,
|
||||||
|
this.SettingsManager.GetEmbeddingProviderById(this.DataId), this.CreateEmbeddingProviderSettings()))
|
||||||
|
return;
|
||||||
|
|
||||||
var response = await this.StoreOrDeleteTokenizerAsync();
|
var response = await this.StoreOrDeleteTokenizerAsync();
|
||||||
if (!response.Success)
|
if (!response.Success)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user