diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs index 5d650a43..d29aaf45 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs @@ -83,7 +83,7 @@ public partial class AttachDocuments : MSGComponentBase // If Pandoc is not available (user cancelled installation), abort file drop: if (!pandocState.IsAvailable) { - this.Logger.LogInformation("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file drop."); + this.Logger.LogWarning("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file drop."); this.ClearDragClass(); this.StateHasChanged(); return; @@ -122,7 +122,7 @@ public partial class AttachDocuments : MSGComponentBase // If Pandoc is not available (user cancelled installation), abort file selection: if (!pandocState.IsAvailable) { - this.Logger.LogInformation("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file selection."); + this.Logger.LogWarning("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file selection."); return; } diff --git a/app/MindWork AI Studio/Components/ReadFileContent.razor.cs b/app/MindWork AI Studio/Components/ReadFileContent.razor.cs index e40d8088..99322ef1 100644 --- a/app/MindWork AI Studio/Components/ReadFileContent.razor.cs +++ b/app/MindWork AI Studio/Components/ReadFileContent.razor.cs @@ -30,6 +30,18 @@ public partial class ReadFileContent : MSGComponentBase private async Task SelectFile() { + // Ensure that Pandoc is installed and ready: + var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync( + showSuccessMessage: false, + showDialog: true); + + // Check if Pandoc is available after the check / installation: + if (!pandocState.IsAvailable) + { + this.Logger.LogWarning("The user cancelled the Pandoc installation or Pandoc is not available. Aborting file selection."); + return; + } + var selectedFile = await this.RustService.SelectFile(T("Select file to read its content")); if (selectedFile.UserCancelled) { @@ -64,11 +76,6 @@ public partial class ReadFileContent : MSGComponentBase await MessageBus.INSTANCE.SendWarning(new(Icons.Material.Filled.FeaturedVideo, this.T("Videos are not supported yet"))); return; } - - // Ensure that Pandoc is installed and ready: - await this.PandocAvailabilityService.EnsureAvailabilityAsync( - showSuccessMessage: false, - showDialog: true); try { diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md index 5f021f0f..b1cbf13b 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md @@ -8,6 +8,7 @@ - Improved the ID handling for configuration plugins. - Improved error handling, logging, and code quality. - Improved error handling for Microsoft Word export. +- Improved file reading, e.g. for the translation, summarization, and legal assistants, by performing the Pandoc validation in the first step. This prevents unnecessary selection of files that cannot be processed. - Fixed a bug in the local data sources info dialog (preview feature) for data directories that could cause the app to crash. The error was caused by a background thread producing data while the frontend attempted to display it. - Fixed a visual bug where a function's preview status was misaligned. You might have seen it in document analysis or the ERI server assistant. - Fixed a rare bug in the Microsoft Word export for huge documents. \ No newline at end of file