Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat: retry transcription runs full pipeline with AI reasoning when enabled

Gabriel Stein65848a9ae1b5
diff --git a/preload.js b/preload.js
index 09527971f..1ffb0e4d6 100644
--- a/preload.js
+++ b/preload.js
@@ -46,6 +46,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
getAudioStorageUsage: () => ipcRenderer.invoke("get-audio-storage-usage"),
deleteAllAudio: () => ipcRenderer.invoke("delete-all-audio"),
retryTranscription: (id) => ipcRenderer.invoke("retry-transcription", id),
+ updateTranscriptionText: (id, text, rawText) =>
+ ipcRenderer.invoke("update-transcription-text", id, text, rawText),
getTranscriptionById: (id) => ipcRenderer.invoke("get-transcription-by-id", id),
// Dictionary functions
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 8c7964d9f..a6d77514d 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -269,7 +269,35 @@ export default function ControlPanel() {
try {
const result = await window.electronAPI.retryTranscription(id);
if (result.success && result.transcription) {
- updateInStore(result.transcription);
+ const rawText = result.transcription.text;
+ let finalTranscription = result.transcription;
+
+ // Apply AI reasoning if enabled
+ if (useReasoningModel) {
+ try {
+ const [{ default: ReasoningService }, { getEffectiveReasoningModel, isCloudReasoningMode }] =
+ await Promise.all([
+ import("../services/ReasoningService"),
+ import("../stores/settingsStore"),
+ ]);
+ const model = getEffectiveReasoningModel();
+ const isCloud = isCloudReasoningMode();
+ if (model || isCloud) {
+ const agentName = localStorage.getItem("agentName") || null;
+ const reasonedText = await ReasoningService.processText(rawText, model, agentName);
+ if (reasonedText && reasonedText !== rawText) {
+ const updated = await window.electronAPI.updateTranscriptionText(id, reasonedText, rawText);
+ if (updated.success && updated.transcription) {
+ finalTranscription = updated.transcription;
+ }
+ }
+ }
+ } catch {
+ // Reasoning failed — keep the raw STT result
+ }
+ }
+
+ updateInStore(finalTranscription);
toast({ title: t("controlPanel.history.retrySuccess") });
} else {
toast({
@@ -285,7 +313,7 @@ export default function ControlPanel() {
});
}
},
- [toast, t]
+ [toast, t, useReasoningModel]
);
const handleUpdateClick = async () => {
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 3ede20adb..df041015b 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -2071,6 +2071,21 @@ class IPCHandlers {
}
});
+ ipcMain.handle("update-transcription-text", async (_event, id, text, rawText) => {
+ try {
+ this.databaseManager.updateTranscriptionText(id, text, rawText);
+ const updated = this.databaseManager.getTranscriptionById(id);
+ return { success: true, transcription: updated };
+ } catch (error) {
+ debugLogger.error(
+ "Failed to update transcription text",
+ { id, error: error.message },
+ "audio-storage"
+ );
+ return { success: false, error: error.message };
+ }
+ });
+
ipcMain.handle("cloud-reason", async (event, text, opts = {}) => {
try {
const apiUrl = getApiUrl();
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 1b8721116..1fcc32b8e 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -308,6 +308,11 @@ declare global {
retryTranscription: (
id: number
) => Promise<{ success: boolean; transcription?: TranscriptionItem; error?: string }>;
+ updateTranscriptionText: (
+ id: number,
+ text: string,
+ rawText: string
+ ) => Promise<{ success: boolean; transcription?: TranscriptionItem; error?: string }>;
// Dictionary operations
getDictionary: () => Promise<string[]>;