Skip to content

Commit

Permalink
Release/v2.0.8
Browse files Browse the repository at this point in the history
Fixed : 
- Fix nl-pull for entity type dictionary 
- Latest bot, nlu, and cms revision endpoint
- Remove yarn.lock
  • Loading branch information
luthfianto authored and prakashdivyy committed Dec 27, 2018
1 parent 1365be4 commit 82247c4
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 2,662 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# CHANGELOG
## [2.0.8] - 2018/12/20
### Fixed :
- Fix nl-pull for entity type dictionary
- Latest bot, nlu, and cms revision endpoint
- Remove yarn.lock

## [2.0.6] - 2018/12/20
### Fixed :
- Remove warning http2
Expand All @@ -12,7 +18,6 @@
- NL docs on README
- Move CONTRIBUTING to README

# CHANGELOG
## [2.0.4] - 2018/12/13
### Fixed :
- Remove *.yml from .gitignore
Expand Down Expand Up @@ -102,6 +107,7 @@
- Handle Deployment Management
- Handle User & Team Management

[2.0.8]: https://github.com/kata-ai/kata-cli/compare/v2.0.6...v2.0.8
[2.0.6]: https://github.com/kata-ai/kata-cli/compare/v2.0.5...v2.0.6
[2.0.5]: https://github.com/kata-ai/kata-cli/compare/v2.0.4...v2.0.5
[2.0.4]: https://github.com/kata-ai/kata-cli/compare/v2.0.3...v2.0.4
Expand All @@ -117,4 +123,4 @@
[1.2.3]: https://github.com/kata-ai/kata-cli/compare/v1.2.1...v1.2.3
[1.2.1]: https://github.com/kata-ai/kata-cli/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/kata-ai/kata-cli/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/kata-ai/kata-cli/compare/v1.0.0...v1.1.0
[1.1.0]: https://github.com/kata-ai/kata-cli/compare/v1.0.0...v1.1.0
6 changes: 3 additions & 3 deletions components/bots/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ export default class Bot extends Component {
// TODO: find a better way to get the latest bot revision
try {
const { response: {body: data} } = await this.helper.toPromise(this.api.botApi,
this.api.botApi.projectsProjectIdBotRevisionsGet, projectId);
if (data.data && data.data[0]) {
latestBotRevision = data.data[0].revision;
this.api.botApi.projectsProjectIdBotGet, projectId);
if (data.revision) {
latestBotRevision = data.revision;
}
} catch (e) {
console.error("Error");
Expand Down
20 changes: 10 additions & 10 deletions components/bots/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ export default class Deployment {

try {
const { response: {body: data} } = await this.helper.toPromise(this.api.botApi,
this.api.botApi.projectsProjectIdBotRevisionsGet, projectId);
if (data.data && data.data[0]) {
botRevision = data.data[0].revision;
}
this.api.botApi.projectsProjectIdBotGet, projectId);
if (data.revision) {
botRevision = data.revision;
}
} catch (e) {
console.error("Error");
console.log(this.helper.wrapError(e));
}

try {
const { response: {body: data} } = await this.helper.toPromise(this.api.projectApi,
this.api.projectApi.projectsProjectIdNluRevisionsGet, projectId);
if (data.data && data.data[0]) {
nluRevision = data.data[0].revision;
this.api.projectApi.projectsProjectIdNluGet, projectId);
if (data.snapshot) {
nluRevision = data.snapshot;
}
} catch (e) {
console.error("Error");
Expand All @@ -42,9 +42,9 @@ export default class Deployment {

try {
const { response: {body: data} } = await this.helper.toPromise(this.api.projectApi,
this.api.projectApi.projectsProjectIdCmsRevisionsGet, projectId);
if (data.data && data.data[0]) {
cmsRevision = data.data[0].revision;
this.api.projectApi.projectsProjectIdCmsGet, projectId);
if (data.revision) {
cmsRevision = data.revision;
}
} catch (e) {
console.error("Error");
Expand Down
31 changes: 26 additions & 5 deletions components/nlus/nlu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,39 @@ export default class Nlu extends Component {
}

public async pull() {

const projectId = this.helper.getProp("projectId");
let nluDesc;

try {
const { response: { body } } = await this.helper.toPromise(this.api.projectApi, this.api.projectApi.projectsProjectIdNluGet, projectId);
const { response: { body } } = await this.helper.toPromise(this.api.projectApi,
this.api.projectApi.projectsProjectIdNluGet, projectId);
const {name, lang, visibility, entities} = body;
const nluDesc = {name, lang, visibility, entities};
const nluYml = yaml.dump(nluDesc);
console.log("Writing to nlu.yml...");
fs.writeFileSync("nlu.yml", nluYml);
nluDesc = {name, lang, visibility, entities};
} catch (error) {
console.log("Error: ", this.helper.wrapError(error));
return;
}
for (const entity in nluDesc.entities) {
if (nluDesc.entities[entity] && nluDesc.entities[entity].type === "dict") {
// get dictionary
try {
const { response: { body } } = await this.helper.toPromise(this.api.nluApi,
this.api.nluApi.projectsProjectIdNlusNluNameEntitiesEntityNameGet,
projectId, nluDesc.name, entity);
if (body.dictionary) {
nluDesc.entities[entity].dictionary = body.dictionary;
}
} catch (error) {
console.log("Error: ", this.helper.wrapError(error));
return;
}
}
}

const nluYml = yaml.dump(nluDesc);
console.log("Writing to nlu.yml...");
fs.writeFileSync("nlu.yml", nluYml);
}

public async push() {
Expand Down
6 changes: 3 additions & 3 deletions lib/components/bots/bot.js

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

18 changes: 9 additions & 9 deletions lib/components/bots/deployment.js

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

24 changes: 20 additions & 4 deletions lib/components/nlus/nlu.js

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

30 changes: 15 additions & 15 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kata-cli",
"version": "2.0.6",
"version": "2.0.8",
"description": "Kata AI Command Line Tools",
"main": "index.js",
"bin": {
Expand Down Expand Up @@ -56,7 +56,7 @@
"merapi": "^0.17.1",
"merapi-proxy": "^0.1.7",
"uuid": "^3.2.1",
"zaun": "^2.0.2"
"zaun": "^2.0.3"
},
"devDependencies": {
"@types/inquirer": "0.0.43",
Expand Down
Loading

0 comments on commit 82247c4

Please sign in to comment.