diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
index 7d5aab76..5d650a43 100644
--- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
+++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
@@ -39,7 +39,10 @@ public partial class AttachDocuments : MSGComponentBase
[Inject]
private IDialogService DialogService { get; init; } = null!;
-
+
+ [Inject]
+ private PandocAvailabilityService PandocAvailabilityService { get; init; } = null!;
+
private const Placement TOOLBAR_TOOLTIP_PLACEMENT = Placement.Top;
#region Overrides of MSGComponentBase
@@ -71,12 +74,26 @@ public partial class AttachDocuments : MSGComponentBase
this.Logger.LogDebug("Attach documents component '{Name}' is not hovered, ignoring file drop dropped event.", this.Name);
return;
}
-
+
+ // Ensure that Pandoc is installed and ready:
+ var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync(
+ showSuccessMessage: false,
+ showDialog: true);
+
+ // 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.ClearDragClass();
+ this.StateHasChanged();
+ return;
+ }
+
foreach (var path in paths)
{
if(!await this.IsFileExtensionValid(path))
continue;
-
+
this.DocumentPaths.Add(path);
}
@@ -97,6 +114,18 @@ public partial class AttachDocuments : MSGComponentBase
private async Task AddFilesManually()
{
+ // Ensure that Pandoc is installed and ready:
+ var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync(
+ showSuccessMessage: false,
+ showDialog: true);
+
+ // 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.");
+ return;
+ }
+
var selectedFile = await this.RustService.SelectFile(T("Select a file to attach"));
if (selectedFile.UserCancelled)
return;
diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor b/app/MindWork AI Studio/Components/ChatComponent.razor
index 6a8e4ad9..8f4eca23 100644
--- a/app/MindWork AI Studio/Components/ChatComponent.razor
+++ b/app/MindWork AI Studio/Components/ChatComponent.razor
@@ -83,11 +83,8 @@
- @if (this.isPandocAvailable)
- {
-
- }
-
+
+
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
{
diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor.cs b/app/MindWork AI Studio/Components/ChatComponent.razor.cs
index 502e6966..2562c7b4 100644
--- a/app/MindWork AI Studio/Components/ChatComponent.razor.cs
+++ b/app/MindWork AI Studio/Components/ChatComponent.razor.cs
@@ -3,7 +3,6 @@ using AIStudio.Dialogs;
using AIStudio.Provider;
using AIStudio.Settings;
using AIStudio.Settings.DataModel;
-using AIStudio.Tools.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
@@ -38,9 +37,6 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
[Inject]
private IDialogService DialogService { get; init; } = null!;
- [Inject]
- private PandocAvailabilityService PandocAvailabilityService { get; init; } = null!;
-
private const Placement TOOLBAR_TOOLTIP_PLACEMENT = Placement.Top;
private static readonly Dictionary USER_INPUT_ATTRIBUTES = new();
@@ -62,7 +58,6 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
private Guid currentWorkspaceId = Guid.Empty;
private CancellationTokenSource? cancellationTokenSource;
private HashSet chatDocumentPaths = [];
- private bool isPandocAvailable;
// Unfortunately, we need the input field reference to blur the focus away. Without
// this, we cannot clear the input field.
@@ -204,9 +199,6 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
// Select the correct provider:
await this.SelectProviderWhenLoadingChat();
- // Check if Pandoc is available (no dialog or messages):
- this.isPandocAvailable = await this.PandocAvailabilityService.IsAvailableAsync();
-
await base.OnInitializedAsync();
}
diff --git a/app/MindWork AI Studio/MindWork AI Studio.csproj b/app/MindWork AI Studio/MindWork AI Studio.csproj
index b559389c..5d39cb48 100644
--- a/app/MindWork AI Studio/MindWork AI Studio.csproj
+++ b/app/MindWork AI Studio/MindWork AI Studio.csproj
@@ -61,12 +61,6 @@
-
-
- true
-
-
-
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 79563fd1..5f021f0f 100644
--- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md
+++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md
@@ -4,6 +4,7 @@
- Added the ability to use file attachments in chat. This is the initial implementation of this feature. We will continue to develop this feature and refine it further based on user feedback. Many thanks to Sabrina `Sabrina-devops` for this wonderful contribution.
- Improved the document analysis assistant (in preview) by adding descriptions to the different sections.
- Improved the document preview dialog for the document analysis assistant (in preview), providing Markdown and plain text views for attached files.
+- Improved the Pandoc handling for the document analysis assistant (in preview) and file attachments in chat. When Pandoc is not installed and users attempt to attach files, users are now prompted to install Pandoc first.
- Improved the ID handling for configuration plugins.
- Improved error handling, logging, and code quality.
- Improved error handling for Microsoft Word export.