From 4b2da61a90adb327cb3d40378b4033bbbaf179f9 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 17 May 2025 19:17:29 +0200 Subject: [PATCH] Fixed an issue that caused live translation to stop working (#463) --- app/MindWork AI Studio/Assistants/AssistantBase.razor.cs | 9 +++++++++ app/MindWork AI Studio/wwwroot/changelog/v0.9.44.md | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs index a15af617..2352f7c3 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs @@ -242,6 +242,9 @@ public abstract partial class AssistantBase : AssistantLowerBase wher protected async Task AddAIResponseAsync(DateTimeOffset time, bool hideContentFromUser = false) { + var manageCancellationLocally = this.cancellationTokenSource is null; + this.cancellationTokenSource ??= new CancellationTokenSource(); + var aiText = new ContentText { // We have to wait for the remote @@ -275,6 +278,12 @@ public abstract partial class AssistantBase : AssistantLowerBase wher this.isProcessing = false; this.StateHasChanged(); + if(manageCancellationLocally) + { + this.cancellationTokenSource.Dispose(); + this.cancellationTokenSource = null; + } + // Return the AI response: return aiText.Text; } diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.44.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.44.md index 98f485e4..ef87e8b2 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.44.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.44.md @@ -1,3 +1,4 @@ # v0.9.44, build 219 (2025-05-xx xx:xx UTC) - Improved localization code & German translation. -- Fixed a bug with text fields when their content was read live. This issue caused the user interface to refresh too frequently, resulting in increased energy consumption. \ No newline at end of file +- Fixed a bug with text fields when their content was read live. This issue caused the user interface to refresh too frequently, resulting in increased energy consumption. +- Fixed an issue that caused live translation to stop working. \ No newline at end of file