diff --git a/src/main/persistence/loading-store/normalize-loaded-global-settings.test.ts b/src/main/persistence/loading-store/normalize-loaded-global-settings.test.ts index 49692dcae4e..0969c127964 100644 --- a/src/main/persistence/loading-store/normalize-loaded-global-settings.test.ts +++ b/src/main/persistence/loading-store/normalize-loaded-global-settings.test.ts @@ -1,7 +1,7 @@ import { homedir } from 'node:os' import { expect, it } from 'vitest' import { resolveAntigravityChatAuthConfig } from '../../../shared/antigravity-chat-auth-config' -import { getDefaultPersistedState } from '../../../shared/constants' +import { getDefaultPersistedState, getDefaultVoiceSettings } from '../../../shared/constants' import type { PersistedState } from '../../../shared/persisted-state-types' import { normalizeLoadedGlobalSettings } from './normalize-loaded-global-settings' import { prepareLoadedTerminalSettings } from './prepare-loaded-terminal-settings' @@ -35,3 +35,19 @@ it('keeps existing Antigravity profiles personal and preserves explicit or malfo expect(malformed).toBeNull() expect(() => resolveAntigravityChatAuthConfig(malformed)).toThrow('account settings') }) + +it('moves the old Toggle dictation default to Auto once and keeps Hold and later choices', () => { + const voice = (dictationMode: string) => ({ ...getDefaultVoiceSettings(), dictationMode }) + const legacy = { voiceDictationModeDefaultedToAuto: undefined } + + const migrated = normalizeLegacyProfile({ ...legacy, voice: voice('toggle') }) + expect(migrated.voice?.dictationMode).toBe('auto') + expect(migrated.voiceDictationModeDefaultedToAuto).toBe(true) + expect(normalizeLegacyProfile({ ...legacy, voice: voice('hold') }).voice?.dictationMode).toBe( + 'hold' + ) + expect( + normalizeLegacyProfile({ voiceDictationModeDefaultedToAuto: true, voice: voice('toggle') }) + .voice?.dictationMode + ).toBe('toggle') +}) diff --git a/src/main/persistence/loading-store/normalize-loaded-global-settings.ts b/src/main/persistence/loading-store/normalize-loaded-global-settings.ts index 654d75cce60..7a954d5b6c3 100644 --- a/src/main/persistence/loading-store/normalize-loaded-global-settings.ts +++ b/src/main/persistence/loading-store/normalize-loaded-global-settings.ts @@ -73,6 +73,16 @@ export function normalizeLoadedGlobalSettings( } = profile const pluginOwnedSettings = normalizePluginOwnedSettings(parsed.settings ?? {}) const voice = { ...getDefaultVoiceSettings(), ...parsed.settings?.voice } + // Stored 'toggle' was everyone's old default, and Auto still toggles on a tap; Hold was always a choice. + if ( + voice.dictationMode !== 'hold' && + !( + parsed.settings?.voiceDictationModeDefaultedToAuto === true && + voice.dictationMode === 'toggle' + ) + ) { + voice.dictationMode = 'auto' + } const matchTerminalSidebarInputs = { pluginAppThemeLight: pluginOwnedSettings.pluginAppThemeLight, pluginAppThemeDark: pluginOwnedSettings.pluginAppThemeDark, @@ -184,6 +194,7 @@ export function normalizeLoadedGlobalSettings( migratedSourceControlAi, parsed.settings?.commitMessageAi ?? defaults.settings.commitMessageAi ), - voice: { ...voice, sttModel: replaceRetiredSpeechModelId(voice.sttModel) } + voice: { ...voice, sttModel: replaceRetiredSpeechModelId(voice.sttModel) }, + voiceDictationModeDefaultedToAuto: true } } diff --git a/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts b/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts index 9472153d322..1e78595e19a 100644 --- a/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts +++ b/src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts @@ -58,11 +58,12 @@ describe('createMainWindow', () => { return browserWindowInstance }) - const voice: { enabled: boolean; sttModel: string; dictationMode: 'toggle' | 'hold' } = { - enabled: false, - sttModel: '', - dictationMode: 'toggle' - } + const voice: { enabled: boolean; sttModel: string; dictationMode: 'auto' | 'toggle' | 'hold' } = + { + enabled: false, + sttModel: '', + dictationMode: 'toggle' + } createMainWindow({ getUI: () => ({}) as never, getSettings: () => ({ windowBackgroundBlur: false, voice }) as never, @@ -106,7 +107,24 @@ describe('createMainWindow', () => { expect(holdPreventDefault).not.toHaveBeenCalled() expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown') + voice.dictationMode = 'auto' + const autoPreventDefault = vi.fn() + windowHandlers['before-input-event']( + { preventDefault: autoPreventDefault } as never, + dictationInput as never + ) + expect(autoPreventDefault).not.toHaveBeenCalled() + expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown') + voice.dictationMode = 'toggle' + const composingPreventDefault = vi.fn() + windowHandlers['before-input-event']( + { preventDefault: composingPreventDefault } as never, + { ...dictationInput, isComposing: true } as never + ) + expect(composingPreventDefault).not.toHaveBeenCalled() + expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown') + const togglePreventDefault = vi.fn() windowHandlers['before-input-event']( { preventDefault: togglePreventDefault } as never, @@ -125,7 +143,7 @@ describe('createMainWindow', () => { expect(webContents.send).not.toHaveBeenCalled() }) - it('only intercepts double-tap dictation when enabled toggle mode can handle it', () => { + it('only intercepts double-tap dictation when enabled toggle or auto mode can handle it', () => { const windowHandlers: Record void> = {} const webContents = { on: vi.fn((event, handler) => { @@ -158,11 +176,12 @@ describe('createMainWindow', () => { return browserWindowInstance }) - const voice: { enabled: boolean; sttModel: string; dictationMode: 'toggle' | 'hold' } = { - enabled: false, - sttModel: '', - dictationMode: 'toggle' - } + const voice: { enabled: boolean; sttModel: string; dictationMode: 'auto' | 'toggle' | 'hold' } = + { + enabled: false, + sttModel: '', + dictationMode: 'toggle' + } createMainWindow( { getUI: () => ({}), @@ -214,9 +233,9 @@ describe('createMainWindow', () => { expect(holdPreventDefault).not.toHaveBeenCalled() expect(webContents.send).not.toHaveBeenCalledWith('ui:dictationKeyDown') - voice.dictationMode = 'toggle' - const togglePreventDefault = triggerDoubleTapShift() - expect(togglePreventDefault).toHaveBeenCalledTimes(1) + voice.dictationMode = 'auto' + const autoPreventDefault = triggerDoubleTapShift() + expect(autoPreventDefault).toHaveBeenCalledTimes(1) expect(webContents.send).toHaveBeenCalledWith('ui:dictationKeyDown') }) diff --git a/src/main/window/main-window-shortcut-routing.ts b/src/main/window/main-window-shortcut-routing.ts index 816e18cb89f..edb541fffab 100644 --- a/src/main/window/main-window-shortcut-routing.ts +++ b/src/main/window/main-window-shortcut-routing.ts @@ -80,15 +80,19 @@ export function installMainWindowShortcutRouting(args: { ? getWindowShortcutActionId(action) : null - // Hold dictation needs renderer keyup; consume only single-keydown toggles in main. + // Hold and Auto need renderer keyup; consume only single-keydown toggles in main. if (action.type === 'dictationKeyDown') { const voiceSettings = store?.getSettings().voice // No model still forwards: the renderer's startDictation shows the setup toast. - if (!voiceSettings?.enabled) { + if (!voiceSettings?.enabled || textInputOwnsComposition(options.input)) { return false } - const dictationMode = voiceSettings.dictationMode ?? 'toggle' - if (dictationMode === 'hold') { + const dictationMode = voiceSettings.dictationMode ?? 'auto' + // A double tap has no release to hold, so Auto toggles on it. + const toggles = + dictationMode === 'toggle' || + (dictationMode === 'auto' && options.input.doubleTapModifier !== undefined) + if (!toggles) { return false } if (isAutoRepeat) { diff --git a/src/renderer/src/components/dictation/DictationController.tsx b/src/renderer/src/components/dictation/DictationController.tsx index 30a4c1168a2..65bd521ed17 100644 --- a/src/renderer/src/components/dictation/DictationController.tsx +++ b/src/renderer/src/components/dictation/DictationController.tsx @@ -262,10 +262,10 @@ export function DictationController() { } }, [startDictation, stopDictation]) - // Toggle mode uses intercepted main IPC so the chord cannot reach xterm or system shortcuts. + // Toggle presses, and Auto double taps (which have no release), arrive as intercepted main IPC so the chord cannot reach xterm or system shortcuts. useEffect(() => { - const mode = settings?.voice?.dictationMode ?? 'toggle' - if (mode !== 'toggle' || !settings?.voice?.enabled) { + const mode = settings?.voice?.dictationMode ?? 'auto' + if (mode === 'hold' || !settings?.voice?.enabled) { return } return window.api.ui.onDictationKeyDown(toggleDictation) diff --git a/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx b/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx index 4978368616e..f0b2a1b424d 100644 --- a/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx +++ b/src/renderer/src/components/dictation/use-hold-dictation-gesture.test.tsx @@ -12,6 +12,7 @@ const originalUserAgent = navigator.userAgent let root: Root | null = null let container: HTMLDivElement | null = null let dictationState: DictationState +let dictationMode: 'auto' | 'hold' let startDictation: ReturnType void>> let stopDictation: ReturnType void>> @@ -27,7 +28,7 @@ function holdSettings(): GlobalSettings { voice: { enabled: true, sttModel: 'test-model', - dictationMode: 'hold' + dictationMode } } as GlobalSettings } @@ -74,6 +75,7 @@ function beginHold(init: KeyboardEventInit = {}): void { beforeEach(() => { setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)') dictationState = 'idle' + dictationMode = 'hold' startDictation = vi.fn<() => void>() stopDictation = vi.fn<() => void>() }) @@ -153,3 +155,55 @@ describe('useHoldDictationGesture', () => { expect(startDictation).toHaveBeenCalledTimes(1) }) }) + +describe('useHoldDictationGesture in Auto mode', () => { + let now = 0 + + beforeEach(() => { + dictationMode = 'auto' + now = 1000 + vi.spyOn(performance, 'now').mockImplementation(() => now) + }) + + it('keeps recording after a tap and stops on the next press', async () => { + await renderProbe() + + beginHold() + now += 299 + act(() => { + dispatchKeyUp({ key: 'e', code: 'KeyE', metaKey: true }) + }) + expect(stopDictation).not.toHaveBeenCalled() + + act(() => { + dispatchKeyDown({ key: 'e', code: 'KeyE', metaKey: true }) + }) + expect(startDictation).toHaveBeenCalledTimes(1) + expect(stopDictation).toHaveBeenCalledTimes(1) + }) + + it('stops on release after a press held for 300 ms', async () => { + await renderProbe() + + beginHold() + act(() => { + dispatchKeyDown({ key: 'e', code: 'KeyE', metaKey: true, repeat: true }) + }) + now += 300 + act(() => { + dispatchKeyUp({ key: 'Meta', code: 'MetaLeft', metaKey: false }) + }) + + expect(startDictation).toHaveBeenCalledTimes(1) + expect(stopDictation).toHaveBeenCalledTimes(1) + }) + + it('leaves the shortcut to the IME while composing', async () => { + await renderProbe() + + const event = dispatchKeyDown({ key: 'e', code: 'KeyE', metaKey: true, isComposing: true }) + + expect(event.defaultPrevented).toBe(false) + expect(startDictation).not.toHaveBeenCalled() + }) +}) diff --git a/src/renderer/src/components/dictation/use-hold-dictation-gesture.ts b/src/renderer/src/components/dictation/use-hold-dictation-gesture.ts index 96d7e998117..0eb482cf0c4 100644 --- a/src/renderer/src/components/dictation/use-hold-dictation-gesture.ts +++ b/src/renderer/src/components/dictation/use-hold-dictation-gesture.ts @@ -16,9 +16,13 @@ type HoldDictationReleaseMatcher = (event: KeyboardEvent) => boolean type ActiveHold = { matchesRelease: HoldDictationReleaseMatcher + pressedAt: number startedDictation: boolean } +// Auto: a press held this long records until release; a shorter tap leaves dictation running. +const AUTO_HOLD_THRESHOLD_MS = 300 + type HeldModifiers = { alt: boolean control: boolean @@ -110,7 +114,7 @@ export function useHoldDictationGesture({ stopDictation }: HoldDictationGestureOptions): void { const activeHoldRef = useRef(null) - const mode = settings?.voice?.dictationMode ?? 'toggle' + const mode = settings?.voice?.dictationMode ?? 'auto' const enabled = settings?.voice?.enabled === true // Settings and keybinding refreshes re-create these inputs; re-running the effect would end a held dictation. const start = useEffectEvent(() => void startDictation()) @@ -120,30 +124,48 @@ export function useHoldDictationGesture({ keybindingMatchesAction('voice.dictation', e, getShortcutPlatform(), keybindings) ) - // Hold mode owns DOM press/release events; main before-input-event suppresses keyup after preventDefault. + // Hold and Auto own DOM press/release events; main before-input-event suppresses keyup after preventDefault. useEffect(() => { - if (mode !== 'hold' || !enabled) { + if (mode === 'toggle' || !enabled) { return } - // Losing the release (blur, hidden, mode change) still stops, which inserts what was said. + // Losing the release (blur, hidden, mode change) counts as releasing now, which inserts what was said. const endHold = (): void => { - if (!activeHoldRef.current) { + const hold = activeHoldRef.current + if (!hold) { return } activeHoldRef.current = null - stop() + if ( + mode === 'hold' || + (hold.startedDictation && performance.now() - hold.pressedAt >= AUTO_HOLD_THRESHOLD_MS) + ) { + stop() + } } const handleKeyDown = (e: KeyboardEvent): void => { - if (!matchesShortcut(e)) { + // keyCode 229: IME keydowns that some engines send without isComposing. + if (e.isComposing || e.keyCode === 229 || !matchesShortcut(e)) { + return + } + if (e.target instanceof Element && e.target.closest('[data-shortcut-recorder-active]')) { return } e.preventDefault() e.stopPropagation() if (!e.repeat) { + // macOS drops the shortcut key's keyup while Cmd is held, so every fresh press starts over. + activeHoldRef.current = null + if (mode === 'auto' && !canStart()) { + // A tap started this dictation; the next press ends it. + stop() + return + } activeHoldRef.current = { matchesRelease: createHoldDictationReleaseMatcher(e), + pressedAt: performance.now(), startedDictation: false } } diff --git a/src/renderer/src/components/settings/voice/VoiceDictationSettingsSection.tsx b/src/renderer/src/components/settings/voice/VoiceDictationSettingsSection.tsx index cbf29f4986b..9b9d812efc6 100644 --- a/src/renderer/src/components/settings/voice/VoiceDictationSettingsSection.tsx +++ b/src/renderer/src/components/settings/voice/VoiceDictationSettingsSection.tsx @@ -54,14 +54,14 @@ export function VoiceDictationSettingsSection({

{t( - 'auto.components.settings.VoicePane.dictationModesDescription', - 'Toggle: press {{shortcut}} once to start, again to stop. Hold: dictate while {{shortcut}} is held.', + 'auto.components.settings.VoicePane.dictationModesWithAutoDescription', + 'Auto: hold {{shortcut}} to dictate until you let go, or tap it to start and stop. Hold: dictate while {{shortcut}} is held. Toggle: press {{shortcut}} once to start, again to stop.', { shortcut: shortcutLabel } )}

- {(['toggle', 'hold'] as const).map((mode) => ( + {(['auto', 'hold', 'toggle'] as const).map((mode) => ( ))}
diff --git a/src/renderer/src/i18n/locales/de.json b/src/renderer/src/i18n/locales/de.json index d78eb761b2c..10a94dbdac2 100644 --- a/src/renderer/src/i18n/locales/de.json +++ b/src/renderer/src/i18n/locales/de.json @@ -9472,7 +9472,8 @@ "cd9fe37556": "Mikrofonberechtigung erteilt", "openAiKeyName": "OpenAI-Transkriptionsschlüssel", "dictationShortcutDescription": "Mit {{shortcut}} Text in den jeweils fokussierten Bereich diktieren.", - "dictationModesDescription": "Umschalten: {{shortcut}} einmal zum Starten und erneut zum Stoppen drücken. Gedrückt halten: Diktieren, solange {{shortcut}} gedrückt bleibt." + "dictationModeAuto": "Automatisch", + "dictationModesWithAutoDescription": "Automatisch: Halten Sie {{shortcut}} gedrückt, um bis zum Loslassen zu diktieren, oder tippen Sie kurz zum Starten und Stoppen. Gedrückt halten: Diktieren, solange {{shortcut}} gedrückt bleibt. Umschalten: {{shortcut}} einmal zum Starten und erneut zum Stoppen drücken." }, "WorktreeSymlinksSection": { "1c1e35b219": "{{value0}} entfernen", diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index b3999e2cb65..d32ef9c0f35 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -9773,7 +9773,8 @@ "cd9fe37556": "Microphone permission granted", "openAiKeyName": "Your OpenAI transcription key", "dictationShortcutDescription": "Press {{shortcut}} to dictate text into any focused pane.", - "dictationModesDescription": "Toggle: press {{shortcut}} once to start, again to stop. Hold: dictate while {{shortcut}} is held." + "dictationModeAuto": "Auto", + "dictationModesWithAutoDescription": "Auto: hold {{shortcut}} to dictate until you let go, or tap it to start and stop. Hold: dictate while {{shortcut}} is held. Toggle: press {{shortcut}} once to start, again to stop." }, "WorktreeSymlinksSection": { "1c1e35b219": "Remove {{value0}}", diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json index afec0da848c..4ac6afe81f0 100644 --- a/src/renderer/src/i18n/locales/es.json +++ b/src/renderer/src/i18n/locales/es.json @@ -9070,7 +9070,8 @@ "6fa734ed95": "Eliminar {{value0}}", "openAiKeyName": "Su clave de transcripción OpenAI", "dictationShortcutDescription": "Pulsa {{shortcut}} para dictar texto en cualquier panel con foco.", - "dictationModesDescription": "Alternar: pulsa {{shortcut}} una vez para empezar y otra para parar. Mantener: dicta mientras {{shortcut}} se mantiene presionado." + "dictationModeAuto": "Automático", + "dictationModesWithAutoDescription": "Automático: mantén {{shortcut}} para dictar hasta que lo sueltes, o tócalo para empezar y parar. Mantener: dicta mientras {{shortcut}} se mantiene presionado. Alternar: pulsa {{shortcut}} una vez para empezar y otra para parar." }, "WorktreeSymlinksSection": { "1c1e35b219": "Quitar {{value0}}", diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.json index 20adb6a78f7..d3f242e204a 100644 --- a/src/renderer/src/i18n/locales/fr.json +++ b/src/renderer/src/i18n/locales/fr.json @@ -9341,7 +9341,8 @@ "cd9fe37556": "Autorisation d'accès au micro accordée", "openAiKeyName": "Votre clé de transcription OpenAI", "dictationShortcutDescription": "Appuyez sur {{shortcut}} pour dicter du texte dans n'importe quel volet actif.", - "dictationModesDescription": "Bascule : appuyez une fois sur {{shortcut}} pour démarrer, puis à nouveau pour arrêter. Maintien : dictez tant que {{shortcut}} est maintenu." + "dictationModeAuto": "Auto", + "dictationModesWithAutoDescription": "Auto : maintenez {{shortcut}} pour dicter jusqu’à ce que vous relâchiez, ou appuyez brièvement pour démarrer et arrêter. Maintien : dictez tant que {{shortcut}} est maintenu. Bascule : appuyez une fois sur {{shortcut}} pour démarrer, puis à nouveau pour arrêter." }, "WorktreeSymlinksSection": { "1c1e35b219": "Supprimer {{value0}}", diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json index 32c2cdafe37..5ade6d7de9b 100644 --- a/src/renderer/src/i18n/locales/ja.json +++ b/src/renderer/src/i18n/locales/ja.json @@ -8813,7 +8813,8 @@ "6fa734ed95": "{{value0}} を削除", "openAiKeyName": "OpenAI 転写キー", "dictationShortcutDescription": "{{shortcut}} を押すと、フォーカスされているペインにテキストを音声入力できます。", - "dictationModesDescription": "トグル: {{shortcut}} を1回押すと開始し、もう一度押すと停止します。ホールド: {{shortcut}} を押している間、音声入力します。" + "dictationModeAuto": "自動", + "dictationModesWithAutoDescription": "自動:{{shortcut}} を押し続けると離すまで音声入力し、短く押すと開始と停止を切り替えます。ホールド:{{shortcut}} を押している間、音声入力します。トグル:{{shortcut}} を1回押すと開始し、もう一度押すと停止します。" }, "WorktreeSymlinksSection": { "1c1e35b219": "{{value0}} を削除", diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json index 76a5d1faa93..6f390450280 100644 --- a/src/renderer/src/i18n/locales/ko.json +++ b/src/renderer/src/i18n/locales/ko.json @@ -8776,7 +8776,8 @@ "6fa734ed95": "{{value0}} 삭제", "openAiKeyName": "OpenAI 트랜스크립션 키", "dictationShortcutDescription": "{{shortcut}} 단축키를 눌러 포커스된 패널에 텍스트를 받아쓰세요.", - "dictationModesDescription": "토글: {{shortcut}} 단축키를 한 번 누르면 받아쓰기를 시작하고, 다시 누르면 중지합니다. 길게 누르기: {{shortcut}} 단축키를 누르고 있는 동안 받아쓰기합니다." + "dictationModeAuto": "자동", + "dictationModesWithAutoDescription": "자동: {{shortcut}} 단축키를 길게 누르면 손을 뗄 때까지 받아쓰기하고, 짧게 누르면 시작하고 중지합니다. 길게 누르기: {{shortcut}} 단축키를 누르고 있는 동안 받아쓰기합니다. 토글: {{shortcut}} 단축키를 한 번 누르면 받아쓰기를 시작하고, 다시 누르면 중지합니다." }, "WorktreeSymlinksSection": { "1c1e35b219": "{{value0}} 제거", diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.json index f8149a363dc..3680dde7973 100644 --- a/src/renderer/src/i18n/locales/pt.json +++ b/src/renderer/src/i18n/locales/pt.json @@ -6504,7 +6504,8 @@ "cd9fe37556": "Permissão do microfone concedida", "openAiKeyName": "Sua chave de transcrição da OpenAI", "dictationShortcutDescription": "Pressione {{shortcut}} para ditar texto em qualquer painel com foco.", - "dictationModesDescription": "Alternar: pressione {{shortcut}} uma vez para iniciar e novamente para parar. Manter pressionado: dite enquanto mantém {{shortcut}} pressionado." + "dictationModeAuto": "Automático", + "dictationModesWithAutoDescription": "Automático: mantenha {{shortcut}} pressionado para ditar até soltar, ou toque para iniciar e parar. Manter pressionado: dite enquanto mantém {{shortcut}} pressionado. Alternar: pressione {{shortcut}} uma vez para iniciar e novamente para parar." }, "NotificationsPane": { "906b4afebf": "Enviar Notificação de Teste", diff --git a/src/renderer/src/i18n/locales/ru.json b/src/renderer/src/i18n/locales/ru.json index 555016e3141..aac2153b032 100644 --- a/src/renderer/src/i18n/locales/ru.json +++ b/src/renderer/src/i18n/locales/ru.json @@ -9826,7 +9826,8 @@ "cd9fe37556": "Доступ к микрофону разрешён", "openAiKeyName": "Ваш ключ расшифровки OpenAI", "dictationShortcutDescription": "Нажмите {{shortcut}}, чтобы диктовать текст в любую активную панель.", - "dictationModesDescription": "Переключение: нажмите {{shortcut}} для начала и ещё раз для остановки. Удержание: диктуйте, пока удерживаете {{shortcut}}." + "dictationModeAuto": "Авто", + "dictationModesWithAutoDescription": "Авто: удерживайте {{shortcut}}, чтобы диктовать до отпускания, или нажмите коротко, чтобы начать и остановить. Удержание: диктуйте, пока удерживаете {{shortcut}}. Переключение: нажмите {{shortcut}} для начала и ещё раз для остановки." }, "WorktreeSymlinksSection": { "1c1e35b219": "Удалить {{value0}}", diff --git a/src/renderer/src/i18n/locales/tr.json b/src/renderer/src/i18n/locales/tr.json index 8cca758d576..e07836f1c68 100644 --- a/src/renderer/src/i18n/locales/tr.json +++ b/src/renderer/src/i18n/locales/tr.json @@ -9456,7 +9456,8 @@ "cd9fe37556": "Mikrofon izni verildi", "openAiKeyName": "OpenAI transkripsiyon anahtarınız", "dictationShortcutDescription": "Odaktaki herhangi bir bölmeye metin dikte etmek için {{shortcut}} tuşlarına basın.", - "dictationModesDescription": "Aç/kapat: başlatmak için {{shortcut}} tuşlarına bir kez, durdurmak için tekrar basın. Basılı tut: {{shortcut}} basılıyken dikte edin." + "dictationModeAuto": "Otomatik", + "dictationModesWithAutoDescription": "Otomatik: bırakana kadar dikte etmek için {{shortcut}} tuşlarını basılı tutun veya başlatıp durdurmak için kısaca dokunun. Basılı tut: {{shortcut}} basılıyken dikte edin. Aç/kapat: başlatmak için {{shortcut}} tuşlarına bir kez, durdurmak için tekrar basın." }, "WorktreeSymlinksSection": { "1c1e35b219": "{{value0}} kaldırılsın mı", diff --git a/src/renderer/src/i18n/locales/zh-Hant.json b/src/renderer/src/i18n/locales/zh-Hant.json index 510f4384caf..22e5db81687 100644 --- a/src/renderer/src/i18n/locales/zh-Hant.json +++ b/src/renderer/src/i18n/locales/zh-Hant.json @@ -9293,7 +9293,8 @@ "cd9fe37556": "已授予麥克風權限", "openAiKeyName": "您的 OpenAI 轉錄金鑰", "dictationShortcutDescription": "按 {{shortcut}} 可將文字聽寫到目前取得焦點的任意窗格中。", - "dictationModesDescription": "切換:按一次 {{shortcut}} 開始,再按一次停止。按住:按住 {{shortcut}} 期間進行聽寫。" + "dictationModeAuto": "自動", + "dictationModesWithAutoDescription": "自動:按住 {{shortcut}} 聽寫,放開即停止;輕按則開始或停止。按住:按住 {{shortcut}} 期間進行聽寫。切換:按一次 {{shortcut}} 開始,再按一次停止。" }, "WorktreeSymlinksSection": { "1c1e35b219": "刪除 {{value0}}", diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json index 1fb865f11e6..a64d7d63dd5 100644 --- a/src/renderer/src/i18n/locales/zh.json +++ b/src/renderer/src/i18n/locales/zh.json @@ -8776,7 +8776,8 @@ "6fa734ed95": "删除 {{value0}}", "openAiKeyName": "您的 OpenAI 转录密钥", "dictationShortcutDescription": "按 {{shortcut}} 可将文本听写到当前聚焦的任意窗格中。", - "dictationModesDescription": "切换:按一次 {{shortcut}} 开始,再按一次停止。按住:按住 {{shortcut}} 期间进行听写。" + "dictationModeAuto": "自动", + "dictationModesWithAutoDescription": "自动:按住 {{shortcut}} 听写,松开即停止;轻按则开始或停止。按住:按住 {{shortcut}} 期间进行听写。切换:按一次 {{shortcut}} 开始,再按一次停止。" }, "WorktreeSymlinksSection": { "1c1e35b219": "删除 {{value0}}", diff --git a/src/shared/constants.ts b/src/shared/constants.ts index 4d2384c57f7..92d2fb484b9 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -119,7 +119,7 @@ export function getDefaultVoiceSettings(): VoiceSettings { sttModel: '', modelsDir: '', dictationLanguage: DICTATION_LANGUAGE_AUTO, - dictationMode: 'toggle' as const, + dictationMode: 'auto' as const, removeFillerWords: true, terminalConfirmBeforeInsert: false, userModels: [], diff --git a/src/shared/default-global-settings.ts b/src/shared/default-global-settings.ts index b3f64242a5a..830d800d58f 100644 --- a/src/shared/default-global-settings.ts +++ b/src/shared/default-global-settings.ts @@ -313,6 +313,7 @@ export function buildDefaultSettings(args: { customAgentCommand: '' }, sourceControlAi: getDefaultSourceControlAiSettings(), - voice: args.voice + voice: args.voice, + voiceDictationModeDefaultedToAuto: true } } diff --git a/src/shared/global-settings-types.ts b/src/shared/global-settings-types.ts index f755b1b07e9..72a0ff434b1 100644 --- a/src/shared/global-settings-types.ts +++ b/src/shared/global-settings-types.ts @@ -493,6 +493,8 @@ export type GlobalSettings = GlobalSettingsBase & { telemetry?: TelemetrySettings /** Voice/dictation settings; persistence merge hydrates getDefaultSettings() values for older profiles. */ voice?: VoiceSettings + /** One-shot migration flag for the Auto dictation-mode default; after migration an explicit Toggle sticks. */ + voiceDictationModeDefaultedToAuto?: boolean /** Transcript full-text search consent + retention. Absent means off; nothing indexes until the user opts in. */ aiVaultSearch?: AiVaultSearchSettings } diff --git a/src/shared/speech-types.ts b/src/shared/speech-types.ts index bd6d1a352de..6b8cc77f47d 100644 --- a/src/shared/speech-types.ts +++ b/src/shared/speech-types.ts @@ -73,7 +73,8 @@ export type UserModelConfig = { sampleRate?: number } -export type DictationMode = 'toggle' | 'hold' +// Auto: holding the shortcut records until release, a tap toggles. +export type DictationMode = 'auto' | 'hold' | 'toggle' export type VoiceSettings = { enabled: boolean