From 48dcf6bba928ecadb507473bbff7c93b4a602356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peer=20Sch=C3=BCtt?= <20603780+peerschuett@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:12:46 +0100 Subject: [PATCH] Added a dialog to check if the document is loaded as the user expects --- .../Components/AttachDocuments.razor.cs | 15 +++++++++++++- .../Dialogs/PandocDocumentCheckDialog.razor | 20 +++++++++++++++++++ .../PandocDocumentCheckDialog.razor.cs | 20 +++++++++++++++++++ .../MindWork AI Studio.csproj | 6 ++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor create mode 100644 app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor.cs diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs index 3f377bb5..8ce46780 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs @@ -1,3 +1,4 @@ +using AIStudio.Dialogs; using AIStudio.Tools.Rust; using AIStudio.Tools.Services; @@ -5,6 +6,8 @@ using Microsoft.AspNetCore.Components; namespace AIStudio.Components; +using DialogOptions = AIStudio.Dialogs.DialogOptions; + public partial class AttachDocuments : MSGComponentBase { [Parameter] @@ -31,6 +34,9 @@ public partial class AttachDocuments : MSGComponentBase [Inject] private RustService RustService { get; init; } = null!; + [Inject] + private IDialogService DialogService { get; init; } = null!; + #region Overrides of MSGComponentBase protected override async Task OnInitializedAsync() @@ -164,10 +170,17 @@ public partial class AttachDocuments : MSGComponentBase /// The user might want to check what the Pandoc integration actually extracts from his file and therefore gives the LLM as input. /// /// The file to check. - private void InvestigateFile(FileInfo file) + private async Task InvestigateFile(FileInfo file) { # warning Implement Investigation of file this.Logger.LogDebug("Investigate"); + + var dialogParameters = new DialogParameters{}; + + var dialogReference = await this.DialogService.ShowAsync("Check document content", dialogParameters, DialogOptions.FULLSCREEN); + var dialogResult = await dialogReference.Result; + if (dialogResult is null || dialogResult.Canceled) + return; return; } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor b/app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor new file mode 100644 index 00000000..e6f3cf7c --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor @@ -0,0 +1,20 @@ +@inherits MSGComponentBase + + + + + @T("Here you can check if Pandoc loads your file as expected.") + + + + + + @this.documentContent + + + + + @T("Cancel") + + + \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor.cs b/app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor.cs new file mode 100644 index 00000000..361342d4 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/PandocDocumentCheckDialog.razor.cs @@ -0,0 +1,20 @@ +using System.Formats.Asn1; +using AIStudio.Components; + +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Dialogs; + +/// +/// Check how your file will be loaded by Pandoc. +/// +public partial class PandocDocumentCheckDialog : MSGComponentBase +{ + [CascadingParameter] + private IMudDialogInstance MudDialog { get; set; } = null!; + + + private string documentContent = string.Empty; + + private void Cancel() => this.MudDialog.Cancel(); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/MindWork AI Studio.csproj b/app/MindWork AI Studio/MindWork AI Studio.csproj index 5d39cb48..b559389c 100644 --- a/app/MindWork AI Studio/MindWork AI Studio.csproj +++ b/app/MindWork AI Studio/MindWork AI Studio.csproj @@ -61,6 +61,12 @@ + + + true + + +