修复对话麦克风问题 #64

Merged
cfy777 merged 3 commits from frontend-10 into develop 2026-06-14 13:08:47 +08:00
Showing only changes of commit 41cacaa740 - Show all commits

View File

@@ -336,13 +336,17 @@ export function useVisionSession() {
/** 麦克风开关 */
const toggleMic = useCallback(async () => {
if (isMicOn) {
await stopVAD();
stopMic();
setIsMicOn(false);
} else {
const micStream = await startMic();
setIsMicOn(!!micStream);
if (micStream) {
await startVAD(micStream);
setIsMicOn(true);
}
}
}, [isMicOn, startMic, stopMic]);
}, [isMicOn, startMic, stopMic, startVAD, stopVAD]);
/** 打断当前回复 */
const interrupt = useCallback(() => {