Skip to content

Support initial silence timeout #5400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Copy button is added to fenced code blocks (`<pre><code>`)
- Configure HTML sanitizer via `request.allowedTags`
- 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)
- 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)

### Changed

Expand All @@ -93,9 +94,9 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- 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)
- 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)
- 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)
- Bumped dependencies to the latest versions, by [@compulim](https://github.com/compulim) in PR [#5385](https://github.com/microsoft/BotFramework-WebChat/pull/5385)
- 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)
- Production dependencies
- [`web-speech-cognitive-services@8.0.0`](https://npmjs.com/package/web-speech-cognitive-services)
- [`web-speech-cognitive-services@8.1.0`](https://npmjs.com/package/web-speech-cognitive-services)

### Fixed

Expand Down
27 changes: 20 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"swiper": "8.4.7",
"url-search-params-polyfill": "8.2.5",
"uuid": "8.3.2",
"web-speech-cognitive-services": "^8.0.0",
"web-speech-cognitive-services": "^8.1.0",
"whatwg-fetch": "3.6.20"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
audioInputDeviceId,
credentials,
enableTelemetry,
initialSilenceTimeout,
speechRecognitionEndpointId,
speechSynthesisDeploymentId,
speechSynthesisOutputFormat,
Expand All @@ -23,6 +24,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
audioInputDeviceId?: string;
credentials: CognitiveServicesCredentials;
enableTelemetry?: true;
initialSilenceTimeout?: number | undefined;
speechRecognitionEndpointId?: string;
speechSynthesisDeploymentId?: string;
speechSynthesisOutputFormat?: CognitiveServicesAudioOutputFormat;
Expand Down Expand Up @@ -61,6 +63,7 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({
audioContext,
credentials,
enableTelemetry,
initialSilenceTimeout,
referenceGrammars: referenceGrammarID ? [`luis/${referenceGrammarID}-PRODUCTION`] : [],
speechRecognitionEndpointId,
speechSynthesisDeploymentId,
Expand Down
2 changes: 1 addition & 1 deletion packages/directlinespeech/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"event-target-shim": "6.0.2",
"math-random": "2.0.1",
"microsoft-cognitiveservices-speech-sdk": "1.17.0",
"web-speech-cognitive-services": "^8.0.0"
"web-speech-cognitive-services": "^8.1.0"
},
"engines": {
"node": ">= 10.14.2"
Expand Down
21 changes: 12 additions & 9 deletions samples/03.speech/b.cognitive-speech-services-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
if (now > expireAfter) {
expireAfter = now + 300000;
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
method: 'POST'
}).then(
res => res.json(),
err => {
expireAfter = 0;
lastPromise = fetch(
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
{ method: 'POST' }
)
.then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
);
return Promise.reject(err);
}
)
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
}

return lastPromise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
if (now > expireAfter) {
expireAfter = now + 300000;
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
method: 'POST'
}).then(
res => res.json(),
err => {
expireAfter = 0;
lastPromise = fetch(
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
{ method: 'POST' }
)
.then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
);
return Promise.reject(err);
}
)
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
}

return lastPromise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
if (now > expireAfter) {
expireAfter = now + 300000;
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
method: 'POST'
}).then(
res => res.json(),
err => {
expireAfter = 0;
lastPromise = fetch(
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
{ method: 'POST' }
)
.then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
);
return Promise.reject(err);
}
)
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
}

return lastPromise;
Expand Down
21 changes: 12 additions & 9 deletions samples/03.speech/e.select-voice/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
if (now > expireAfter) {
expireAfter = now + 300000;
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
method: 'POST'
}).then(
res => res.json(),
err => {
expireAfter = 0;
lastPromise = fetch(
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
{ method: 'POST' }
)
.then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
);
return Promise.reject(err);
}
)
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
}

return lastPromise;
Expand Down
23 changes: 13 additions & 10 deletions samples/03.speech/g.hybrid-speech/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
if (now > expireAfter) {
expireAfter = now + 300000;
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
method: 'POST'
}).then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
);
lastPromise = fetch(
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
{ method: 'POST' }
)
.then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
)
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
}

return lastPromise;
Expand Down
21 changes: 12 additions & 9 deletions samples/03.speech/h.select-audio-input-device/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@
// https://docs.microsoft.com/en-us/azure/cognitive-services/authentication#authenticate-with-an-authentication-token
if (now > expireAfter) {
expireAfter = now + 300000;
lastPromise = fetch('https://webchat-mockbot.azurewebsites.net/speechservices/token', {
method: 'POST'
}).then(
res => res.json(),
err => {
expireAfter = 0;
lastPromise = fetch(
'https://hawo-mockbot4-token-app.blueriver-ce85e8f0.westus.azurecontainerapps.io/api/token/speech/msi',
{ method: 'POST' }
)
.then(
res => res.json(),
err => {
expireAfter = 0;

return Promise.reject(err);
}
);
return Promise.reject(err);
}
)
.then(({ region, token }) => ({ authorizationToken: `Bearer ${token}`, region }));
}

return lastPromise;
Expand Down
Loading
Loading