0
votes

I have a webchat bot working fine (I can use speech with it and it returns with speech) with the Bing Speech using the following link:

With option 3:

https://github.com/Microsoft/BotFramework-Samples/blob/master/docs-samples/web-chat-speech/index.html

  const speechOptions = {
    speechRecognizer: new CognitiveServices.SpeechRecognizer({ subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY' }),
    speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
      gender: CognitiveServices.SynthesisGender.Female,
      subscriptionKey: 'YOUR_COGNITIVE_SPEECH_API_KEY',
      voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
    })
  };

However, I am trying to change over from the Bing Speech API to the Speech Services AP, as Bing Speech is being retired.

Does anyone know how to do this for my webchat bot?

1
Do you still need help with this? Which version (3 or 4) of the SDK are you using?Steven Kanberg
@StevenKanberg yes - the issue is described here: github.com/Microsoft/BotFramework-WebChat/issues/1217 it seems it is not yet supported. I am unsure how to find my current Bing Speech SDK version - I have built it from the Azure Portal in Cognitive Services - Bing SpeechJDT
As Bing Speech is deprecated and has, essentially, gone away I wouldn't worry about the SDK version you have. Instead, I would work on developing a new Cognitive Services Speech API or migrating your old API. You can read instructions on how to do that here: docs.microsoft.com/en-us/azure/cognitive-services/…Steven Kanberg

1 Answers

0
votes

The Cognitive Speech Service by azure is not supported in webchat v3.But in webchat v4 you can integrate by following code

const config = {
                    method: "POST",
                    headers: {
                        Authorization:
                            "Bearer  xxwebchatsecretkeyxx"
                    }
                };
     const res = await fetch(
                    "https://directline.botframework.com/v3/directline/tokens/generate",
                    config
                );

                const subscriptionKey = "speech service subscription key";

                const { token } = await res.json();

                let directLine = window.WebChat.createDirectLine({ token });
    window.WebChat.renderWebChat(
                        {
                            directLine,
                            webSpeechPonyfillFactory: await window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory(
                                {
                                    region: "westus",
                                    subscriptionKey
                                }
                            ),
                            userID: model.id,
                            styleSet,
                            store
                        },
                   document.getElementById("webchat")
                );