Skip to content

Commit

Permalink
make training silent and disable autosave
Browse files Browse the repository at this point in the history
Signed-off-by: Scar26 <mmatty26@gmail.com>
  • Loading branch information
Scar26 committed Jul 1, 2020
1 parent ed036da commit 04d0d51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions factory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable no-unused-vars */
/* global Nlp, training */
var trainingSet = training.data
const model = new Nlp({ languages: ['en'] })

const model = new Nlp({ languages: ['en'], nlu: {log: false}, autoSave: false, autoLoad: false, modelFileName: '' })
var users = {
idmap: {},

Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Bot {
this.factory = new VM({
sandbox: {
Nlp: NlpManager,
training: this.training
training: this.training,
fs: null,
}
})
this.factory.run(ctx)
Expand All @@ -30,6 +31,10 @@ class Bot {
this.factory.run(`users.addUser("${token}", "${name}")`)
}

getUser (token) {
return this.factory.run(`users.get("${token}")`)
}

render (statement, token) {
return statement.replace(/<bot-name>/g, this.name).replace(/<customer-name>/g, this.factory.run(`currentUser(${token})`))
}
Expand Down

0 comments on commit 04d0d51

Please sign in to comment.