Fixed an issue that caused live translation to stop working (#463)

This commit is contained in:
Thorsten Sommer 2025-05-17 19:17:29 +02:00 committed by GitHub
parent 2ae292009d
commit 4b2da61a90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -242,6 +242,9 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
protected async Task<string> AddAIResponseAsync(DateTimeOffset time, bool hideContentFromUser = false) protected async Task<string> AddAIResponseAsync(DateTimeOffset time, bool hideContentFromUser = false)
{ {
var manageCancellationLocally = this.cancellationTokenSource is null;
this.cancellationTokenSource ??= new CancellationTokenSource();
var aiText = new ContentText var aiText = new ContentText
{ {
// We have to wait for the remote // We have to wait for the remote
@ -275,6 +278,12 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
this.isProcessing = false; this.isProcessing = false;
this.StateHasChanged(); this.StateHasChanged();
if(manageCancellationLocally)
{
this.cancellationTokenSource.Dispose();
this.cancellationTokenSource = null;
}
// Return the AI response: // Return the AI response:
return aiText.Text; return aiText.Text;
} }

View File

@ -1,3 +1,4 @@
# v0.9.44, build 219 (2025-05-xx xx:xx UTC) # v0.9.44, build 219 (2025-05-xx xx:xx UTC)
- Improved localization code & German translation. - 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. - 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.