Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat: make automatic note renaming configurable (#746)
Andrew Mahon812c78aadd75
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex b96d48340..fd0ef3795 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -40,6 +40,7 @@ import {} from "../stores/noteStore";import { fetchProviders as fetchStreamingProviders } from "../stores/streamingProvidersStore";import HistoryView from "./HistoryView";+import BackgroundActionToastListener from "./notes/BackgroundActionToastListener";import { syncService } from "../services/SyncService.js";const platform = getCachedPlatform();@@ -894,6 +895,7 @@ export default function ControlPanel() {</div></main></div>+ <BackgroundActionToastListener /></div>);}diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 15f68477e..6ea2d6adf 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -388,6 +388,28 @@ const CLEANUP_MODE_TOAST_KEY: Record<InferenceMode, string> = {enterprise: "switchedEnterprise",};+function NoteFormattingSettings() {+ const { t } = useTranslation();+ const autoGenerateNoteTitle = useSettingsStore((s) => s.autoGenerateNoteTitle);+ const setAutoGenerateNoteTitle = useSettingsStore((s) => s.setAutoGenerateNoteTitle);++ return (+ <div className="space-y-4">+ <SettingsPanel>+ <SettingsPanelRow>+ <SettingsRow+ label={t("settingsPage.noteFormatting.autoGenerateTitle")}+ description={t("settingsPage.noteFormatting.autoGenerateTitleDescription")}+ >+ <Toggle checked={autoGenerateNoteTitle} onChange={setAutoGenerateNoteTitle} />+ </SettingsRow>+ </SettingsPanelRow>+ </SettingsPanel>+ <InferenceConfigEditor scope="noteFormatting" />+ </div>+ );+}+function AiModelsSection({ useCleanupModel, setUseCleanupModel, toast }: AiModelsSectionProps) {const { t } = useTranslation();@@ -3055,7 +3077,7 @@ EOF`,</div>)}renderDictationAgent={() => <DictationAgentSettings />}- renderNoteFormatting={() => <InferenceConfigEditor scope="noteFormatting" />}+ renderNoteFormatting={() => <NoteFormattingSettings />}/>);diff --git a/src/components/notes/BackgroundActionToastListener.tsx b/src/components/notes/BackgroundActionToastListener.tsxnew file mode 100644index 000000000..a9b42e13e--- /dev/null+++ b/src/components/notes/BackgroundActionToastListener.tsx@@ -0,0 +1,31 @@+import { useEffect } from "react";+import { useTranslation } from "react-i18next";+import { useToast } from "../ui/useToast";+import {+ useActionProcessingStore,+ consumeErrorEvents,+} from "../../stores/actionProcessingStore";++/**+ * Headless. Mount once inside ToastProvider so background-action errors+ * surface even after the user navigates away from the notes view.+ */+export default function BackgroundActionToastListener() {+ const { t } = useTranslation();+ const { toast } = useToast();++ const errorCount = useActionProcessingStore((s) => s.errorEvents.length);++ useEffect(() => {+ if (errorCount === 0) return;+ for (const event of consumeErrorEvents()) {+ toast({+ title: t("notes.enhance.title"),+ description: event.message,+ variant: "destructive",+ });+ }+ }, [errorCount, toast, t]);++ return null;+}diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxindex 2a802e19e..0f8b6d791 100644--- a/src/components/notes/PersonalNotesView.tsx+++ b/src/components/notes/PersonalNotesView.tsx@@ -448,57 +448,11 @@ export default function PersonalNotesView({[loadFolders, toast, t]);- const handleApplyEnhancement = useCallback(- async (enhancedContent: string, prompt: string, title?: string) => {- if (!activeNoteId) return;- setLocalEnhancedContent(enhancedContent);- const hash = makeContentHash(localContentRef.current);- const updates: Record<string, string> = {- enhanced_content: enhancedContent,- enhancement_prompt: prompt,- enhanced_at_content_hash: hash,- };- if (title) {- updates.title = title;- setLocalTitle(title);- }- setIsSaving(true);- try {- await window.electronAPI.updateNote(activeNoteId, updates);- } finally {- setIsSaving(false);- }- },- [activeNoteId]- );-const {state: actionProcessingState,actionName,runAction,- cancel: cancelAction,- } = useActionProcessing({- onSuccess: useCallback(- (enhancedContent: string, prompt: string, title?: string) => {- handleApplyEnhancement(enhancedContent, prompt, title);- },- [handleApplyEnhancement]- ),- onError: useCallback(- (errorMessage: string) => {- toast({- title: t("notes.enhance.title"),- description: errorMessage,- variant: "destructive",- });- },- [toast, t]- ),- });-- useEffect(() => {- return () => cancelAction();- }, [activeNoteId, cancelAction]);+ } = useActionProcessing(activeNoteId ?? null);const isEnhancementStale = useMemo(() => {if (!activeNote?.enhanced_content || !activeNote?.enhanced_at_content_hash) return false;@@ -1017,7 +971,7 @@ export default function PersonalNotesView({].filter(Boolean).join("\n\n");- runAction(action, parts, {+ runAction(action, parts, makeContentHash(localContentRef.current), {isCloudMode,modelId: effectiveModelId,isMeetingNote,diff --git a/src/components/notes/UploadAudioView.tsx b/src/components/notes/UploadAudioView.tsxindex e0f3c765e..560b9fa24 100644--- a/src/components/notes/UploadAudioView.tsx+++ b/src/components/notes/UploadAudioView.tsx@@ -31,7 +31,7 @@ import { useUsage } from "../../hooks/useUsage";import { useSettings } from "../../hooks/useSettings";import { withSessionRefresh } from "../../lib/auth";import { getAllReasoningModels } from "../../models/ModelRegistry";-import { useSettingsStore, selectIsCloudCleanupMode } from "../../stores/settingsStore";+import { useSettingsStore, selectIsCloudCleanupMode, getSettings } from "../../stores/settingsStore";import { generateNoteTitle } from "../../utils/generateTitle";const TranscriptionModelPicker = React.lazy(() => import("../TranscriptionModelPicker"));@@ -261,6 +261,7 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploaconst generateTitle = async (text: string): Promise<string> => {if (!useCleanupModel) return "";+ if (!getSettings().autoGenerateNoteTitle) return "";const model = isCloudCleanup ? "" : effectiveCleanupModel || getAllReasoningModels()[0]?.value;if (!model && !isCloudCleanup) return "";return generateNoteTitle(text, model);diff --git a/src/hooks/useActionProcessing.ts b/src/hooks/useActionProcessing.tsindex cc04d5895..9462a31b2 100644--- a/src/hooks/useActionProcessing.ts+++ b/src/hooks/useActionProcessing.ts@@ -1,128 +1,45 @@-import { useState, useEffect, useRef, useCallback } from "react";+import { useCallback } from "react";import { useTranslation } from "react-i18next";-import reasoningService from "../services/ReasoningService";+import { useShallow } from "zustand/react/shallow";import type { ActionItem } from "../types/electron";-import { getEffectiveCleanupModel, getSettings } from "../stores/settingsStore";-import { generateNoteTitle } from "../utils/generateTitle";--export type ActionProcessingState = "idle" | "processing" | "success";--const BASE_SYSTEM_PROMPT = `You are a note enhancement assistant. The user will provide raw notes — possibly voice-transcribed, rough, or unstructured. Your job is to clean them up according to the instructions below while preserving all original meaning and information. Output clean markdown.--FORMAT RULES (strict):-- Do NOT include any preamble: no title, no date/time/location, no attendee list, no topic header. Start directly with the content.-- Do NOT use tables, horizontal rules, or block quotes.-- Do NOT list or guess participant names/roles.-- Keep the tone professional and concise. Bias toward brevity.--Instructions: `;--const MEETING_SYSTEM_PROMPT = `You are a professional meeting notes assistant. You will receive a dual-speaker transcript where "You:" marks the user's speech and "Them:" marks the other participant(s), along with any manual notes the user took.--Your job is to produce clean, actionable meeting notes in markdown. Follow these rules:--FORMAT RULES (strict):-- Do NOT include any preamble: no title, no "# Meeting Notes", no date/time/location, no attendee list, no topic header. Start directly with the summary.-- Do NOT use tables, horizontal rules, or block quotes.-- Do NOT list or guess participant names/roles.-- Start with a concise 1–2 sentence summary of what the meeting was about.-- Use clear section headings: ## Key Discussion Points, ## Decisions Made, ## Action Items, ## Follow-ups (omit any section that has no content).-- Under Action Items, use checkboxes (\`- [ ]\`) and attribute each item to "You" or "Them" where clear.--CONTENT RULES:-- Preserve important quotes or specific commitments verbatim when they carry meaning.-- Remove filler, small talk, false starts, and repeated/redundant content.-- Where speakers refer to the same topic across multiple turns, consolidate into a coherent point rather than listing every utterance.-- If the user included manual notes alongside the transcript, integrate them — they represent the user's emphasis on what matters most.-- Keep the tone professional and concise. Bias toward brevity.--Instructions: `;--interface UseActionProcessingOptions {- onSuccess: (enhancedContent: string, prompt: string, title?: string) => void;- onError: (errorMessage: string) => void;-}--export function useActionProcessing({ onSuccess, onError }: UseActionProcessingOptions) {+import {+ useActionProcessingStore,+ selectNoteActionState,+ runBackgroundAction,+ cancelAction as storeCancelAction,+ type ActionProcessingStatus,+ type RunActionOptions,+} from "../stores/actionProcessingStore";++export type ActionProcessingState = ActionProcessingStatus;++/** React binding for the global actionProcessingStore, scoped to one note. */+export function useActionProcessing(noteId: number | null) {const { t } = useTranslation();- const [state, setState] = useState<ActionProcessingState>("idle");- const [actionName, setActionName] = useState<string | null>(null);- const cancelledRef = useRef(false);- const successTimeoutRef = useRef<NodeJS.Timeout | null>(null);- const processingRef = useRef(false);- useEffect(() => {- return () => {- if (successTimeoutRef.current) clearTimeout(successTimeoutRef.current);- };- }, []);+ const { status: state, actionName } = useActionProcessingStore(+ useShallow((s) => selectNoteActionState(s, noteId))+ );const runAction = useCallback(- async (+ (action: ActionItem,noteContent: string,- options: { isCloudMode: boolean; modelId: string; isMeetingNote?: boolean }+ contentHash: string,+ options: RunActionOptions) => {- if (processingRef.current) return;-- const modelId = getEffectiveCleanupModel() || options.modelId;-- if (!modelId && !options.isCloudMode) {- onError(t("notes.actions.errors.noModel"));- return;- }-- cancelledRef.current = false;- processingRef.current = true;- setActionName(action.name);- setState("processing");-- try {- const basePrompt = options.isMeetingNote ? MEETING_SYSTEM_PROMPT : BASE_SYSTEM_PROMPT;- const systemPrompt = basePrompt + action.prompt;- const enhanced = await reasoningService.processText(noteContent, modelId, null, {- systemPrompt,- temperature: 0.3,- disableThinking: getSettings().noteFormattingDisableThinking,- });-- if (cancelledRef.current) return;-- let title: string | undefined;- const generated = await generateNoteTitle(enhanced, modelId);- if (generated) title = generated;-- if (cancelledRef.current) return;-- setState("success");- onSuccess(enhanced, action.prompt, title);-- successTimeoutRef.current = setTimeout(() => {- processingRef.current = false;- setState("idle");- setActionName(null);- }, 600);- } catch (err) {- if (cancelledRef.current) return;- processingRef.current = false;- setState("idle");- setActionName(null);- onError(err instanceof Error ? err.message : t("notes.actions.errors.actionFailed"));- }+ if (noteId == null) return;+ runBackgroundAction(noteId, noteContent, contentHash, action, options, {+ noModel: t("notes.actions.errors.noModel"),+ actionFailed: t("notes.actions.errors.actionFailed"),+ });},- [onSuccess, onError, t]+ [noteId, t]);const cancel = useCallback(() => {- cancelledRef.current = true;- processingRef.current = false;- if (successTimeoutRef.current) {- clearTimeout(successTimeoutRef.current);- successTimeoutRef.current = null;- }- setState("idle");- setActionName(null);- }, []);+ if (noteId != null) storeCancelAction(noteId);+ }, [noteId]);return { state, actionName, runAction, cancel };}diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 64191ac05..697287448 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -27,6 +27,7 @@ export interface TranscriptionSettings {}export interface CleanupSettings {+ autoGenerateNoteTitle: boolean;useCleanupModel: boolean;useDictationAgent: boolean;cleanupModel: string;@@ -203,6 +204,8 @@ function useSettingsInternal() {customDictionary: store.customDictionary,assemblyAiStreaming: store.assemblyAiStreaming,setAssemblyAiStreaming: store.setAssemblyAiStreaming,+ autoGenerateNoteTitle: store.autoGenerateNoteTitle,+ setAutoGenerateNoteTitle: store.setAutoGenerateNoteTitle,useCleanupModel: store.useCleanupModel,useDictationAgent: store.useDictationAgent,cleanupModel: store.cleanupModel,diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 84891275d..5b744766c 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1493,6 +1493,10 @@"chatIntelligence": "Chat"}},+ "noteFormatting": {+ "autoGenerateTitle": "Notiztitel automatisch generieren",+ "autoGenerateTitleDescription": "KI verwenden, um nach der Transkription oder Verbesserung einen kurzen Titel für Notizen zu generieren"+ },"transcription": {"customSetup": "Benutzerdefinierte Einrichtung","customSetupDescription": "Verwenden Sie Ihren eigenen Anbieter und API-Schlüssel.",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 60e85cb26..53d5120c9 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1589,6 +1589,10 @@"chatIntelligence": "Chat"}},+ "noteFormatting": {+ "autoGenerateTitle": "Auto-generate note titles",+ "autoGenerateTitleDescription": "Use AI to generate a short title for notes after transcription or enhancement"+ },"transcription": {"customSetup": "Custom Setup","customSetupDescription": "Use your own provider and API key.",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex a5c148880..c32b5acfe 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1541,6 +1541,10 @@"chatIntelligence": "Chat"}},+ "noteFormatting": {+ "autoGenerateTitle": "Generar títulos de notas automáticamente",+ "autoGenerateTitleDescription": "Usar IA para generar un título corto para las notas después de la transcripción o mejora"+ },"transcription": {"customSetup": "Configuración personalizada","customSetupDescription": "Usa tu propio proveedor y clave API.",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 5f48e11da..3f0371845 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1541,6 +1541,10 @@"chatIntelligence": "Chat"}},+ "noteFormatting": {+ "autoGenerateTitle": "Générer automatiquement les titres des notes",+ "autoGenerateTitleDescription": "Utiliser l'IA pour générer un titre court pour les notes après la transcription ou l'amélioration"+ },"transcription": {"customSetup": "Configuration personnalisée","customSetupDescription": "Utilisez votre propre fournisseur et clé API.",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex d8f89ed81..50ec9284e 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1493,6 +1493,10 @@"chatIntelligence": "Chat"}},+ "noteFormatting": {+ "autoGenerateTitle": "Genera automaticamente i titoli delle note",+ "autoGenerateTitleDescription": "Usa l'IA per generare un titolo breve per le note dopo la trascrizione o il miglioramento"+ },"transcription": {"customSetup": "Configurazione personalizzata","customSetupDescription": "Usa il tuo provider e la tua chiave API.",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 7ec3dc699..d73bcfdab 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1493,6 +1493,10 @@"chatIntelligence": "チャット"}},+ "noteFormatting": {+ "autoGenerateTitle": "ノートのタイトルを自動生成",+ "autoGenerateTitleDescription": "文字起こしや改善後にAIを使用してノートの短いタイトルを生成します"+ },"transcription": {"customSetup": "カスタム設定","customSetupDescription": "独自のプロバイダーと API キーを使用。",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex bb424e43d..feebb659b 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1465,6 +1465,10 @@"chatIntelligence": "Chat"}},+ "noteFormatting": {+ "autoGenerateTitle": "Gerar títulos de notas automaticamente",+ "autoGenerateTitleDescription": "Usar IA para gerar um título curto para notas após transcrição ou aprimoramento"+ },"transcription": {"customSetup": "Configuração personalizada","customSetupDescription": "Use seu próprio provedor e chave API.",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 58b90fdc9..dba3e1995 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1493,6 +1493,10 @@"chatIntelligence": "Чат"}},+ "noteFormatting": {+ "autoGenerateTitle": "Автоматически генерировать заголовки заметок",+ "autoGenerateTitleDescription": "Использовать ИИ для создания краткого заголовка заметок после транскрипции или улучшения"+ },"transcription": {"customSetup": "Пользовательская настройка","customSetupDescription": "Используйте собственного провайдера и API-ключ.",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex d18718411..cbc04ca96 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -1488,6 +1488,10 @@"chatIntelligence": "聊天"}},+ "noteFormatting": {+ "autoGenerateTitle": "自动生成笔记标题",+ "autoGenerateTitleDescription": "使用 AI 在转录或增强后为笔记生成简短标题"+ },"transcription": {"customSetup": "自定义设置","customSetupDescription": "使用你自己的服务商和 API Key。",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 2f98726c2..335920784 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -1488,6 +1488,10 @@"chatIntelligence": "聊天"}},+ "noteFormatting": {+ "autoGenerateTitle": "自動產生筆記標題",+ "autoGenerateTitleDescription": "使用 AI 在轉錄或增強後為筆記產生簡短標題"+ },"transcription": {"customSetup": "自訂設定","customSetupDescription": "使用你自己的供應商和 API Key。",diff --git a/src/stores/actionProcessingStore.ts b/src/stores/actionProcessingStore.tsnew file mode 100644index 000000000..3009fb933--- /dev/null+++ b/src/stores/actionProcessingStore.ts@@ -0,0 +1,194 @@+import { create } from "zustand";+import reasoningService from "../services/ReasoningService";+import { getEffectiveCleanupModel, getSettings } from "./settingsStore";+import { generateNoteTitle } from "../utils/generateTitle";+import type { ActionItem } from "../types/electron";++export type ActionProcessingStatus = "idle" | "processing" | "success";++export interface NoteActionState {+ status: ActionProcessingStatus;+ actionName: string | null;+}++export interface ActionErrorEvent {+ noteId: number;+ message: string;+}++interface ActionProcessingStoreState {+ noteStates: Record<number, NoteActionState>;+ errorEvents: ActionErrorEvent[];+}++const cancelledFlags = new Map<number, boolean>();+const processingFlags = new Map<number, boolean>();+const successTimers = new Map<number, NodeJS.Timeout>();++const IDLE_STATE: NoteActionState = { status: "idle", actionName: null };++function setNoteState(noteId: number, patch: Partial<NoteActionState>) {+ const { noteStates } = useActionProcessingStore.getState();+ const prev = noteStates[noteId] ?? IDLE_STATE;+ useActionProcessingStore.setState({+ noteStates: { ...noteStates, [noteId]: { ...prev, ...patch } },+ });+}++function clearNoteState(noteId: number) {+ const { noteStates } = useActionProcessingStore.getState();+ const next = { ...noteStates };+ delete next[noteId];+ useActionProcessingStore.setState({ noteStates: next });+}++function pushErrorEvent(event: ActionErrorEvent) {+ const { errorEvents } = useActionProcessingStore.getState();+ useActionProcessingStore.setState({ errorEvents: [...errorEvents, event] });+}++export const useActionProcessingStore = create<ActionProcessingStoreState>()(() => ({+ noteStates: {},+ errorEvents: [],+}));++const BASE_SYSTEM_PROMPT = `You are a note enhancement assistant. The user will provide raw notes — possibly voice-transcribed, rough, or unstructured. Your job is to clean them up according to the instructions below while preserving all original meaning and information. Output clean markdown.++FORMAT RULES (strict):+- Do NOT include any preamble: no title, no date/time/location, no attendee list, no topic header. Start directly with the content.+- Do NOT use tables, horizontal rules, or block quotes.+- Do NOT list or guess participant names/roles.+- Keep the tone professional and concise. Bias toward brevity.++Instructions: `;++const MEETING_SYSTEM_PROMPT = `You are a professional meeting notes assistant. You will receive a dual-speaker transcript where "You:" marks the user's speech and "Them:" marks the other participant(s), along with any manual notes the user took.++Your job is to produce clean, actionable meeting notes in markdown. Follow these rules:++FORMAT RULES (strict):+- Do NOT include any preamble: no title, no "# Meeting Notes", no date/time/location, no attendee list, no topic header. Start directly with the summary.+- Do NOT use tables, horizontal rules, or block quotes.+- Do NOT list or guess participant names/roles.+- Start with a concise 1–2 sentence summary of what the meeting was about.+- Use clear section headings: ## Key Discussion Points, ## Decisions Made, ## Action Items, ## Follow-ups (omit any section that has no content).+- Under Action Items, use checkboxes (\`- [ ]\`) and attribute each item to "You" or "Them" where clear.++CONTENT RULES:+- Preserve important quotes or specific commitments verbatim when they carry meaning.+- Remove filler, small talk, false starts, and repeated/redundant content.+- Where speakers refer to the same topic across multiple turns, consolidate into a coherent point rather than listing every utterance.+- If the user included manual notes alongside the transcript, integrate them — they represent the user's emphasis on what matters most.+- Keep the tone professional and concise. Bias toward brevity.++Instructions: `;++export interface RunActionOptions {+ isCloudMode: boolean;+ modelId: string;+ isMeetingNote?: boolean;+}++export interface RunActionLabels {+ noModel: string;+ actionFailed: string;+}++/**+ * Start processing an action on a note. Runs in the background — survives+ * component unmounts and navigation so the user can switch notes mid-action.+ */+export function runBackgroundAction(+ noteId: number,+ noteContent: string,+ contentHash: string,+ action: ActionItem,+ options: RunActionOptions,+ labels: RunActionLabels+): void {+ if (processingFlags.get(noteId)) return;++ const modelId = getEffectiveCleanupModel() || options.modelId;+ if (!modelId && !options.isCloudMode) {+ pushErrorEvent({ noteId, message: labels.noModel });+ return;+ }++ cancelledFlags.set(noteId, false);+ processingFlags.set(noteId, true);+ setNoteState(noteId, { status: "processing", actionName: action.name });++ (async () => {+ try {+ const basePrompt = options.isMeetingNote ? MEETING_SYSTEM_PROMPT : BASE_SYSTEM_PROMPT;+ const systemPrompt = basePrompt + action.prompt;+ const enhanced = await reasoningService.processText(noteContent, modelId, null, {+ systemPrompt,+ temperature: 0.3,+ disableThinking: getSettings().noteFormattingDisableThinking,+ });++ if (cancelledFlags.get(noteId)) return;++ let title: string | undefined;+ if (getSettings().autoGenerateNoteTitle) {+ const generated = await generateNoteTitle(enhanced, modelId);+ if (generated) title = generated;+ }++ if (cancelledFlags.get(noteId)) return;++ const updates: Record<string, string> = {+ enhanced_content: enhanced,+ enhancement_prompt: action.prompt,+ enhanced_at_content_hash: contentHash,+ };+ if (title) updates.title = title;+ await window.electronAPI.updateNote(noteId, updates);++ setNoteState(noteId, { status: "success", actionName: action.name });++ const timer = setTimeout(() => {+ processingFlags.set(noteId, false);+ clearNoteState(noteId);+ successTimers.delete(noteId);+ }, 600);+ successTimers.set(noteId, timer);+ } catch (err) {+ if (cancelledFlags.get(noteId)) return;+ processingFlags.set(noteId, false);+ clearNoteState(noteId);+ const message = err instanceof Error ? err.message : labels.actionFailed;+ pushErrorEvent({ noteId, message });+ } finally {+ cancelledFlags.delete(noteId);+ }+ })();+}++/** Soft cancel: the HTTP request continues but the result is discarded. */+export function cancelAction(noteId: number): void {+ cancelledFlags.set(noteId, true);+ processingFlags.set(noteId, false);+ const timer = successTimers.get(noteId);+ if (timer) {+ clearTimeout(timer);+ successTimers.delete(noteId);+ }+ clearNoteState(noteId);+}++export function consumeErrorEvents(): ActionErrorEvent[] {+ const { errorEvents } = useActionProcessingStore.getState();+ if (errorEvents.length === 0) return [];+ useActionProcessingStore.setState({ errorEvents: [] });+ return errorEvents;+}++export function selectNoteActionState(+ state: ActionProcessingStoreState,+ noteId: number | null+): NoteActionState {+ if (noteId == null) return IDLE_STATE;+ return state.noteStates[noteId] ?? IDLE_STATE;+}diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex 7540187b9..08f47cbca 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -106,6 +106,7 @@ const BOOLEAN_SETTINGS = new Set(["allowOpenAIFallback","allowLocalFallback","assemblyAiStreaming",+ "autoGenerateNoteTitle","useCleanupModel","useDictationAgent","preferBuiltInMic",@@ -431,6 +432,7 @@ export interface SettingsStatesetCleanupCloudBaseUrl: (value: string) => void;setCustomDictionary: (words: string[]) => void;setAssemblyAiStreaming: (value: boolean) => void;+ setAutoGenerateNoteTitle: (value: boolean) => void;setUseCleanupModel: (value: boolean) => void;setUseDictationAgent: (value: boolean) => void;setCleanupModel: (value: string) => void;@@ -646,6 +648,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({customDictionary: readStringArray("customDictionary", []),assemblyAiStreaming: readBoolean("assemblyAiStreaming", true),+ autoGenerateNoteTitle: readBoolean("autoGenerateNoteTitle", true),useCleanupModel: readBoolean("useCleanupModel", true),useDictationAgent: readBoolean("useDictationAgent", true),cleanupModel: readString("cleanupModel", ""),@@ -922,6 +925,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({setCleanupCloudMode: createStringSetter("cleanupCloudMode"),setCleanupCloudBaseUrl: createStringSetter("cleanupCloudBaseUrl"),setAssemblyAiStreaming: createBooleanSetter("assemblyAiStreaming"),+ setAutoGenerateNoteTitle: createBooleanSetter("autoGenerateNoteTitle"),setUseCleanupModel: createBooleanSetter("useCleanupModel"),setUseDictationAgent: createBooleanSetter("useDictationAgent"),setCleanupProvider: createStringSetter("cleanupProvider"),