diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor.cs b/app/MindWork AI Studio/Components/ChatComponent.razor.cs index 4c604753..71337e9e 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor.cs +++ b/app/MindWork AI Studio/Components/ChatComponent.razor.cs @@ -939,7 +939,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable if(lastBlockContent is null) return Task.CompletedTask; - this.userInput = textBlock.Text; + this.RestoreComposerFromTextBlock(textBlock); this.ChatThread.Remove(block); this.ChatThread.Remove(lastBlockContent); this.hasUnsavedChanges = true; @@ -956,13 +956,22 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable if (block is not ContentText textBlock) return Task.CompletedTask; - this.userInput = textBlock.Text; + this.RestoreComposerFromTextBlock(textBlock); this.ChatThread.Remove(block); this.hasUnsavedChanges = true; this.StateHasChanged(); return Task.CompletedTask; } + + private void RestoreComposerFromTextBlock(ContentText textBlock) + { + this.userInput = textBlock.Text; + this.chatDocumentPaths.Clear(); + + foreach (var attachment in textBlock.FileAttachments) + this.chatDocumentPaths.Add(attachment.Normalize()); + } #region Overrides of MSGComponentBase