@@ -51,7 +51,7 @@ export const Answer = ({
5151 const [ audioContext , setAudioContext ] = useState < AudioContext | null > ( null ) ; //Manully manage the audio context eg pausing resuming
5252
5353 const [ synthesizerData , setSynthesizerData ] = useState ( {
54- key : "" ,
54+ token : "" ,
5555 region : "" ,
5656 } ) ;
5757 const [ synthesizer , setSynthesizer ] =
@@ -70,8 +70,8 @@ export const Answer = ({
7070 } ;
7171
7272 const initializeSynthesizer = ( ) => {
73- const speechConfig = sdk . SpeechConfig . fromSubscription (
74- synthesizerData . key ,
73+ const speechConfig = sdk . SpeechConfig . fromAuthorizationToken (
74+ synthesizerData . token ,
7575 synthesizerData . region
7676 ) ;
7777 const newAudioDestination = new SpeechSDK . SpeakerAudioDestination ( ) ;
@@ -90,7 +90,7 @@ export const Answer = ({
9090 } ;
9191
9292 useEffect ( ( ) => {
93- if ( synthesizerData . key != "" ) {
93+ if ( synthesizerData . token != "" ) {
9494 initializeSynthesizer ( ) ;
9595
9696 return ( ) => {
@@ -112,12 +112,12 @@ export const Answer = ({
112112 const response = await fetch ( "/api/speech" ) ;
113113 try {
114114 if ( ! response . ok ) {
115- throw new Error ( "Network response was not ok" ) ;
115+ throw new Error ( "Network response was not ok" ) ;
116116 }
117- const data = await response . json ( ) ;
118- setSynthesizerData ( { key : data . key , region : data . region } ) ;
119- } catch ( e ) {
120- console . log ( e )
117+ const data = await response . json ( ) ;
118+ setSynthesizerData ( { token : data . token , region : data . region } ) ;
119+ } catch ( e ) {
120+ console . log ( e ) ;
121121 }
122122 } ;
123123 fetchSythesizerData ( ) ;
@@ -334,7 +334,7 @@ export const Answer = ({
334334 }
335335 data-testid = "toggle-citations-list"
336336 >
337- < Text className = { styles . accordionTitle } >
337+ < Text className = { styles . accordionTitle } >
338338 < span data-testid = "no-of-references" >
339339 { parsedAnswer . citations . length > 1
340340 ? parsedAnswer . citations . length + " references"
@@ -375,7 +375,7 @@ export const Answer = ({
375375 onKeyDown = { ( e ) =>
376376 e . key === " " || e . key === "Enter"
377377 ? onCitationClicked ( citation )
378- : ( ) => { }
378+ : ( ) => { }
379379 }
380380 tabIndex = { 0 }
381381 title = { createCitationFilepath ( citation , ++ idx ) }
0 commit comments