How to use the botframework-webchat/CognitiveServices.SpeechRecognizer function in botframework-webchat

To help you get started, we’ve selected a few botframework-webchat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-Emulator / packages / app / client / src / ui / editor / emulator / parts / chat.tsx View on Github external
): any {
  return {
    adaptiveCardsHostConfig: AdaptiveCardsHostConfig,
    bot: {
      id: botId || 'bot',
      name: 'Bot'
    },
    botConnection: directLine,
    formatOptions: {
      showHeader: false
    },
    selectedActivity: selectedActivity$,
    showShell: mode === 'livechat',
    speechOptions:
      (endpoint && endpoint.appId && endpoint.appPassword) ? {
        speechRecognizer: new CognitiveServices.SpeechRecognizer({
          fetchCallback: getSpeechToken.bind(null, endpoint, false),
          fetchOnExpiryCallback: getSpeechToken.bind(null, endpoint, true)
        }),
        speechSynthesizer: new WebChat.Speech.BrowserSpeechSynthesizer()
      } : null,
    user: {
      id: userId || 'default-user',
      name: 'User'
    }
  };
}