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
13 changes: 10 additions & 3 deletions Composer/packages/lib/bot-deploy/src/botProjectDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class BotProjectDeploy {
private logger: (string) => any;

// Will be assigned by create or deploy
private tenantId: string = '';
private tenantId = '';

constructor(config: BotProjectDeployConfig) {
this.subId = config.subId;
Expand Down Expand Up @@ -91,7 +91,7 @@ export class BotProjectDeploy {
if (err.body.error.details) {
const details = err.body.error.details;
let errMsg = '';
for (let detail of details) {
for (const detail of details) {
errMsg += detail.message;
}
return errMsg;
Expand Down Expand Up @@ -382,6 +382,7 @@ export class BotProjectDeploy {
name: string,
environment: string,
language: string,
luisEndpoint: string,
luisEndpointKey: string,
luisAuthoringKey?: string,
luisAuthoringRegion?: string,
Expand Down Expand Up @@ -411,6 +412,10 @@ export class BotProjectDeploy {
luisAuthoringRegion || ''
);

if (!luisEndpoint) {
luisEndpoint = `https://${luisAuthoringRegion}.api.cognitive.microsoft.com`;
}

const buildResult = await builder.build(
loadResult.luContents,
loadResult.recognizers,
Expand Down Expand Up @@ -440,7 +445,6 @@ export class BotProjectDeploy {
Object.assign(luisAppIds, luisSettings.luis);
}

const luisEndpoint = `https://${luisAuthoringRegion}.api.cognitive.microsoft.com`;
const luisConfig: any = {
endpoint: luisEndpoint,
endpointKey: luisEndpointKey,
Expand Down Expand Up @@ -536,12 +540,14 @@ export class BotProjectDeploy {
const luisSettings = settings.luis;

let luisEndpointKey = '';
let luisEndpoint = '';

if (luisSettings) {
// if luisAuthoringKey is not set, use the one from the luis settings
luisAuthoringKey = luisAuthoringKey || luisSettings.authoringKey;
luisAuthoringRegion = luisAuthoringRegion || luisSettings.region;
luisEndpointKey = luisSettings.endpointKey;
luisEndpoint = luisSettings.endpoint;
}

if (!language) {
Expand All @@ -552,6 +558,7 @@ export class BotProjectDeploy {
name,
environment,
language,
luisEndpoint,
luisEndpointKey,
luisAuthoringKey,
luisAuthoringRegion,
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/server/src/models/bot/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export enum FileUpdateType {

export interface ILuisConfig {
name: string;
endpoint: string;
authoringKey: string;
endpointKey: string;
authoringRegion: string | 'westus';
Expand Down
8 changes: 6 additions & 2 deletions Composer/packages/server/src/models/bot/luPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,15 @@ export class LuPublisher {
}
const loadResult = await this._loadLuConatents(config.models);
loadResult.luContents = await this._downSizeUtterances(loadResult.luContents);
let endpoint = config.endpoint;
if (!endpoint) {
endpoint = `https://${config.region}.api.cognitive.microsoft.com`;
}
const buildResult = await this.builder.build(
loadResult.luContents,
loadResult.recognizers,
config.authoringKey,
config.region,
endpoint,
config.botName,
config.suffix,
config.fallbackLocal,
Expand Down Expand Up @@ -218,7 +222,7 @@ export class LuPublisher {
private _loadLuConatents = async (paths: string[]) => {
return await this.builder.loadContents(
paths,
this.config?.defaultLanguage || '',
'en-us',
this.config?.environment || '',
this.config?.authoringRegion || ''
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class DefaultSettingManager extends FileSettingManager {
luis: {
name: '',
authoringKey: '',
endpoint: '',
endpointKey: '',
authoringRegion: 'westus',
defaultLanguage: 'en-us',
Expand Down Expand Up @@ -62,6 +63,10 @@ export class DefaultSettingManager extends FileSettingManager {
if (!result.downsampling) {
result.downsampling = this.createDefaultSettings().downsampling;
}
//add luis endpoint for old bot
if (!result.luis.endpoint && result.luis.endpoint !== '') {
result.luis.endpoint = this.createDefaultSettings().luis.endpoint;
}
return result;
}

Expand Down