Fixes for file attachments (#603)
Some checks are pending
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer 2025-12-18 17:40:18 +01:00 committed by GitHub
parent 759a073021
commit aaca34ed7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 15 additions and 16 deletions

View File

@ -68,9 +68,9 @@ else
</MudStack>
<div @onmouseenter="@this.OnMouseEnter" @onmouseleave="@this.OnMouseLeave">
<MudPaper Height="20em" Outlined="true" Class="@this.dragClass" Style="overflow-y: auto;">
@foreach (var fileInfo in this.DocumentPaths.Select(file => new FileInfo(file)))
@foreach (var filePath in this.DocumentPaths)
{
<MudChip T="string" Color="Color.Dark" Text="@fileInfo.Name" tabindex="-1" Icon="@Icons.Material.Filled.Search" OnClick="@(() => this.InvestigateFile(@fileInfo))" OnClose="@(() => this.RemoveDocumentPathFromDocumentPaths(@fileInfo))"/>
<MudChip T="string" Color="Color.Dark" Text="@Path.GetFileName(filePath)" tabindex="-1" Icon="@Icons.Material.Filled.Search" OnClick="@(() => this.InvestigateFile(filePath))" OnClose="@(() => this.RemoveDocument(filePath))"/>
}
</MudPaper>
</div>

View File

@ -158,7 +158,7 @@ public partial class AttachDocuments : MSGComponentBase
continue;
if (!await FileExtensionValidation.IsExtensionValidWithNotifyAsync(selectedFilePath))
return;
continue;
this.DocumentPaths.Add(selectedFilePath);
}
@ -199,9 +199,9 @@ public partial class AttachDocuments : MSGComponentBase
this.StateHasChanged();
}
private async Task RemoveDocumentPathFromDocumentPaths(FileInfo file)
private async Task RemoveDocument(string filePath)
{
this.DocumentPaths.Remove(file.ToString());
this.DocumentPaths.Remove(filePath);
await this.DocumentPathsChanged.InvokeAsync(this.DocumentPaths);
await this.OnChange(this.DocumentPaths);
@ -210,12 +210,12 @@ public partial class AttachDocuments : MSGComponentBase
/// <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="file">The file to check.</param>
private async Task InvestigateFile(FileInfo file)
/// <param name="filePath">The file to check.</param>
private async Task InvestigateFile(string filePath)
{
var dialogParameters = new DialogParameters<DocumentCheckDialog>
{
{ x => x.FilePath, file.FullName },
{ x => x.FilePath, filePath },
};
await this.DialogService.ShowAsync<DocumentCheckDialog>(T("Document Preview"), dialogParameters, DialogOptions.FULLSCREEN);

View File

@ -1,11 +1,6 @@
@inherits MSGComponentBase
<MudDialog>
<TitleContent>
<MudText Typo="Typo.h4">
@T("Your attached files")
</MudText>
</TitleContent>
<DialogContent>
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
@T("Here you can see all attached files. Files that can no longer be found (deleted, renamed, or moved) are marked with a warning icon and a strikethrough name. You can remove any attachment using the trash can icon.")

View File

@ -1,10 +1,14 @@
using AIStudio.Components;
using AIStudio.Tools.PluginSystem;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Dialogs;
public partial class ReviewAttachmentsDialog : MSGComponentBase
{
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ReviewAttachmentsDialog).Namespace, nameof(ReviewAttachmentsDialog));
[CascadingParameter]
private IMudDialogInstance MudDialog { get; set; } = null!;
@ -23,7 +27,7 @@ public partial class ReviewAttachmentsDialog : MSGComponentBase
{ x => x.DocumentPaths, documentPaths }
};
var dialogReference = await dialogService.ShowAsync<ReviewAttachmentsDialog>("Your attached documents", dialogParameters, DialogOptions.FULLSCREEN);
var dialogReference = await dialogService.ShowAsync<ReviewAttachmentsDialog>(TB("Your attached files"), dialogParameters, DialogOptions.FULLSCREEN);
var dialogResult = await dialogReference.Result;
if (dialogResult is null || dialogResult.Canceled)
return documentPaths;

View File

@ -3436,7 +3436,7 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::RETRIEVALPROCESSDIALOG::T951463987"] = "Einb
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T1746160064"] = "Hier sehen Sie alle angehängten Dateien. Dateien, die nicht mehr gefunden werden können (gelöscht, umbenannt oder verschoben), sind mit einem Warnsymbol und einem durchgestrichenen Namen markiert. Sie können jeden Anhang über das Papierkorbsymbol entfernen."
-- There aren't any file attachments available right now.
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T2111340711"] = "Derzeit sind keine Dateianhänge verfügbar."
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T2111340711"] = "Derzeit sind keine Dateianhänge vorhanden."
-- The file was deleted, renamed, or moved.
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T3083729256"] = "Die Datei wurde gelöscht, umbenannt oder verschoben."

View File

@ -3436,7 +3436,7 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::RETRIEVALPROCESSDIALOG::T951463987"] = "Embe
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T1746160064"] = "Here you can see all attached files. Files that can no longer be found (deleted, renamed, or moved) are marked with a warning icon and a strikethrough name. You can remove any attachment using the trash can icon."
-- There aren't any file attachments available right now.
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T2111340711"] = "There aren't any file attachments available right now."
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T2111340711"] = "There aren't any file attachments right now."
-- The file was deleted, renamed, or moved.
UI_TEXT_CONTENT["AISTUDIO::DIALOGS::REVIEWATTACHMENTSDIALOG::T3083729256"] = "The file was deleted, renamed, or moved."