From 2317add71fac54ca1ad0f204b8699550c47b4c63 Mon Sep 17 00:00:00 2001 From: Sabrina-devops Date: Fri, 22 May 2026 16:18:36 +0200 Subject: [PATCH] Fixed missing file attachments when editing a prompt (#748) --- .../Components/ChatComponent.razor.cs | 13 +++++++++++-- app/MindWork AI Studio/wwwroot/changelog/v26.5.5.md | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) 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 diff --git a/app/MindWork AI Studio/wwwroot/changelog/v26.5.5.md b/app/MindWork AI Studio/wwwroot/changelog/v26.5.5.md index 1a1d45e3..4bf9d0f2 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v26.5.5.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v26.5.5.md @@ -11,6 +11,7 @@ - Fixed the Pandoc installation, which could fail and prevent AI Studio from installing its local Pandoc dependency. - Fixed an issue where the spellchecking setting was not applied to all text fields in the slide builder assistant. - Fixed an issue where legacy `.doc` files could be selected even though AI Studio could not process them. These files are now rejected with a clear error message. Thanks to Bernhard for reporting this issue. +- Fixed an issue where attached documents were detached when editing a previous prompt. They now remain attached. - Fixed missing translations for file type names in file selection dialogs. - Upgraded the native secret storage integration to `keyring-core`, keeping API keys in the secure credential store provided by the operating system. - Upgraded Rust to v1.95.0.