Skip to content

Commit

Permalink
Merge pull request #844 from Microsoft/daveta-upgrade-luissdk
Browse files Browse the repository at this point in the history
Upgrade LUIS to new SDK - this time with feeling
  • Loading branch information
Zerryth authored Apr 2, 2019
2 parents a8128ba + 5802087 commit b0c245d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libraries/botbuilder-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"@types/html-entities": "^1.2.16",
"@types/node": "^10.12.18",
"@types/request-promise-native": "^1.0.10",
"azure-cognitiveservices-luis-runtime": "1.2.2",
"@azure/cognitiveservices-luis-runtime": "2.0.0",
"botbuilder-core": "~4.1.6",
"html-entities": "^1.2.1",
"moment": "^2.20.1",
"ms-rest": "2.5.0",
"@azure/ms-rest-js": "1.8.1",
"request": "^2.87.0",
"request-promise-native": "1.0.5",
"url-parse": "^1.4.4"
Expand Down
10 changes: 5 additions & 5 deletions libraries/botbuilder-ai/src/luisRecognizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { LUISRuntimeClient as LuisClient, LUISRuntimeModels as LuisModels } from 'azure-cognitiveservices-luis-runtime';
import { LUISRuntimeClient as LuisClient, LUISRuntimeModels as LuisModels } from '@azure/cognitiveservices-luis-runtime';

import { RecognizerResult, TurnContext, BotTelemetryClient, NullTelemetryClient } from 'botbuilder-core';
import * as msRest from "ms-rest";
import * as msRest from "@azure/ms-rest-js";
import * as os from 'os';
import * as Url from 'url-parse';
import { TelemetryConstants } from 'botbuilder-core/lib/telemetryConstants';
Expand Down Expand Up @@ -419,8 +419,8 @@ export class LuisRecognizer implements LuisRecognizerTelemetryClient{
// If the `error` received is a azure-cognitiveservices-luis-runtime error,
// it may have a `response` property and `response.statusCode`.
// If these properties exist, we should populate the error with a correct and informative error message.
if ((error as any).response && (error as any).response.statusCode) {
switch ((error as any).response.statusCode) {
if ((error as any).response && (error as any).response.status) {
switch ((error as any).response.status) {
case 400:
error.message = [
`Response 400: The request's body or parameters are incorrect,`,
Expand All @@ -447,7 +447,7 @@ export class LuisRecognizer implements LuisRecognizerTelemetryClient{
break;
default:
error.message = [
`Response ${ (error as any).response.statusCode }: Unexpected status code received.`,
`Response ${ (error as any).response.status }: Unexpected status code received.`,
`Please verify that your LUIS application is properly setup.`
].join(' ');
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-ai/tests/luisRecognizer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function TestJson(file, done, includeAllIntents, includeInstance, telemetryClien
}

describe('LuisRecognizer', function () {
this.timeout(10000);
this.timeout(15000);

if (!mockLuis && endpointKey === "MockedKey") {
console.warn('WARNING: skipping LuisRecognizer test suite because the LUISAPPKEY environment variable is not defined');
Expand Down
4 changes: 2 additions & 2 deletions libraries/botbuilder-ai/tests/luisSdk.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const assert = require('assert');
const fs = require('fs-extra');
const nock = require('nock');
const { LUISRuntimeClient, LUISRuntimeModels } = require('azure-cognitiveservices-luis-runtime');
const msRest = require("ms-rest");
const { LUISRuntimeClient, LUISRuntimeModels } = require('@azure/cognitiveservices-luis-runtime');
const msRest = require("@azure/ms-rest-js");

const applicationId = '756de20e-f1e6-4dca-b80a-406a31d7054b';
// This can be any endpoint key for calling LUIS
Expand Down

0 comments on commit b0c245d

Please sign in to comment.