-
Notifications
You must be signed in to change notification settings - Fork 6
Mt sdk #69
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
base: master
Are you sure you want to change the base?
Mt sdk #69
Conversation
| */ | ||
| Handler.prototype.initialize = function () { | ||
| if(WaEnvUtils.isValidWaEnvVars()) { | ||
| Handler.prototype.initialize = function (credentials) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this called from? traditionally it was called by the skill on startup, if this has not changed then how does it get the credentials? if it has changed then are you creating a new handler for each request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@offerakrabi it is still being called from the skill only. The skill is getting credentials on start up from VCAP_SERVICES of the bound conversation service and then makes a WA API call to get the workspace_id based on the skill name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ashokbabuy This is a singleton - meaning this is the ONLY instance for ALL calls, including all NLU engines.
It is wrong to pass credentials if it is not related to ALL engines.
What do you in a case where there is an engine that is not WCS? that requires different credentials IN ADDITION to WCS?
And how is it multi tenant if you pass here only 1 set of credentials?
| let types = manifest.nlu; | ||
| types.forEach(function (type) { | ||
| promises.push(getNLU(type, manifest.name)); | ||
| promises.push(getNLU(type, manifest.name, credentials)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the skill uses also a regexp engine what credentials will be passed? it doesn't use any credentials
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the skill, we will not be passing the credentials if the nlu is of the type regexp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what if you have regexp AND WCS?
deanhaber
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a misunderstanding about what is the handler's job and what is the relations between all the classes in the SDK and the inheritance between them.
This code changes are VERY tightly coupled with WCS and will eliminate any possibility of using other NLU engines (including custom ones)
Furthermore - where are the unit tests?
| */ | ||
| Handler.prototype.initialize = function () { | ||
| if(WaEnvUtils.isValidWaEnvVars()) { | ||
| Handler.prototype.initialize = function (credentials) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ashokbabuy This is a singleton - meaning this is the ONLY instance for ALL calls, including all NLU engines.
It is wrong to pass credentials if it is not related to ALL engines.
What do you in a case where there is an engine that is not WCS? that requires different credentials IN ADDITION to WCS?
And how is it multi tenant if you pass here only 1 set of credentials?
| if(WaEnvUtils.isValidWaEnvVars()) { | ||
| Handler.prototype.initialize = function (credentials) { | ||
| //check if credentials are coming from the handler initialize call and also valid from the index.js of the skill | ||
| if((credentials && WaEnvUtils.isValidWaCredentials(credentials))){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a specific check for a specific type of NLU engine here. How can you cover here all future types?
| Handler.prototype.initialize = function (credentials) { | ||
| //check if credentials are coming from the handler initialize call and also valid from the index.js of the skill | ||
| if((credentials && WaEnvUtils.isValidWaCredentials(credentials))){ | ||
| this.wcsCredentials = WaEnvUtils.setupWCSCredentialsfromVCAP(credentials); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this is only way we can pass credentials? from VCAP SERVICES?
| let types = manifest.nlu; | ||
| types.forEach(function (type) { | ||
| promises.push(getNLU(type, manifest.name)); | ||
| promises.push(getNLU(type, manifest.name, credentials)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what if you have regexp AND WCS?
|
|
||
| static getNLUs(manifest) { | ||
| //pass the credentials sent from the skill to getNLU's | ||
| static getNLUs(manifest, credentials) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How one set of credentials can cover ALL types of engines?
| * @returns {string} | ||
| */ | ||
|
|
||
| let isValidWaCredentials = function(credentials) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only check here WCS? what about other NLUs?
made changes to make it multi tenant with backward compatibility