Documents can now be removed individually

This commit is contained in:
Peer Schütt 2025-11-17 17:26:22 +01:00
parent 01c48e14df
commit fe26495cd6
2 changed files with 22 additions and 1 deletions

View File

@ -8,7 +8,9 @@
</MudText>
@foreach (var fileInfo in this.DocumentPaths.Select(file => new FileInfo(file)))
{
<MudChip T="string" Color="Color.Dark" Text="@fileInfo.Name" tabindex="-1" />
<MudBadge Origin="Origin.TopCenter" Icon="@Icons.Material.Filled.Search" Color="Color.Primary" Overlap="true" Bordered="true" OnClick="@(() => this.InvestigateFile(@fileInfo))">
<MudChip T="string" Color="Color.Dark" Text="@fileInfo.Name" tabindex="-1" Icon="@Icons.Material.Filled.Search" OnClick="@(() => this.InvestigateFile(@fileInfo))" OnClose="@(() => this.RemoveDocumentPathFromDocumentPaths(@fileInfo))"/>
</MudBadge>
}
</MudPaper>
</MudLink>

View File

@ -151,4 +151,23 @@ public partial class AttachDocuments : MSGComponentBase
this.ClearDragClass();
this.StateHasChanged();
}
private async Task RemoveDocumentPathFromDocumentPaths(FileInfo file)
{
this.DocumentPaths.Remove(file.ToString());
await this.DocumentPathsChanged.InvokeAsync(this.DocumentPaths);
await this.OnChange(this.DocumentPaths);
}
/// <summary>
/// The user might want to check what the Pandoc integration actually extracts from his file and therefore gives the LLM as input.
/// </summary>
/// <param name="file">The file to check.</param>
private void InvestigateFile(FileInfo file)
{
# warning Implement Investigation of file
this.Logger.LogDebug("Investigate");
return;
}
}