mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 21:39:46 +00:00
Fixed deleting a used embedding method
This commit is contained in:
parent
36c65849ea
commit
c7b207e13e
@ -454,9 +454,13 @@ public partial class AssistantERI : AssistantBaseCore
|
|||||||
|
|
||||||
private async Task DeleteEmbedding(EmbeddingInfo embeddingInfo)
|
private async Task DeleteEmbedding(EmbeddingInfo embeddingInfo)
|
||||||
{
|
{
|
||||||
|
var message = this.retrievalProcesses.Any(n => n.Embeddings?.Contains(embeddingInfo) is true)
|
||||||
|
? $"The embedding '{embeddingInfo.EmbeddingName}' is used in one or more retrieval processes. Are you sure you want to delete it?"
|
||||||
|
: $"Are you sure you want to delete the embedding '{embeddingInfo.EmbeddingName}'?";
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters
|
var dialogParameters = new DialogParameters
|
||||||
{
|
{
|
||||||
{ "Message", $"Are you sure you want to delete the embedding '{embeddingInfo.EmbeddingName}'?" },
|
{ "Message", message },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Embedding", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Embedding", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
@ -464,7 +468,9 @@ public partial class AssistantERI : AssistantBaseCore
|
|||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this.retrievalProcesses.ForEach(n => n.Embeddings?.Remove(embeddingInfo));
|
||||||
this.embeddings.Remove(embeddingInfo);
|
this.embeddings.Remove(embeddingInfo);
|
||||||
|
|
||||||
await this.AutoSave();
|
await this.AutoSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user