diff --git a/apps/desktop/src/pipeline/providers/formatting/ollama-formatter.ts b/apps/desktop/src/pipeline/providers/formatting/ollama-formatter.ts index e9c5dea..589b3e2 100644 --- a/apps/desktop/src/pipeline/providers/formatting/ollama-formatter.ts +++ b/apps/desktop/src/pipeline/providers/formatting/ollama-formatter.ts @@ -57,7 +57,7 @@ export class OllamaFormatter implements FormattingProvider { const match = aiResponse.match( /([\s\S]*?)<\/formatted_text>/, ); - const formattedText = match ? match[1].trim() : aiResponse.trim(); + const formattedText = match ? match[1] : aiResponse; logger.pipeline.debug("Formatting completed", { original: text, diff --git a/apps/desktop/src/pipeline/providers/formatting/openrouter-formatter.ts b/apps/desktop/src/pipeline/providers/formatting/openrouter-formatter.ts index b1b28c5..4895e08 100644 --- a/apps/desktop/src/pipeline/providers/formatting/openrouter-formatter.ts +++ b/apps/desktop/src/pipeline/providers/formatting/openrouter-formatter.ts @@ -62,7 +62,7 @@ export class OpenRouterProvider implements FormattingProvider { const match = aiResponse.match( /([\s\S]*?)<\/formatted_text>/, ); - const formattedText = match ? match[1].trim() : aiResponse.trim(); + const formattedText = match ? match[1] : aiResponse; logger.pipeline.debug("Formatting completed", { original: text, diff --git a/apps/desktop/src/services/platform/native-bridge-service.ts b/apps/desktop/src/services/platform/native-bridge-service.ts index fd25167..c11abc3 100644 --- a/apps/desktop/src/services/platform/native-bridge-service.ts +++ b/apps/desktop/src/services/platform/native-bridge-service.ts @@ -200,8 +200,9 @@ export class NativeBridge extends EventEmitter { this.proc.on("close", (code, signal) => { const helperName = getNativeHelperName(); const isNormalExit = code === 0 && signal === null; + const isIntentionalKill = signal === "SIGTERM"; - if (isNormalExit) { + if (isNormalExit || isIntentionalKill) { this.logger.info(`${helperName} process exited normally`); } else { this.logger.error(`${helperName} process crashed`, { code, signal }); @@ -212,7 +213,7 @@ export class NativeBridge extends EventEmitter { this.proc = null; // Auto-restart on crash - if (!isNormalExit) { + if (!isNormalExit && !isIntentionalKill) { this.attemptRestart(); } }); diff --git a/apps/desktop/src/services/transcription-service.ts b/apps/desktop/src/services/transcription-service.ts index 58b57ba..ba4affc 100644 --- a/apps/desktop/src/services/transcription-service.ts +++ b/apps/desktop/src/services/transcription-service.ts @@ -421,7 +421,7 @@ export class TranscriptionService { this.transcriptionMutex.release(); } - let completeTranscription = session.transcriptionResults.join(" ").trim(); + let completeTranscription = session.transcriptionResults.join(" "); let formattingDuration: number | undefined; logger.transcription.info("Finalizing streaming session", {