diff --git a/apps/desktop/src/services/transcription-service.ts b/apps/desktop/src/services/transcription-service.ts index 7e9c265..70da45f 100644 --- a/apps/desktop/src/services/transcription-service.ts +++ b/apps/desktop/src/services/transcription-service.ts @@ -312,7 +312,13 @@ export class TranscriptionService { // Accumulate the result only if Whisper returned something // (it returns empty string while buffering) if (chunkTranscription.trim()) { - session.transcriptionResults.push(chunkTranscription); + // Cloud provider concatenates previousTranscription with new transcription, + // so we need to replace the array instead of appending to avoid duplication + if (provider.name === "amical-cloud" && aggregatedTranscription) { + session.transcriptionResults = [chunkTranscription]; + } else { + session.transcriptionResults.push(chunkTranscription); + } logger.transcription.info("Whisper returned transcription", { sessionId, transcriptionLength: chunkTranscription.length, @@ -408,7 +414,13 @@ export class TranscriptionService { }); if (finalTranscription.trim()) { - session.transcriptionResults.push(finalTranscription); + // Cloud provider concatenates previousTranscription with new transcription, + // so we need to replace the array instead of appending to avoid duplication + if (usedCloudProvider && aggregatedTranscription) { + session.transcriptionResults = [finalTranscription]; + } else { + session.transcriptionResults.push(finalTranscription); + } logger.transcription.info("Whisper returned final transcription", { sessionId, transcriptionLength: finalTranscription.length, diff --git a/packages/native-helpers/windows-helper/src/Services/UIAutomationService.cs b/packages/native-helpers/windows-helper/src/Services/UIAutomationService.cs index 1bfa7d3..f561c61 100644 --- a/packages/native-helpers/windows-helper/src/Services/UIAutomationService.cs +++ b/packages/native-helpers/windows-helper/src/Services/UIAutomationService.cs @@ -353,7 +353,7 @@ namespace WindowsHelper.Services string? postSelectionText = null; Models.SelectionRange? selectionRange = null; - if (selectionRanges != null && selectionRanges.Length > 0 && !string.IsNullOrEmpty(fullContent)) + if (selectionRanges != null && selectionRanges.Length > 0 && fullContent != null) { var range = selectionRanges[0]; selectedText = SafeGetTextFromRange(range); @@ -523,4 +523,4 @@ namespace WindowsHelper.Services Console.Error.Flush(); } } -} \ No newline at end of file +}