File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
app/components/realtime-chat Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ export function RealtimeChat({
56
56
const [ deployment , setDeployment ] = useState ( "" ) ;
57
57
const [ useVAD , setUseVAD ] = useState ( true ) ;
58
58
const [ voice , setVoice ] = useState < Voice > ( "alloy" ) ;
59
+ const [ temperature , setTemperature ] = useState ( 0.9 ) ;
59
60
60
61
const clientRef = useRef < RTClient | null > ( null ) ;
61
62
const audioHandlerRef = useRef < AudioHandler | null > ( null ) ;
@@ -84,7 +85,7 @@ export function RealtimeChat({
84
85
input_audio_transcription : { model : "whisper-1" } ,
85
86
turn_detection : turnDetection ,
86
87
tools : [ ] ,
87
- temperature : 0.9 ,
88
+ temperature,
88
89
modalities,
89
90
} ) ;
90
91
startResponseListener ( ) ;
@@ -282,6 +283,14 @@ export function RealtimeChat({
282
283
[ ] ,
283
284
) ;
284
285
286
+ // update session params
287
+ useEffect ( ( ) => {
288
+ clientRef . current ?. configure ( { voice } ) ;
289
+ } , [ voice ] ) ;
290
+ useEffect ( ( ) => {
291
+ clientRef . current ?. configure ( { temperature } ) ;
292
+ } , [ temperature ] ) ;
293
+
285
294
const handleClose = async ( ) => {
286
295
onClose ?.( ) ;
287
296
if ( isRecording ) {
You can’t perform that action at this time.
0 commit comments