Fix Web Speech API desktop voice recognition
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

- Set continuous=true to keep listening through pauses
- Only process final results, ignore interim transcripts
- Add usesFallback check to route Web Speech API transcripts through classification
- Desktop now captures complete phrases before classification
- Add detailed logging for debugging recognition flow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-02 07:25:16 +00:00
parent a44faf6ef4
commit 8a342fa85b
2 changed files with 26 additions and 8 deletions

View File

@@ -44,10 +44,10 @@ export function VoiceFloatingButton() {
severity: 'info',
});
const { isListening, isSupported, transcript, classification, error, startListening, stopListening, reset } =
const { isListening, isSupported, transcript, classification, error, usesFallback, startListening, stopListening, reset } =
useVoiceInput();
// Auto-use classification from backend when transcription completes
// Auto-use classification from backend when transcription completes (MediaRecorder fallback)
React.useEffect(() => {
if (classification && !isListening && !isProcessing && open) {
setClassificationResult(classification);
@@ -55,6 +55,13 @@ export function VoiceFloatingButton() {
}
}, [classification, isListening, isProcessing, open]);
// For Web Speech API (desktop), classify the transcript client-side
React.useEffect(() => {
if (!usesFallback && transcript && !isListening && !isProcessing && open && transcript !== lastClassifiedTranscript) {
classifyTranscript(transcript);
}
}, [usesFallback, transcript, isListening, isProcessing, open, lastClassifiedTranscript]);
const handleOpen = () => {
if (!isSupported) {
setSnackbar({