diff --git a/src/main/services/VoiceModeService.ts b/src/main/services/VoiceModeService.ts index 47e6f54..781ff3e 100644 --- a/src/main/services/VoiceModeService.ts +++ b/src/main/services/VoiceModeService.ts @@ -476,36 +476,27 @@ class VoiceModeService extends EventEmitter { private async _completeSession(finalText: string): Promise { if (!this._session) return - this._setRecognitionState(RecognitionState.COMPLETED) - this._setAudioState(AudioState.STOPPED) - const session = { ...this._session } logger.info(`Session completed: "${finalText.substring(0, 50)}${finalText.length > 50 ? '...' : ''}"`) - // Speakly 패턴: RecordingTip 숨김 + // Speakly 패턴: 먼저 RecordingTip 숨기고 IDLE 복귀 (다음 핫키 즉시 사용 가능) hideRecordingTip() + this._setRecognitionState(RecognitionState.COMPLETED) + this._setAudioState(AudioState.STOPPED) + this.emit('session-completed', { session, finalText }) + this._resetToIdle() - // 텍스트 삽입 (autoInsert 설정 확인) - let insertSuccess = false + // 텍스트 삽입은 세션과 무관하게 비동기 실행 (세션 블로킹 방지) if (configGet('autoInsert') && finalText.length > 0) { try { const insertMethod = configGet('insertMethod') await getTextInsertService().insertText(finalText, insertMethod) - insertSuccess = true } catch (error) { logger.warn(`Text insert failed: ${error instanceof Error ? error.message : String(error)}`) + // 삽입 실패 시 ResultPopup에 텍스트 표시 + showResultPopup(finalText, 10000) } } - - // Speakly 패턴: 삽입 실패 시 ResultPopup에 텍스트 표시 - if (!insertSuccess && finalText.length > 0) { - showResultPopup(finalText, 10000) - } - - this.emit('session-completed', { session, finalText }) - - // IDLE로 복귀 - this._resetToIdle() } private _cancelSession(reason: 'user' | 'timeout' | 'too-short'): void {