From aaca34ed7ee62037419610c4897728ae0b59205b Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 18 Dec 2025 17:40:18 +0100 Subject: [PATCH] Fixes for file attachments (#603) --- .../Components/AttachDocuments.razor | 4 ++-- .../Components/AttachDocuments.razor.cs | 12 ++++++------ .../Dialogs/ReviewAttachmentsDialog.razor | 5 ----- .../Dialogs/ReviewAttachmentsDialog.razor.cs | 6 +++++- .../plugin.lua | 2 +- .../plugin.lua | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor b/app/MindWork AI Studio/Components/AttachDocuments.razor index bcc3f9d7..aea32e75 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor @@ -68,9 +68,9 @@ else
- @foreach (var fileInfo in this.DocumentPaths.Select(file => new FileInfo(file))) + @foreach (var filePath in this.DocumentPaths) { - + }
diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs index ac29b190..942ce861 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs @@ -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 /// /// The user might want to check what we actually extract from his file and therefore give the LLM as an input. /// - /// The file to check. - private async Task InvestigateFile(FileInfo file) + /// The file to check. + private async Task InvestigateFile(string filePath) { var dialogParameters = new DialogParameters { - { x => x.FilePath, file.FullName }, + { x => x.FilePath, filePath }, }; await this.DialogService.ShowAsync(T("Document Preview"), dialogParameters, DialogOptions.FULLSCREEN); diff --git a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor index 5bde0562..9e8a19f2 100644 --- a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor +++ b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor @@ -1,11 +1,6 @@ @inherits MSGComponentBase - - - @T("Your attached files") - - @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.") diff --git a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs index ee5fc592..64e6bb10 100644 --- a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs @@ -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("Your attached documents", dialogParameters, DialogOptions.FULLSCREEN); + var dialogReference = await dialogService.ShowAsync(TB("Your attached files"), dialogParameters, DialogOptions.FULLSCREEN); var dialogResult = await dialogReference.Result; if (dialogResult is null || dialogResult.Canceled) return documentPaths; diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index 5f5baf5f..bbc25f03 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -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." diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index 1a2e0d0e..d42fe707 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -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."