Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LUIS to new (Azure) nodejs SDK #766

Merged
merged 6 commits into from
Feb 19, 2019
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
8 changes: 5 additions & 3 deletions libraries/botbuilder-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
"dependencies": {
"@azure/cognitiveservices-luis-runtime": "^1.2.0",
"@azure/ms-rest-js": "^1.6.0",
"@microsoft/recognizers-text-date-time": "1.1.2",
"@types/html-entities": "^1.2.16",
"@types/node": "^10.12.18",
"@types/request-promise-native": "^1.0.10",
"azure-cognitiveservices-luis-runtime": "^1.0.0",
"botbuilder": "~4.1.6",
"botbuilder-core": "~4.1.6",
"html-entities": "^1.2.1",
"moment": "^2.20.1",
"ms-rest": "^2.3.6",
Expand All @@ -37,6 +38,7 @@
"devDependencies": {
"@types/mocha": "^2.2.47",
"codelyzer": "^4.1.0",
"fs-extra": "^7.0.1",
"mocha": "^5.2.0",
"nock": "^10.0.1",
"nyc": "^11.4.1",
Expand All @@ -52,6 +54,6 @@
},
"files": [
"/lib",
"/src"
"/src"
]
}
14 changes: 7 additions & 7 deletions libraries/botbuilder-ai/src/luisRecognizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 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 { RecognizerResult, TurnContext } from 'botbuilder';
import * as msRest from 'ms-rest';
import { LUISRuntimeClient as LuisClient, LUISRuntimeModels as LuisModels } from '@azure/cognitiveservices-luis-runtime';
import { RecognizerResult, TurnContext } from 'botbuilder-core';
import * as msRest from "@azure/ms-rest-js";
import * as os from 'os';
import * as Url from 'url-parse';

Expand Down Expand Up @@ -159,7 +159,7 @@ export class LuisRecognizer {
// Create client
const creds: msRest.TokenCredentials = new msRest.TokenCredentials(this.application.endpointKey);
const baseUri: string = this.application.endpoint || 'https://westus.api.cognitive.microsoft.com';
this.luisClient = new LuisClient(creds, baseUri);
this.luisClient = new LuisClient(baseUri, creds);
}

/**
Expand Down Expand Up @@ -298,8 +298,8 @@ export class LuisRecognizer {
// 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 @@ -326,7 +326,7 @@ export class LuisRecognizer {
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/src/qnaMaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { Activity, TurnContext } from 'botbuilder';
import { Activity, TurnContext } from 'botbuilder-core';
import * as entities from 'html-entities';
import * as os from 'os';
const pjson: any = require('../package.json');
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
@@ -1,7 +1,7 @@
const assert = require('assert');
const fs = require('fs-extra');
const nock = require('nock');
const { TestAdapter, TurnContext } = require('botbuilder');
const { TestAdapter, TurnContext } = require('botbuilder-core');
const { LuisRecognizer } = require('../');
const luisAppId = '38330cad-f768-4619-96f9-69ea333e594b';

Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-ai/tests/qnaMaker.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert');
const { TestAdapter, TurnContext } = require('botbuilder');
const { TestAdapter, TurnContext } = require('botbuilder-core');
const { QnAMaker } = require('../');
const nock = require('nock');
const fs = require('fs');
Expand Down
6 changes: 3 additions & 3 deletions libraries/botbuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
},
"files": [
"/lib",
"/src"
]
}
"/src"
]
}
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.