diff --git a/app/MindWork AI Studio/Chat/FileAttachment.cs b/app/MindWork AI Studio/Chat/FileAttachment.cs index 558b7917..7c776a75 100644 --- a/app/MindWork AI Studio/Chat/FileAttachment.cs +++ b/app/MindWork AI Studio/Chat/FileAttachment.cs @@ -82,17 +82,22 @@ public record FileAttachment(FileAttachmentType Type, string FileName, string Fi /// The corresponding FileAttachmentType. private static FileAttachmentType DetermineFileType(string filePath) { + // Check if it's an executable: if (FileTypes.IsAllowedPath(filePath, FileTypes.EXECUTABLES)) return FileAttachmentType.FORBIDDEN; + // Check if it's an image file: if (FileTypes.IsAllowedPath(filePath, FileTypes.IMAGE)) return FileAttachmentType.IMAGE; + // Check if it's an audio file if (FileTypes.IsAllowedPath(filePath, FileTypes.AUDIO)) return FileAttachmentType.AUDIO; - return FileTypes.IsAllowedPath(filePath, FileTypes.DOCUMENT) - ? FileAttachmentType.DOCUMENT - : FileAttachmentType.FORBIDDEN; + // Check if it's an allowed document file (PDF, Text, LaTeX, or Office): + if (FileTypes.IsAllowedPath(filePath, FileTypes.DOCUMENT)) + return FileAttachmentType.DOCUMENT; + + return FileAttachmentType.FORBIDDEN; } } diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs index e4a0fe0f..dded52be 100644 --- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs +++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs @@ -181,6 +181,7 @@ public partial class AttachDocuments : MSGComponentBase { if(!await FileExtensionValidation.IsExtensionValidWithNotifyAsync(FileExtensionValidation.UseCase.ATTACHING_CONTENT, path, this.ValidateMediaFileTypes, this.Provider)) continue; + this.DocumentPaths.Add(FileAttachment.FromPath(path)); } diff --git a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs index 33e4db18..6520b7ee 100644 --- a/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/EmbeddingProviderDialog.razor.cs @@ -96,7 +96,7 @@ public partial class EmbeddingProviderDialog : MSGComponentBase, ISecretId private readonly List availableModels = new(); private readonly Encryption encryption = Program.ENCRYPTION; private readonly ProviderValidation providerValidation; - + public EmbeddingProviderDialog() { this.providerValidation = new() diff --git a/app/MindWork AI Studio/Tools/Rust/FileTypes.cs b/app/MindWork AI Studio/Tools/Rust/FileTypes.cs index 44eabd4d..9b8c7864 100644 --- a/app/MindWork AI Studio/Tools/Rust/FileTypes.cs +++ b/app/MindWork AI Studio/Tools/Rust/FileTypes.cs @@ -49,11 +49,12 @@ public static class FileTypes public static readonly FileTypeFilter EXCEL = FileTypeFilter.Leaf("Excel", "xls", "xlsx"); public static readonly FileTypeFilter POWER_POINT = FileTypeFilter.Leaf("PowerPoint", "ppt", "pptx"); public static readonly FileTypeFilter MAIL = FileTypeFilter.Leaf(TB("Mail"), "eml", "msg", "mbox"); + public static readonly FileTypeFilter LATEX = FileTypeFilter.Leaf("LaTeX", "tex", "bib", "sty", "cls", "log"); public static readonly FileTypeFilter OFFICE_FILES = FileTypeFilter.Parent(TB("Office Files"), WORD, EXCEL, POWER_POINT, PDF); public static readonly FileTypeFilter DOCUMENT = FileTypeFilter.Parent(TB("Document"), - TEXT, OFFICE_FILES, SOURCE_CODE, MAIL); + TEXT, OFFICE_FILES, SOURCE_CODE, LATEX); // Media hierarchy public static readonly FileTypeFilter IMAGE = FileTypeFilter.Leaf(TB("Image"), diff --git a/app/MindWork AI Studio/Tools/Services/RustService.FileSystem.cs b/app/MindWork AI Studio/Tools/Services/RustService.FileSystem.cs index 76519eb2..e44dfa7f 100644 --- a/app/MindWork AI Studio/Tools/Services/RustService.FileSystem.cs +++ b/app/MindWork AI Studio/Tools/Services/RustService.FileSystem.cs @@ -59,7 +59,7 @@ public sealed partial class RustService /// Initiates a dialog to let the user select a file for a writing operation. /// /// The title of the save file dialog. - /// An optional file type filter for filtering specific file formats. + /// Optional file type filters for filtering specific file formats. /// An optional initial file path to pre-fill in the dialog. /// A object containing information about whether the user canceled the /// operation and whether the select operation was successful.