diff --git a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs index fa53b044..d7ee8987 100644 --- a/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs +++ b/app/MindWork AI Studio/Assistants/DocumentAnalysis/DocumentAnalysisAssistant.razor.cs @@ -332,6 +332,12 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore 0) + // Determine allowed attachments: + var numberAllowedExistingFiles = existingFiles.Count(x => x.IsValid); + + // Only proceed if there are existing, allowed files: + if (numberAllowedExistingFiles > 0) { // Check Pandoc availability once before processing file attachments var pandocState = await Pandoc.CheckAvailabilityAsync(Program.RUST_SERVICE, showMessages: true, showSuccessMessage: false); @@ -181,6 +184,12 @@ public sealed class ContentText : IContent sb.AppendLine("The following files are attached to this message:"); foreach(var file in existingFiles) { + if (file.IsForbidden) + { + LOGGER.LogWarning("File attachment '{FilePath}' has a forbidden file type and will be skipped.", file.FilePath); + continue; + } + sb.AppendLine(); sb.AppendLine("---------------------------------------"); sb.AppendLine($"File path: {file.FilePath}"); diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor.cs b/app/MindWork AI Studio/Components/ChatComponent.razor.cs index 44b3dafa..347c096b 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor.cs +++ b/app/MindWork AI Studio/Components/ChatComponent.razor.cs @@ -464,7 +464,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable lastUserPrompt = new ContentText { Text = this.userInput, - FileAttachments = [..this.chatDocumentPaths], + FileAttachments = [..this.chatDocumentPaths.Where(x => x.IsValid)], }; //