Improve WeChat MP replies and ship MindSpace/H5 production updates.
Add WeChat service account routing with sync acks, connectivity tests, and context isolation; document deploy runbooks; and bundle related MindSpace, voice, Plaza, and server gateway changes for production rollout. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -30,6 +30,7 @@ export function useVoiceSession({
|
||||
const recognitionRef = useRef<ReturnType<typeof createLiveSpeechRecognition> | null>(null);
|
||||
const startedAtRef = useRef(0);
|
||||
const sessionRef = useRef(0);
|
||||
const stopTimerRef = useRef<number | null>(null);
|
||||
|
||||
const syncDisplayText = useCallback(() => {
|
||||
if (userEditedRef.current) return;
|
||||
@@ -46,6 +47,10 @@ export function useVoiceSession({
|
||||
}, []);
|
||||
|
||||
const cleanup = useCallback(async () => {
|
||||
if (stopTimerRef.current != null) {
|
||||
window.clearTimeout(stopTimerRef.current);
|
||||
stopTimerRef.current = null;
|
||||
}
|
||||
recognitionRef.current?.abort();
|
||||
recognitionRef.current = null;
|
||||
const capture = captureRef.current;
|
||||
@@ -57,15 +62,27 @@ export function useVoiceSession({
|
||||
}, []);
|
||||
|
||||
const stopListening = useCallback(() => {
|
||||
recognitionRef.current?.stop();
|
||||
recognitionRef.current = null;
|
||||
const recognition = recognitionRef.current;
|
||||
if (recognition) {
|
||||
recognition.stop();
|
||||
recognitionRef.current = null;
|
||||
if (stopTimerRef.current != null) {
|
||||
window.clearTimeout(stopTimerRef.current);
|
||||
}
|
||||
stopTimerRef.current = window.setTimeout(() => {
|
||||
stopTimerRef.current = null;
|
||||
setPhase((current) => (current === 'transcribing' ? current : 'ready'));
|
||||
}, 220);
|
||||
}
|
||||
const capture = captureRef.current;
|
||||
captureRef.current = null;
|
||||
if (capture) {
|
||||
void capture.cancel();
|
||||
}
|
||||
setAnalyser(null);
|
||||
setPhase((current) => (current === 'transcribing' ? current : 'ready'));
|
||||
if (!recognition) {
|
||||
setPhase((current) => (current === 'transcribing' ? current : 'ready'));
|
||||
}
|
||||
}, []);
|
||||
|
||||
const startServerAsrCapture = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user