feat(dictation): add an Auto shortcut mode where holding records until release and a tap toggles

This commit is contained in:
Kelvin Amoaba
2026-11-09 05:22:32 +00:00
parent 980becbf88
commit c057e32483
23 changed files with 194 additions and 51 deletions
@@ -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')
})
@@ -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
}
}
@@ -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<string, (...args: any[]) => 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')
})
@@ -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) {
@@ -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)
@@ -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<typeof vi.fn<() => void>>
let stopDictation: ReturnType<typeof vi.fn<() => 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()
})
})
@@ -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<ActiveHold | null>(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
}
}
@@ -54,14 +54,14 @@ export function VoiceDictationSettingsSection({
<Label>{t('auto.components.settings.VoicePane.ba4a900d1d', 'Dictation Mode')}</Label>
<p className="text-xs text-muted-foreground">
{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 }
)}
</p>
</div>
<div className="flex shrink-0 items-center rounded-md border border-border/60 bg-background/50 p-0.5">
{(['toggle', 'hold'] as const).map((mode) => (
{(['auto', 'hold', 'toggle'] as const).map((mode) => (
<button
key={mode}
onClick={() => onUpdateVoiceSettings({ dictationMode: mode })}
@@ -72,9 +72,11 @@ export function VoiceDictationSettingsSection({
: 'text-muted-foreground hover:text-foreground'
} ${!voiceSettings.enabled ? 'opacity-50 cursor-not-allowed' : ''}`}
>
{mode === 'toggle'
? t('auto.components.settings.VoicePane.118b3c2dee', 'Toggle')
: t('auto.components.settings.VoicePane.174da92062', 'Hold')}
{mode === 'auto'
? t('auto.components.settings.VoicePane.dictationModeAuto', 'Auto')
: mode === 'toggle'
? t('auto.components.settings.VoicePane.118b3c2dee', 'Toggle')
: t('auto.components.settings.VoicePane.174da92062', 'Hold')}
</button>
))}
</div>
+2 -1
View File
@@ -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",
+2 -1
View File
@@ -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}}",
+2 -1
View File
@@ -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}}",
+2 -1
View File
@@ -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}}",
+2 -1
View File
@@ -8813,7 +8813,8 @@
"6fa734ed95": "{{value0}} を削除",
"openAiKeyName": "OpenAI 転写キー",
"dictationShortcutDescription": "{{shortcut}} を押すと、フォーカスされているペインにテキストを音声入力できます。",
"dictationModesDescription": "トグル: {{shortcut}} を1回押すと開始し、もう一度押すと停止します。ホールド: {{shortcut}} を押している間、音声入力します。"
"dictationModeAuto": "自動",
"dictationModesWithAutoDescription": "自動:{{shortcut}} を押し続けると離すまで音声入力し、短く押すと開始と停止を切り替えます。ホールド:{{shortcut}} を押している間、音声入力します。トグル:{{shortcut}} を1回押すと開始し、もう一度押すと停止します。"
},
"WorktreeSymlinksSection": {
"1c1e35b219": "{{value0}} を削除",
+2 -1
View File
@@ -8776,7 +8776,8 @@
"6fa734ed95": "{{value0}} 삭제",
"openAiKeyName": "OpenAI 트랜스크립션 키",
"dictationShortcutDescription": "{{shortcut}} 단축키를 눌러 포커스된 패널에 텍스트를 받아쓰세요.",
"dictationModesDescription": "토글: {{shortcut}} 단축키를 한 번 누르면 받아쓰기를 시작하고, 다시 누르면 중지합니다. 길게 누르기: {{shortcut}} 단축키를 누르고 있는 동안 받아쓰기합니다."
"dictationModeAuto": "자동",
"dictationModesWithAutoDescription": "자동: {{shortcut}} 단축키를 길게 누르면 손을 뗄 때까지 받아쓰기하고, 짧게 누르면 시작하고 중지합니다. 길게 누르기: {{shortcut}} 단축키를 누르고 있는 동안 받아쓰기합니다. 토글: {{shortcut}} 단축키를 한 번 누르면 받아쓰기를 시작하고, 다시 누르면 중지합니다."
},
"WorktreeSymlinksSection": {
"1c1e35b219": "{{value0}} 제거",
+2 -1
View File
@@ -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",
+2 -1
View File
@@ -9826,7 +9826,8 @@
"cd9fe37556": "Доступ к микрофону разрешён",
"openAiKeyName": "Ваш ключ расшифровки OpenAI",
"dictationShortcutDescription": "Нажмите {{shortcut}}, чтобы диктовать текст в любую активную панель.",
"dictationModesDescription": "Переключение: нажмите {{shortcut}} для начала и ещё раз для остановки. Удержание: диктуйте, пока удерживаете {{shortcut}}."
"dictationModeAuto": "Авто",
"dictationModesWithAutoDescription": "Авто: удерживайте {{shortcut}}, чтобы диктовать до отпускания, или нажмите коротко, чтобы начать и остановить. Удержание: диктуйте, пока удерживаете {{shortcut}}. Переключение: нажмите {{shortcut}} для начала и ещё раз для остановки."
},
"WorktreeSymlinksSection": {
"1c1e35b219": "Удалить {{value0}}",
+2 -1
View File
@@ -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ı",
+2 -1
View File
@@ -9293,7 +9293,8 @@
"cd9fe37556": "已授予麥克風權限",
"openAiKeyName": "您的 OpenAI 轉錄金鑰",
"dictationShortcutDescription": "按 {{shortcut}} 可將文字聽寫到目前取得焦點的任意窗格中。",
"dictationModesDescription": "切換:按一次 {{shortcut}} 開始,再按一次停止。按住:按住 {{shortcut}} 期間進行聽寫。"
"dictationModeAuto": "自動",
"dictationModesWithAutoDescription": "自動:按住 {{shortcut}} 聽寫,放開即停止;輕按則開始或停止。按住:按住 {{shortcut}} 期間進行聽寫。切換:按一次 {{shortcut}} 開始,再按一次停止。"
},
"WorktreeSymlinksSection": {
"1c1e35b219": "刪除 {{value0}}",
+2 -1
View File
@@ -8776,7 +8776,8 @@
"6fa734ed95": "删除 {{value0}}",
"openAiKeyName": "您的 OpenAI 转录密钥",
"dictationShortcutDescription": "按 {{shortcut}} 可将文本听写到当前聚焦的任意窗格中。",
"dictationModesDescription": "切换:按一次 {{shortcut}} 开始,再按一次停止。按住:按住 {{shortcut}} 期间进行听写。"
"dictationModeAuto": "自动",
"dictationModesWithAutoDescription": "自动:按住 {{shortcut}} 听写,松开即停止;轻按则开始或停止。按住:按住 {{shortcut}} 期间进行听写。切换:按一次 {{shortcut}} 开始,再按一次停止。"
},
"WorktreeSymlinksSection": {
"1c1e35b219": "删除 {{value0}}",
+1 -1
View File
@@ -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: [],
+2 -1
View File
@@ -313,6 +313,7 @@ export function buildDefaultSettings(args: {
customAgentCommand: ''
},
sourceControlAi: getDefaultSourceControlAiSettings(),
voice: args.voice
voice: args.voice,
voiceDictationModeDefaultedToAuto: true
}
}
+2
View File
@@ -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
}
+2 -1
View File
@@ -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