mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-28 04:24:51 +02:00
[eric] voice: mic tap stops an active recording (async start ate the tap's press-end); composer mic tooltip shows the real dictation combo, not F5
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { comboDisplay, dictationDefaultCombo } from '@/app/pages/Settings/sections/general/ShortcutRecorderChip';
|
||||
import Box from '@mui/material/Box';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
@@ -160,7 +161,7 @@ function DesktopSpawnPill({
|
||||
>
|
||||
<AddRounded sx={{ fontSize: 18 }} />
|
||||
</Box>
|
||||
<Tooltip title={recording ? 'Stop dictation' : preparing ? `Downloading voice model ${voicePct}%` : 'Dictate (F5)'} placement="top" arrow>
|
||||
<Tooltip title={recording ? 'Stop dictation' : preparing ? `Downloading voice model ${voicePct}%` : `Dictate (${comboDisplay(dictationDefaultCombo())})`} placement="top" arrow>
|
||||
<Box
|
||||
role="button"
|
||||
aria-label="Voice dictation"
|
||||
|
||||
@@ -24,11 +24,15 @@ export function VoiceDictationProvider({ children }: { children: React.ReactNode
|
||||
|
||||
const pressStart = useCallback((): void => {
|
||||
if (holdMode) {
|
||||
// A TAP while recording must stop: the quick tap's press-end fires before the async start
|
||||
// flips state to 'recording', so without this the mic could be started by a click but never
|
||||
// stopped by one.
|
||||
if (stateRef.current === 'recording') { heldRef.current = false; void stop(); return; }
|
||||
if (stateRef.current === 'idle') { heldRef.current = true; void start(); }
|
||||
} else {
|
||||
toggle();
|
||||
}
|
||||
}, [holdMode, start, toggle]);
|
||||
}, [holdMode, start, stop, toggle]);
|
||||
|
||||
const pressEnd = useCallback((): void => {
|
||||
if (holdMode && heldRef.current) {
|
||||
|
||||
Reference in New Issue
Block a user