Add preview functionality for file attachments in ReviewAttachmentsDialog

This commit is contained in:
Thorsten Sommer 2025-12-30 17:28:01 +01:00
parent 9df0744d09
commit 684da62983
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 39 additions and 16 deletions

View File

@ -46,19 +46,24 @@
</MudTooltip> </MudTooltip>
</div> </div>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom"> <MudToolBar WrapContent="true" Gutters="false" Class="ml-2" Style="flex-shrink: 0; min-height: 1em;">
<MudIconButton Icon="@Icons.Material.Filled.Delete" <MudTooltip Text="@T("Preview what we send to the AI.")" Placement="Placement.Bottom">
Color="Color.Error" <MudIconButton Icon="@Icons.Material.Filled.Search"
Class="ml-2" Color="Color.Primary"
Style="flex-shrink: 0;" OnClick="@(() => this.InvestigateFile(fileAttachment))"/>
OnClick="@(() => this.DeleteAttachment(fileAttachment))"/> </MudTooltip>
</MudTooltip>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.Delete"
Color="Color.Error"
OnClick="@(() => this.DeleteAttachment(fileAttachment))"/>
</MudTooltip>
</MudToolBar>
</MudStack> </MudStack>
} }
else else
{ {
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="ms-3 mb-2"> <MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="ms-3">
<div style="min-width: 0; flex: 1; overflow: hidden;"> <div style="min-width: 0; flex: 1; overflow: hidden;">
<MudTooltip Text="@T("The file was deleted, renamed, or moved.")" Placement="Placement.Bottom"> <MudTooltip Text="@T("The file was deleted, renamed, or moved.")" Placement="Placement.Bottom">
<span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;"> <span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;">
@ -70,13 +75,17 @@
</MudTooltip> </MudTooltip>
</div> </div>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom"> <MudToolBar WrapContent="true" Gutters="false" Class="ml-2" Style="flex-shrink: 0; min-height: 1em;">
<MudIconButton Icon="@Icons.Material.Filled.Delete" <MudIconButton Icon="@Icons.Material.Filled.Search"
Color="Color.Error" Color="Color.Primary"
Class="ml-2" Disabled="true"/>
Style="flex-shrink: 0;"
OnClick="@(() => this.DeleteAttachment(fileAttachment))"/> <MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
</MudTooltip> <MudIconButton Icon="@Icons.Material.Filled.Delete"
Color="Color.Error"
OnClick="@(() => this.DeleteAttachment(fileAttachment))"/>
</MudTooltip>
</MudToolBar>
</MudStack> </MudStack>
} }
} }

View File

@ -46,4 +46,18 @@ public partial class ReviewAttachmentsDialog : MSGComponentBase
this.StateHasChanged(); this.StateHasChanged();
} }
} }
/// <summary>
/// The user might want to check what we actually extract from his file and therefore give the LLM as an input.
/// </summary>
/// <param name="fileAttachment">The file to check.</param>
private async Task InvestigateFile(FileAttachment fileAttachment)
{
var dialogParameters = new DialogParameters<DocumentCheckDialog>
{
{ x => x.Document, fileAttachment },
};
await this.DialogService.ShowAsync<DocumentCheckDialog>(T("Document Preview"), dialogParameters, DialogOptions.FULLSCREEN);
}
} }