Skip to content

Commit 5289ce3

Browse files
authored
Support initial silence timeout (#5400)
* Bump [email protected] * Support initialSilenceTimeout * Add sample for initialSilenceTimeout * Update to MSI token * Add sample * Update PR number * Update [email protected] bump
1 parent c3857bf commit 5289ce3

File tree

14 files changed

+347
-66
lines changed

14 files changed

+347
-66
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
7272
- Copy button is added to fenced code blocks (`<pre><code>`)
7373
- Configure HTML sanitizer via `request.allowedTags`
7474
- Added support for math blocks using `$$` delimiter alongside existing `\[...\]` and `\(...\)` notations, in PR [#5381](https://github.com/microsoft/BotFramework-WebChat/pull/5381), by [@OEvgeny](https://github.com/OEvgeny)
75+
- Added support for speech recognition initial silence timeout when using Azure Speech, in PR [#5400](https://github.com/microsoft/BotFramework/WebChat/pull/5400), by [@compulim](https://github.com/compulim)
7576

7677
### Changed
7778

@@ -93,9 +94,9 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
9394
- Switched math block syntax from `$$` to Tex-style `\[ \]` and `\( \)` delimiters with improved rendering and error handling, in PR [#5353](https://github.com/microsoft/BotFramework-WebChat/pull/5353), by [@OEvgeny](https://github.com/OEvgeny)
9495
- Improved avatar display and grouping behavior by fixing rendering issues and activity sender identification, in PR [#5346](https://github.com/microsoft/BotFramework-WebChat/pull/5346), by [@OEvgeny](https://github.com/OEvgeny)
9596
- Activity "copy" button will use `outerHTML` and `textContent` for clipboard content, in PR [#5378](https://github.com/microsoft/BotFramework-WebChat/pull/5378), by [@compulim](https://github.com/compulim)
96-
- Bumped dependencies to the latest versions, by [@compulim](https://github.com/compulim) in PR [#5385](https://github.com/microsoft/BotFramework-WebChat/pull/5385)
97+
- Bumped dependencies to the latest versions, by [@compulim](https://github.com/compulim) in PR [#5385](https://github.com/microsoft/BotFramework-WebChat/pull/5385) and [#5400](https://github.com/microsoft/BotFramework-WebChat/pull/5400)
9798
- Production dependencies
98-
- [`web-speech-cognitive-services@8.0.0`](https://npmjs.com/package/web-speech-cognitive-services)
99+
- [`web-speech-cognitive-services@8.1.0`](https://npmjs.com/package/web-speech-cognitive-services)
99100

100101
### Fixed
101102

package-lock.json

Lines changed: 20 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bundle/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
"swiper": "8.4.7",
142142
"url-search-params-polyfill": "8.2.5",
143143
"uuid": "8.3.2",
144-
"web-speech-cognitive-services": "^8.0.0",
144+
"web-speech-cognitive-services": "^8.1.0",
145145
"whatwg-fetch": "3.6.20"
146146
},
147147
"devDependencies": {

packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
1313
audioInputDeviceId,
1414
credentials,
1515
enableTelemetry,
16+
initialSilenceTimeout,
1617
speechRecognitionEndpointId,
1718
speechSynthesisDeploymentId,
1819
speechSynthesisOutputFormat,
@@ -23,6 +24,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
2324
audioInputDeviceId?: string;
2425
credentials: CognitiveServicesCredentials;
2526
enableTelemetry?: true;
27+
initialSilenceTimeout?: number | undefined;
2628
speechRecognitionEndpointId?: string;
2729
speechSynthesisDeploymentId?: string;
2830
speechSynthesisOutputFormat?: CognitiveServicesAudioOutputFormat;
@@ -61,6 +63,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
6163
audioContext,
6264
credentials,
6365
enableTelemetry,
66+
initialSilenceTimeout,
6467
referenceGrammars: referenceGrammarID ? [`luis/${referenceGrammarID}-PRODUCTION`] : [],
6568
speechRecognitionEndpointId,
6669
speechSynthesisDeploymentId,

packages/directlinespeech/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"event-target-shim": "6.0.2",
121121
"math-random": "2.0.1",
122122
"microsoft-cognitiveservices-speech-sdk": "1.17.0",
123-
"web-speech-cognitive-services": "^8.0.0"
123+
"web-speech-cognitive-services": "^8.1.0"
124124
},
125125
"engines": {
126126
"node": ">= 10.14.2"

samples/03.speech/b.cognitive-speech-services-js/index.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
4444
if (now > expireAfter) {
4545
expireAfter = now + 300000;
46-
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
47-
method: 'POST'
48-
}).then(
49-
res => res.json(),
50-
err => {
51-
expireAfter = 0;
46+
lastPromise = fetch(
47+
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
48+
{ method: 'POST' }
49+
)
50+
.then(
51+
res => res.json(),
52+
err => {
53+
expireAfter = 0;
5254

53-
return Promise.reject(err);
54-
}
55-
);
55+
return Promise.reject(err);
56+
}
57+
)
58+
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
5659
}
5760

5861
return lastPromise;

samples/03.speech/c.cognitive-speech-services-with-lexical-result/index.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
4444
if (now > expireAfter) {
4545
expireAfter = now + 300000;
46-
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
47-
method: 'POST'
48-
}).then(
49-
res => res.json(),
50-
err => {
51-
expireAfter = 0;
46+
lastPromise = fetch(
47+
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
48+
{ method: 'POST' }
49+
)
50+
.then(
51+
res => res.json(),
52+
err => {
53+
expireAfter = 0;
5254

53-
return Promise.reject(err);
54-
}
55-
);
55+
return Promise.reject(err);
56+
}
57+
)
58+
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
5659
}
5760

5861
return lastPromise;

samples/03.speech/d.cognitive-speech-services-speech-recognition-only/index.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
4444
if (now > expireAfter) {
4545
expireAfter = now + 300000;
46-
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
47-
method: 'POST'
48-
}).then(
49-
res => res.json(),
50-
err => {
51-
expireAfter = 0;
46+
lastPromise = fetch(
47+
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
48+
{ method: 'POST' }
49+
)
50+
.then(
51+
res => res.json(),
52+
err => {
53+
expireAfter = 0;
5254

53-
return Promise.reject(err);
54-
}
55-
);
55+
return Promise.reject(err);
56+
}
57+
)
58+
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
5659
}
5760

5861
return lastPromise;

samples/03.speech/e.select-voice/index.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
4444
if (now > expireAfter) {
4545
expireAfter = now + 300000;
46-
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
47-
method: 'POST'
48-
}).then(
49-
res => res.json(),
50-
err => {
51-
expireAfter = 0;
46+
lastPromise = fetch(
47+
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
48+
{ method: 'POST' }
49+
)
50+
.then(
51+
res => res.json(),
52+
err => {
53+
expireAfter = 0;
5254

53-
return Promise.reject(err);
54-
}
55-
);
55+
return Promise.reject(err);
56+
}
57+
)
58+
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
5659
}
5760

5861
return lastPromise;

samples/03.speech/g.hybrid-speech/index.html

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@
4343
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
4444
if (now > expireAfter) {
4545
expireAfter = now + 300000;
46-
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
47-
method: 'POST'
48-
}).then(
49-
res => res.json(),
50-
err => {
51-
expireAfter = 0;
52-
53-
return Promise.reject(err);
54-
}
55-
);
46+
lastPromise = fetch(
47+
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
48+
{ method: 'POST' }
49+
)
50+
.then(
51+
res => res.json(),
52+
err => {
53+
expireAfter = 0;
54+
55+
return Promise.reject(err);
56+
}
57+
)
58+
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
5659
}
5760

5861
return lastPromise;

0 commit comments

Comments
 (0)