Skip to content

Commit

Permalink
Fixed an issue with adding a QnA KB. (#2066)
Browse files Browse the repository at this point in the history
* Fixed an issue with adding a QnA KB.

* Moved qnamaker hostname to constants file.
  • Loading branch information
tonyanziano committed Jan 29, 2020
1 parent c5f2ff4 commit 1c5e370
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [client/main] Added Ngrok Status Viewer in PR [2032](https://github.com/microsoft/BotFramework-Emulator/pull/2032)
- [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)

## Changed
## Fixed
- [client] Hid services pane by default in PR [2059](https://github.com/microsoft/BotFramework-Emulator/pull/2059)
- [client] Fixed an issue where trying to add a QnA KB manually after signing into Azure was causing the app to crash in PR [2066](https://github.com/microsoft/BotFramework-Emulator/pull/2066)

## Removed
- [client/main] Removed legacy payments code in PR [2058](https://github.com/microsoft/BotFramework-Emulator/pull/2058)
Expand Down
3 changes: 3 additions & 0 deletions packages/app/client/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ export const DOCUMENT_ID_APP_SETTINGS = 'app:settings';
export const DOCUMENT_ID_BOT_SETTINGS = 'bot:settings';
export const DOCUMENT_ID_WELCOME_PAGE = 'welcome-page';
export const DOCUMENT_ID_MARKDOWN_PAGE = 'markdown-page';

/* a QnA maker service needs to be initialized with a valid hostname or msbot will throw */
export const QnAMakerSampleHostname = 'https://myqna.azurewebsites.net';
3 changes: 2 additions & 1 deletion packages/app/client/src/state/sagas/servicesExplorerSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import {
import { sortExplorerContents } from '../actions/explorerActions';
import { SortCriteria } from '../reducers/explorer';
import { RootState } from '../store';
import { QnAMakerSampleHostname } from '../../constants';

import { AzureAuthSaga } from './azureAuthSaga';

Expand Down Expand Up @@ -166,7 +167,7 @@ export class ServicesExplorerSagas {
if (result === 1) {
action.payload.connectedService = BotConfigurationBase.serviceFromJSON({
type,
hostname: '' /* defect workaround */,
hostname: QnAMakerSampleHostname,
} as any);
result = yield* ServicesExplorerSagas.launchConnectedServiceEditor(action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import * as React from 'react';
import { ChangeEvent, Component, ReactNode } from 'react';

import { serviceTypeLabels } from '../../../../../utils/serviceTypeLables';
import { QnAMakerSampleHostname } from '../../../../../constants';

import * as styles from './connectedServiceEditor.scss';
import { KvPair } from './kvPair';
Expand Down Expand Up @@ -106,8 +107,7 @@ export class ConnectedServiceEditor extends Component<ConnectedServiceEditorProp
};
// if qnamaker, initialize with sample hostname so that botframework-config doesn't throw
if (props.serviceType === ServiceTypes.QnA) {
(connectedService as IQnAService).hostname =
(connectedService as IQnAService).hostname || 'https://myqna.azurewebsites.net';
(connectedService as IQnAService).hostname = (connectedService as IQnAService).hostname || QnAMakerSampleHostname;
}
this.state = {
connectedServiceCopy: BotConfigurationBase.serviceFromJSON(connectedService),
Expand Down

0 comments on commit 1c5e370

Please sign in to comment.