diff --git a/CHANGES.md b/CHANGES.md index 6fbce23..73b75b5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +## v3.2.2 + +- fixing context not updated in interactive mode +- fixing array values in context +- create readline interface only in interactive mode + ## v3.2.0 Unifying action parameters. diff --git a/lib/wit.js b/lib/wit.js index 6c7bcb1..1f88136 100644 --- a/lib/wit.js +++ b/lib/wit.js @@ -259,7 +259,7 @@ const Wit = function(token, actions, logger) { this.interactive = (initContext, maxSteps) => { const sessionId = uuid.v1(); - const context = typeof initContext === 'object' ? initContext : {}; + this.context = typeof initContext === 'object' ? initContext : {}; const steps = maxSteps ? maxSteps : DEFAULT_MAX_STEPS; this.rl = readline.createInterface({ input: process.stdin, @@ -273,10 +273,12 @@ const Wit = function(token, actions, logger) { this.runActions( sessionId, msg, - context, + this.context, (error, context) => { if (error) { l.error(error); + } else { + this.context = context; } this.rl.prompt(); this.rl.write(null, {ctrl: true, name: 'e'}); diff --git a/package.json b/package.json index 522c04d..2462b01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-wit", - "version": "3.2.0", + "version": "3.2.2", "description": "Wit.ai Node.js SDK", "keywords": [ "wit",