Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
const [displayManageLuis, setDisplayManageLuis] = useState<boolean>(false);
const [displayManageQNA, setDisplayManageQNA] = useState<boolean>(false);

const { setSettings } = useRecoilValue(dispatcherState);
const { setSettings, setQnASettings } = useRecoilValue(dispatcherState);
const rootBotProjectId = useRecoilValue(rootBotProjectIdSelector) || '';
const settings = useRecoilValue(settingsState(projectId));
const mergedSettings = mergePropertiesManagedByRootBot(projectId, rootBotProjectId, settings);
Expand Down Expand Up @@ -89,6 +89,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
...mergedSettings,
qna: { ...mergedSettings.qna, ...newQNASettings },
});
setQnASettings(rootBotProjectId, newQNASettings.subscriptionKey);
};

const linkToPackageManager = `/bot/${rootBotProjectId}/plugin/package-manager/package-manager`;
Expand Down
109 changes: 54 additions & 55 deletions Composer/packages/client/src/components/ManageQNA/ManageQNA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,22 +278,6 @@ export const ManageQNA = (props: ManageQNAProps) => {
applicationType: 'web',
kind: 'web',
});
// deploy qna host webapp
const webAppResult = await webSiteManagementClient.webApps.createOrUpdate(
resourceGroupName,
qnaMakerWebAppName,
{
name: qnaMakerWebAppName,
serverFarmId: resourceGroupName,
location: localRootQNARegion,
siteConfig: {
cors: {
allowedOrigins: ['*'],
},
},
enabled: true,
}
);

