diff --git a/app/components/realtime-chat/realtime-chat.tsx b/app/components/realtime-chat/realtime-chat.tsx index 3111f541561..2ea6d527e56 100644 --- a/app/components/realtime-chat/realtime-chat.tsx +++ b/app/components/realtime-chat/realtime-chat.tsx @@ -56,6 +56,7 @@ export function RealtimeChat({ const [deployment, setDeployment] = useState(""); const [useVAD, setUseVAD] = useState(true); const [voice, setVoice] = useState("alloy"); + const [temperature, setTemperature] = useState(0.9); const clientRef = useRef(null); const audioHandlerRef = useRef(null); @@ -84,7 +85,7 @@ export function RealtimeChat({ input_audio_transcription: { model: "whisper-1" }, turn_detection: turnDetection, tools: [], - temperature: 0.9, + temperature, modalities, }); startResponseListener(); @@ -282,6 +283,14 @@ export function RealtimeChat({ [], ); + // update session params + useEffect(() => { + clientRef.current?.configure({ voice }); + }, [voice]); + useEffect(() => { + clientRef.current?.configure({ temperature }); + }, [temperature]); + const handleClose = async () => { onClose?.(); if (isRecording) {