Remove redundant audio recording lifecycle hooks in App.jsx
This commit is contained in:
40
src/App.jsx
40
src/App.jsx
@@ -1072,46 +1072,6 @@ async function regenerateFromIndex(index, overrideUserText = null) {
|
|||||||
setIsChatDragActive(false)
|
setIsChatDragActive(false)
|
||||||
}, [canAttachImages, activeSidebarMode])
|
}, [canAttachImages, activeSidebarMode])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (audioInputEnabled || !isRecordingAudio) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
stopAudioRecording({ shouldTranscribe: false })
|
|
||||||
}, [audioInputEnabled, isRecordingAudio])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (audioInputRuntimeReady || !isRecordingAudio) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
stopAudioRecording({ shouldTranscribe: false })
|
|
||||||
}, [audioInputRuntimeReady, isRecordingAudio])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (activeSidebarMode === 'chats' || !isRecordingAudio) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
stopAudioRecording()
|
|
||||||
}, [activeSidebarMode, isRecordingAudio])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
return () => {
|
|
||||||
audioTranscriptionAbortRef.current?.abort()
|
|
||||||
clearAudioTimers()
|
|
||||||
const recorder = audioRecorderRef.current
|
|
||||||
if (recorder) {
|
|
||||||
recorder.ondataavailable = null
|
|
||||||
recorder.onstop = null
|
|
||||||
recorder.onerror = null
|
|
||||||
try {
|
|
||||||
if (recorder.state !== 'inactive') {
|
|
||||||
recorder.stop()
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
stopMediaStream(audioStreamRef.current)
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!settingsLoaded || loading || !backendApiUrl || startupOllamaCheckRanRef.current) return
|
if (!settingsLoaded || loading || !backendApiUrl || startupOllamaCheckRanRef.current) return
|
||||||
startupOllamaCheckRanRef.current = true
|
startupOllamaCheckRanRef.current = true
|
||||||
|
|||||||
Reference in New Issue
Block a user