Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 49f2346

Browse files
authored
Enabled communication with remote Direct Line Speech bots (#2079)
* Enabled communication with remote DL Speech bots. * Build improvements * Fix undefined reference error. * Addressed PR comments. * Fixed tests.
1 parent 8ca1397 commit 49f2346

36 files changed

Lines changed: 994 additions & 128 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- [client/main] Added Ngrok Status Viewer in PR [2032](https://github.com/microsoft/BotFramework-Emulator/pull/2032)
1111
- [client/main] Changed conversation infrastructure to use Web Sockets to communicate with Web Chat in PR [2034](https://github.com/microsoft/BotFramework-Emulator/pull/2034)
1212
- [client/main] Added new telemetry events and properties in PR [2063](https://github.com/microsoft/BotFramework-Emulator/pull/2063)
13+
- [client] Added support for talking to remote Direct Line Speech bots in PR [2079](https://github.com/microsoft/BotFramework-Emulator/pull/2079)
1314

1415
## Fixed
1516
- [client] Hid services pane by default in PR [2059](https://github.com/microsoft/BotFramework-Emulator/pull/2059)

package-lock.json

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

packages/app/client/src/state/sagas/botSagas.spec.ts

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,19 @@ describe('The botSagas', () => {
274274
ok: false,
275275
status: 500,
276276
statusText: 'INTERNAL SERVER ERROR',
277+
text: async () => undefined,
277278
};
279+
gen.next(mockStartConvoResponse); // startConversation
278280
try {
279-
gen.next(mockStartConvoResponse); // startConversation
281+
gen.next('Cannot read property "id" of undefined.');
280282
expect(true).toBe(false); // ensure catch is hit
281283
} catch (e) {
282-
expect(e).toEqual(new Error('Error occurred while starting a new conversation: 500: INTERNAL SERVER ERROR'));
284+
expect(e).toEqual({
285+
description: '500 INTERNAL SERVER ERROR',
286+
message: 'Error occurred while starting a new conversation',
287+
innerMessage: 'Cannot read property "id" of undefined.',
288+
status: 500,
289+
});
283290
}
284291
});
285292

@@ -323,15 +330,23 @@ describe('The botSagas', () => {
323330
);
324331
gen.next(); // put open()
325332

333+
gen.next({
334+
ok: false,
335+
status: 500,
336+
statusText: 'INTERNAL SERVER ERROR',
337+
text: async () => undefined,
338+
}); // sendInitialLogReport()
339+
326340
try {
327-
gen.next({
328-
ok: false,
329-
status: 500,
330-
statusText: 'INTERNAL SERVER ERROR',
331-
}); // sendInitialLogReport()
341+
gen.next('Could not read property "id" of undefined.');
332342
expect(true).toBe(false); // ensure catch is hit
333343
} catch (e) {
334-
expect(e).toEqual(new Error('Error occurred while sending the initial log report: 500: INTERNAL SERVER ERROR'));
344+
expect(e).toEqual({
345+
description: '500 INTERNAL SERVER ERROR',
346+
message: 'Error occurred while sending the initial log report',
347+
innerMessage: 'Could not read property "id" of undefined.',
348+
status: 500,
349+
});
335350
}
336351
});
337352

@@ -377,15 +392,23 @@ describe('The botSagas', () => {
377392

378393
gen.next({ ok: true }); // sendInitialLogReport()
379394

395+
gen.next({
396+
ok: false,
397+
status: 500,
398+
statusText: 'INTERNAL SERVER ERROR',
399+
text: async () => undefined,
400+
}); // sendInitialActivity()
401+
380402
try {
381-
gen.next({
382-
ok: false,
383-
status: 500,
384-
statusText: 'INTERNAL SERVER ERROR',
385-
}); // sendInitialActivity()
403+
gen.next('Could not read property "id" of undefined.');
386404
expect(true).toBe(false); // ensure catch is hit
387405
} catch (e) {
388-
expect(e).toEqual(new Error('Error occurred while sending the initial activity: 500: INTERNAL SERVER ERROR'));
406+
expect(e).toEqual({
407+
description: '500 INTERNAL SERVER ERROR',
408+
message: 'Error occurred while sending the initial activity',
409+
innerMessage: 'Could not read property "id" of undefined.',
410+
status: 500,
411+
});
389412
}
390413
});
391414
});

packages/app/client/src/state/sagas/botSagas.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { call, ForkEffect, put, select, takeEvery, takeLatest } from 'redux-saga
5555
import { ActiveBotHelper } from '../../ui/helpers/activeBotHelper';
5656
import { generateHash } from '../helpers/botHelpers';
5757
import { RootState } from '../store';
58+
import { throwErrorFromResponse } from '../utils/throwErrorFromResponse';
5859

5960
import { SharedSagas } from './sharedSagas';
6061
import { ChatSagas } from './chatSagas';
@@ -111,9 +112,7 @@ export class BotSagas {
111112
};
112113
let res: Response = yield ConversationService.startConversation(serverUrl, payload);
113114
if (!res.ok) {
114-
throw new Error(
115-
`Error occurred while starting a new conversation: ${res.status}: ${res.statusText || 'No status text'}`
116-
);
115+
yield* throwErrorFromResponse('Error occurred while starting a new conversation', res);
117116
}
118117
const {
119118
conversationId,
@@ -130,6 +129,8 @@ export class BotSagas {
130129
mode: action.payload.mode,
131130
msaAppId: action.payload.appId,
132131
msaPassword: action.payload.appPassword,
132+
speechKey: action.payload.speechKey,
133+
speechRegion: action.payload.speechRegion,
133134
user,
134135
});
135136

@@ -146,17 +147,15 @@ export class BotSagas {
146147
// call emulator to report proper status to chat panel (listening / ngrok)
147148
res = yield ConversationService.sendInitialLogReport(serverUrl, conversationId, action.payload.endpoint);
148149
if (!res.ok) {
149-
throw new Error(
150-
`Error occurred while sending the initial log report: ${res.status}: ${res.statusText || 'No status text'}`
151-
);
150+
yield* throwErrorFromResponse('Error occurred while sending the initial log report', res);
152151
}
153152

154153
// send CU or debug INSPECT message
155-
res = yield ChatSagas.sendInitialActivity({ conversationId, members, mode: action.payload.mode });
156-
if (!res.ok) {
157-
throw new Error(
158-
`Error occurred while sending the initial activity: ${res.status}: ${res.statusText || 'No status text'}`
159-
);
154+
if (!(action.payload.speechKey && action.payload.speechRegion)) {
155+
res = yield ChatSagas.sendInitialActivity({ conversationId, members, mode: action.payload.mode });
156+
if (!res.ok) {
157+
yield* throwErrorFromResponse('Error occurred while sending the initial activity', res);
158+
}
160159
}
161160

162161
// remember the endpoint

0 commit comments

Comments
 (0)