diff --git a/client/src/App.tsx b/client/src/App.tsx index beaa855..89d4293 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -7,10 +7,8 @@ import { createMeeting, deleteMeetings, endMeeting, - fetchAnswerSuggestions, fetchMeeting, fetchMeetings, - saveAnswers, saveUtterance, } from './lib/api' @@ -38,6 +36,7 @@ function App() { const lastResultAtRef = useRef(Date.now()) const restartLockRef = useRef(false) const finalizeTimerRef = useRef(null) + const isStartingRef = useRef(false) const hasSpeechRecognition = useMemo(() => { return 'SpeechRecognition' in window || 'webkitSpeechRecognition' in window @@ -83,28 +82,6 @@ function App() { } } - const detectQuestion = (text: string) => { - const trimmed = text.trim() - if (!trimmed) return false - if (trimmed.includes('?')) return true - const patterns = [ - '어때', - '할까', - '인가', - '있나', - '맞지', - '좋을까', - '생각은', - '어떻게', - '왜', - '뭐', - '언제', - '어디', - '누가', - ] - return patterns.some((pattern) => trimmed.includes(pattern)) - } - const startRecognition = () => { const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition @@ -181,7 +158,18 @@ function App() { } recognitionRef.current = recognition - recognition.start() + if (!isStartingRef.current) { + isStartingRef.current = true + try { + recognition.start() + } catch { + // ignore start errors + } finally { + window.setTimeout(() => { + isStartingRef.current = false + }, 200) + } + } } const handleFinalTranscript = async (text: string) => { @@ -218,16 +206,6 @@ function App() { setErrorMessage((err as Error).message) } - if (detectQuestion(trimmed)) { - try { - const context = nextLines.slice(-20).map((line) => line.text) - const result = await fetchAnswerSuggestions(context, trimmed) - setAnswerSuggestions(result.suggestions) - await saveAnswers(meetingIdRef.current, trimmed, result.suggestions) - } catch (err) { - setErrorMessage((err as Error).message) - } - } } const handleStart = async () => {