diff --git a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor
index 90f889bd..86e085e5 100644
--- a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor
+++ b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor
@@ -20,7 +20,8 @@
{
-
+
}
diff --git a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs
index efa9c31b..e29a016d 100644
--- a/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs
+++ b/app/MindWork AI Studio/Chat/ContentBlockComponent.razor.cs
@@ -1,4 +1,5 @@
using AIStudio.Components;
+using AIStudio.Dialogs;
using AIStudio.Tools.Services;
using Microsoft.AspNetCore.Components;
@@ -188,4 +189,9 @@ public partial class ContentBlockComponent : MSGComponentBase
await this.EditLastUserBlockFunc(this.Content);
}
+ private async Task OpenAttachmentsDialog()
+ {
+ var result = await ReviewAttachmentsDialog.OpenDialogAsync(this.DialogService, this.Content.FileAttachments.ToHashSet());
+ this.Content.FileAttachments = result.ToList();
+ }
}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor b/app/MindWork AI Studio/Components/AttachDocuments.razor
index e3d92385..424a90d5 100644
--- a/app/MindWork AI Studio/Components/AttachDocuments.razor
+++ b/app/MindWork AI Studio/Components/AttachDocuments.razor
@@ -13,11 +13,11 @@
Content="@this.DocumentPaths.Count"
Color="Color.Primary"
Overlap="true"
- OnClick="@OpenAttachmentsDialog">
+ OnClick="@this.OpenAttachmentsDialog">
+ OnClick="@this.AddFilesManually"/>
}
@@ -27,7 +27,7 @@
+ OnClick="@this.AddFilesManually"/>
}
diff --git a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
index 533e6bef..fc3ded31 100644
--- a/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
+++ b/app/MindWork AI Studio/Components/AttachDocuments.razor.cs
@@ -127,14 +127,7 @@ public partial class AttachDocuments : MSGComponentBase
private async Task OpenAttachmentsDialog()
{
- var dialogParameters = new DialogParameters
- {
- { "DocumentPaths", this.DocumentPaths }
- };
- var dialogReference = await this.DialogService.ShowAsync("Your Files", dialogParameters, DialogOptions.FULLSCREEN);
- var dialogResult = await dialogReference.Result;
- if (dialogResult is null || dialogResult.Canceled)
- return;
+ this.DocumentPaths = await ReviewAttachmentsDialog.OpenDialogAsync(this.DialogService, this.DocumentPaths);
}
private async Task IsFileExtensionValid(string selectedFile)
diff --git a/app/MindWork AI Studio/Components/AttachmentsDialog.razor.cs b/app/MindWork AI Studio/Components/AttachmentsDialog.razor.cs
deleted file mode 100644
index a16ee904..00000000
--- a/app/MindWork AI Studio/Components/AttachmentsDialog.razor.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Microsoft.AspNetCore.Components;
-
-namespace AIStudio.Components;
-
-public partial class AttachmentsDialog : MSGComponentBase
-{
- [CascadingParameter]
- private IMudDialogInstance MudDialog { get; set; } = null!;
-
- [Parameter]
- public HashSet DocumentPaths { get; set; } = new();
-
- private void Cancel() => this.MudDialog.Cancel();
-
-}
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Components/AttachmentsDialog.razor b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor
similarity index 85%
rename from app/MindWork AI Studio/Components/AttachmentsDialog.razor
rename to app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor
index d2cbc0c8..30c56f95 100644
--- a/app/MindWork AI Studio/Components/AttachmentsDialog.razor
+++ b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor
@@ -14,6 +14,6 @@
}
- Cancel
+ Close
\ No newline at end of file
diff --git a/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs
new file mode 100644
index 00000000..44eaf9fc
--- /dev/null
+++ b/app/MindWork AI Studio/Dialogs/ReviewAttachmentsDialog.razor.cs
@@ -0,0 +1,36 @@
+using AIStudio.Components;
+using Microsoft.AspNetCore.Components;
+
+namespace AIStudio.Dialogs;
+
+public partial class ReviewAttachmentsDialog : MSGComponentBase
+{
+ [CascadingParameter]
+ private IMudDialogInstance MudDialog { get; set; } = null!;
+
+ [Parameter]
+ public HashSet DocumentPaths { get; set; } = new();
+
+ [Inject]
+ private IDialogService DialogService { get; set; } = null!;
+
+ private void Close() => this.MudDialog.Close(DialogResult.Ok(this.DocumentPaths));
+
+ public static async Task> OpenDialogAsync(IDialogService dialogService, params HashSet documentPaths)
+ {
+ var dialogParameters = new DialogParameters
+ {
+ { x => x.DocumentPaths, documentPaths }
+ };
+
+ var dialogReference = await dialogService.ShowAsync("Your attached documents", dialogParameters, DialogOptions.FULLSCREEN);
+ var dialogResult = await dialogReference.Result;
+ if (dialogResult is null || dialogResult.Canceled)
+ return documentPaths;
+
+ if (dialogResult.Data is null)
+ return documentPaths;
+
+ return dialogResult.Data as HashSet ?? documentPaths;
+ }
+}
\ No newline at end of file