Fix voice change bug
This commit is contained in:
@@ -1336,6 +1336,9 @@ export const DebugDrawer: React.FC<{
|
||||
// Start every text debug run as a fresh session transcript.
|
||||
setMessages([]);
|
||||
assistantDraftIndexRef.current = null;
|
||||
// Force a fresh WS session so updated assistant runtime config
|
||||
// (voice/model/provider/speed) is applied on session.start.
|
||||
closeWs();
|
||||
if (textTtsEnabled) await ensureAudioContext();
|
||||
await ensureWsSession();
|
||||
setTextSessionStarted(true);
|
||||
@@ -1608,6 +1611,14 @@ export const DebugDrawer: React.FC<{
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) return;
|
||||
if (!wsRef.current || wsRef.current.readyState !== WebSocket.OPEN) return;
|
||||
// If core TTS-related settings changed while drawer stays open,
|
||||
// reset the active WS session so the next launch uses new metadata.
|
||||
closeWs();
|
||||
}, [isOpen, assistant.id, assistant.voice, assistant.speed]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!textTtsEnabled) {
|
||||
stopPlaybackImmediately();
|
||||
|
||||
Reference in New Issue
Block a user