// add web config for websites
const azureSearchAdminKey = (await searchManagementClient.adminKeys.get(resourceGroupName, qnaMakerSearchName))
Expand All @@ -310,46 +294,60 @@ export const ManageQNA = (props: ManageQNAProps) => {
const defaultAnswer = 'No good match found in KB.';
const QNAMAKER_EXTENSION_VERSION = 'latest';

await webSiteManagementClient.webApps.createOrUpdateConfiguration(resourceGroupName, qnaMakerWebAppName, {
appSettings: [
{
name: 'AzureSearchName',
value: qnaMakerSearchName,
},
{
name: 'AzureSearchAdminKey',
value: azureSearchAdminKey,
},
{
name: 'UserAppInsightsKey',
value: userAppInsightsKey,
},
{
name: 'UserAppInsightsName',
value: userAppInsightsName,
},
{
name: 'UserAppInsightsAppId',
value: userAppInsightsAppId,
},
{
name: 'PrimaryEndpointKey',
value: primaryEndpointKey,
},
{
name: 'SecondaryEndpointKey',
value: secondaryEndpointKey,
},
{
name: 'DefaultAnswer',
value: defaultAnswer,
},
{
name: 'QNAMAKER_EXTENSION_VERSION',
value: QNAMAKER_EXTENSION_VERSION,
// deploy qna host webapp
const webAppResult = await webSiteManagementClient.webApps.createOrUpdate(
resourceGroupName,
qnaMakerWebAppName,
{
name: qnaMakerWebAppName,
serverFarmId: resourceGroupName,
location: localRootQNARegion,
siteConfig: {
cors: {
allowedOrigins: ['*'],
},
appSettings: [
{
name: 'AzureSearchName',
value: qnaMakerSearchName,
},
{
name: 'AzureSearchAdminKey',
value: azureSearchAdminKey,
},
{
name: 'UserAppInsightsKey',
value: userAppInsightsKey,
},
{
name: 'UserAppInsightsName',
value: userAppInsightsName,
},
{
name: 'UserAppInsightsAppId',
value: userAppInsightsAppId,
},
{
name: 'PrimaryEndpointKey',
value: primaryEndpointKey,
},
{
name: 'SecondaryEndpointKey',
value: secondaryEndpointKey,
},
{
name: 'DefaultAnswer',
value: defaultAnswer,
},
{
name: 'QNAMAKER_EXTENSION_VERSION',
value: QNAMAKER_EXTENSION_VERSION,
},
],
},
],
});
enabled: true,
}
);

// Create qna account
const cognitiveServicesManagementClient = new CognitiveServicesManagementClient(
Expand Down Expand Up @@ -593,6 +591,7 @@ export const ManageQNA = (props: ManageQNAProps) => {
<PrimaryButton
disabled={
loadingQNA ||
showAuthDialog ||
(nextAction === 'choose' && !localRootQNAKey) ||
(nextAction === 'create' && !subscriptionId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export const RootBotExternalService: React.FC<RootBotExternalServiceProps> = (pr
...mergedSettings,
qna: { ...mergedSettings.qna, ...newQNASettings },
});
setQnASettings(projectId, newQNASettings.subscriptionKey);
};

return (
Expand Down Expand Up @@ -384,6 +385,7 @@ export const RootBotExternalService: React.FC<RootBotExternalServiceProps> = (pr
)}
</div>
<PrimaryButton
disabled={displayManageLuis || displayManageQNA}
styles={{ root: { width: '130px', marginTop: '15px' } }}
text={formatMessage('Get LUIS keys')}
onClick={() => {
Expand All @@ -407,6 +409,7 @@ export const RootBotExternalService: React.FC<RootBotExternalServiceProps> = (pr
/>
</div>
<PrimaryButton
disabled={displayManageLuis || displayManageQNA}
styles={{ root: { width: '130px', marginTop: '15px' } }}
text={formatMessage('Get QnA key')}
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,31 +323,6 @@ export class AzureResourceMananger {
throw createCustomizeError(ProvisionErrors.CREATE_QNA_ERROR, appinsightsDeployResult._response.bodyAsText);
}

// deploy qna host webapp
const webAppResult = await webSiteManagementClient.webApps.createOrUpdate(
config.resourceGroupName,
qnaMakerWebAppName,
{
name: qnaMakerWebAppName,
serverFarmId: servicePlanResult.name,
location: config.location,
siteConfig: {
cors: {
allowedOrigins: ['*'],
},
},
enabled: true,
}
);

if (webAppResult._response.status >= 300) {
this.logger({
status: BotProjectDeployLoggerType.PROVISION_ERROR,
message: webAppResult._response.bodyAsText,
});
throw createCustomizeError(ProvisionErrors.CREATE_QNA_ERROR, webAppResult._response.bodyAsText);
}

// add web config for websites
const azureSearchAdminKey = (
await searchManagementClient.adminKeys.get(config.resourceGroupName, qnaMakerSearchName)
Expand All @@ -363,62 +338,73 @@ export class AzureResourceMananger {
const secondaryEndpointKey = `${qnaMakerWebAppName}-SecondaryEndpointKey`;
const defaultAnswer = 'No good match found in KB.';
const QNAMAKER_EXTENSION_VERSION = 'latest';
const EnalbeMultipleTestIndex = 'true';
const EnableMultipleTestIndex = 'true';

const webAppConfigUpdateResult = await webSiteManagementClient.webApps.createOrUpdateConfiguration(
// deploy qna host webapp
const webAppResult = await webSiteManagementClient.webApps.createOrUpdate(
config.resourceGroupName,
qnaMakerWebAppName,
{
appSettings: [
{
name: 'AzureSearchName',
value: qnaMakerSearchName,
},
{
name: 'AzureSearchAdminKey',
value: azureSearchAdminKey,
},
{
name: 'UserAppInsightsKey',
value: userAppInsightsKey,
},
{
name: 'UserAppInsightsName',
value: userAppInsightsName,
},
{
name: 'UserAppInsightsAppId',
value: userAppInsightsAppId,
},
{
name: 'PrimaryEndpointKey',
value: primaryEndpointKey,
},
{
name: 'SecondaryEndpointKey',
value: secondaryEndpointKey,
},
{
name: 'DefaultAnswer',
value: defaultAnswer,
},
{
name: 'QNAMAKER_EXTENSION_VERSION',
value: QNAMAKER_EXTENSION_VERSION,
},
{
name: 'EnalbeMultipleTestIndex',
value: EnalbeMultipleTestIndex,
name: qnaMakerWebAppName,
serverFarmId: servicePlanResult.name,
location: config.location,
siteConfig: {
cors: {
allowedOrigins: ['*'],
},
],
appSettings: [
{
name: 'AzureSearchName',
value: qnaMakerSearchName,
},
{
name: 'AzureSearchAdminKey',
value: azureSearchAdminKey,
},
{
name: 'UserAppInsightsKey',
value: userAppInsightsKey,
},
{
name: 'UserAppInsightsName',
value: userAppInsightsName,
},
{
name: 'UserAppInsightsAppId',
value: userAppInsightsAppId,
},
{
name: 'PrimaryEndpointKey',
value: primaryEndpointKey,
},
{
name: 'SecondaryEndpointKey',
value: secondaryEndpointKey,
},
{
name: 'DefaultAnswer',
value: defaultAnswer,
},
{
name: 'QNAMAKER_EXTENSION_VERSION',
value: QNAMAKER_EXTENSION_VERSION,
},
{
name: 'EnableMultipleTestIndex',
value: EnableMultipleTestIndex,
},
],
},
enabled: true,
}
);
if (webAppConfigUpdateResult._response.status >= 300) {

if (webAppResult._response.status >= 300) {
this.logger({
status: BotProjectDeployLoggerType.PROVISION_ERROR,
message: webAppConfigUpdateResult._response.bodyAsText,
message: webAppResult._response.bodyAsText,
});
throw createCustomizeError(ProvisionErrors.CREATE_QNA_ERROR, webAppConfigUpdateResult._response.bodyAsText);
throw createCustomizeError(ProvisionErrors.CREATE_QNA_ERROR, webAppResult._response.bodyAsText);
}

// Create qna account
Expand Down