Remove LLM question detection
This commit is contained in:
@@ -7,10 +7,8 @@ import {
|
|||||||
createMeeting,
|
createMeeting,
|
||||||
deleteMeetings,
|
deleteMeetings,
|
||||||
endMeeting,
|
endMeeting,
|
||||||
fetchAnswerSuggestions,
|
|
||||||
fetchMeeting,
|
fetchMeeting,
|
||||||
fetchMeetings,
|
fetchMeetings,
|
||||||
saveAnswers,
|
|
||||||
saveUtterance,
|
saveUtterance,
|
||||||
} from './lib/api'
|
} from './lib/api'
|
||||||
|
|
||||||
@@ -38,6 +36,7 @@ function App() {
|
|||||||
const lastResultAtRef = useRef<number>(Date.now())
|
const lastResultAtRef = useRef<number>(Date.now())
|
||||||
const restartLockRef = useRef(false)
|
const restartLockRef = useRef(false)
|
||||||
const finalizeTimerRef = useRef<number | null>(null)
|
const finalizeTimerRef = useRef<number | null>(null)
|
||||||
|
const isStartingRef = useRef(false)
|
||||||
|
|
||||||
const hasSpeechRecognition = useMemo(() => {
|
const hasSpeechRecognition = useMemo(() => {
|
||||||
return 'SpeechRecognition' in window || 'webkitSpeechRecognition' in window
|
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 startRecognition = () => {
|
||||||
const SpeechRecognitionConstructor =
|
const SpeechRecognitionConstructor =
|
||||||
window.SpeechRecognition || window.webkitSpeechRecognition
|
window.SpeechRecognition || window.webkitSpeechRecognition
|
||||||
@@ -181,7 +158,18 @@ function App() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
recognitionRef.current = recognition
|
recognitionRef.current = recognition
|
||||||
|
if (!isStartingRef.current) {
|
||||||
|
isStartingRef.current = true
|
||||||
|
try {
|
||||||
recognition.start()
|
recognition.start()
|
||||||
|
} catch {
|
||||||
|
// ignore start errors
|
||||||
|
} finally {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
isStartingRef.current = false
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFinalTranscript = async (text: string) => {
|
const handleFinalTranscript = async (text: string) => {
|
||||||
@@ -218,16 +206,6 @@ function App() {
|
|||||||
setErrorMessage((err as Error).message)
|
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 () => {
|
const handleStart = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user